@@ -81,7 +81,7 @@ |
||
| 81 | 81 | * |
| 82 | 82 | * @param string $map_json The map marker json. |
| 83 | 83 | * @since 1.6.22 |
| 84 | - * @return mixed |
|
| 84 | + * @return string |
|
| 85 | 85 | */ |
| 86 | 86 | function geodir_save_map_cache($map_json){
|
| 87 | 87 | |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | // Enable map cache if set |
| 10 | 10 | if(get_option('geodir_enable_map_cache')){
|
| 11 | - add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | - add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 11 | + add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | + add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
@@ -23,56 +23,56 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function geodir_get_map_cache($cache){
|
| 25 | 25 | |
| 26 | - // if a search is going on then dont even try to check for cache. |
|
| 27 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 28 | - return $cache; |
|
| 29 | - } |
|
| 26 | + // if a search is going on then dont even try to check for cache. |
|
| 27 | + if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 28 | + return $cache; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $url_params = array(); |
|
| 32 | - $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; |
|
| 33 | - $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : ''; |
|
| 34 | - $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : ''; |
|
| 35 | - $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : ''; |
|
| 36 | - $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : ''; |
|
| 37 | - $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : ''; |
|
| 38 | - $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : ''; |
|
| 39 | - $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : ''; |
|
| 40 | - $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : ''; |
|
| 41 | - $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : ''; |
|
| 42 | - $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : ''; |
|
| 43 | - $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
|
| 44 | - $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
|
| 31 | + $url_params = array(); |
|
| 32 | + $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; |
|
| 33 | + $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : ''; |
|
| 34 | + $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : ''; |
|
| 35 | + $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : ''; |
|
| 36 | + $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : ''; |
|
| 37 | + $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : ''; |
|
| 38 | + $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : ''; |
|
| 39 | + $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : ''; |
|
| 40 | + $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : ''; |
|
| 41 | + $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : ''; |
|
| 42 | + $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : ''; |
|
| 43 | + $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
|
| 44 | + $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
|
| 45 | 45 | |
| 46 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 46 | + $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 47 | 47 | |
| 48 | - $blog_id = get_current_blog_id(); |
|
| 49 | - if($blog_id>1){
|
|
| 50 | - $file_name = $blog_id."_".$file_name; |
|
| 51 | - } |
|
| 48 | + $blog_id = get_current_blog_id(); |
|
| 49 | + if($blog_id>1){
|
|
| 50 | + $file_name = $blog_id."_".$file_name; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
|
| 53 | + $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | - if(file_exists($file_path.$file_name.".json")){
|
|
| 56 | + if(file_exists($file_path.$file_name.".json")){
|
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - // do the cache delete stuff |
|
| 60 | - $cache_time = get_option('geodir_map_cache');
|
|
| 61 | - if(!$cache_time){
|
|
| 62 | - $cache_time = time(); |
|
| 63 | - update_option('geodir_map_cache', $cache_time);
|
|
| 64 | - } |
|
| 59 | + // do the cache delete stuff |
|
| 60 | + $cache_time = get_option('geodir_map_cache');
|
|
| 61 | + if(!$cache_time){
|
|
| 62 | + $cache_time = time(); |
|
| 63 | + update_option('geodir_map_cache', $cache_time);
|
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 67 | - geodir_delete_map_cache(); |
|
| 68 | - } |
|
| 66 | + if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 67 | + geodir_delete_map_cache(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - ob_start(); |
|
| 71 | - readfile($file_path.$file_name.".json"); // readfile is quicker then file get contents |
|
| 72 | - return ob_get_clean(); |
|
| 73 | - } |
|
| 70 | + ob_start(); |
|
| 71 | + readfile($file_path.$file_name.".json"); // readfile is quicker then file get contents |
|
| 72 | + return ob_get_clean(); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - return $cache; |
|
| 75 | + return $cache; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
@@ -85,105 +85,105 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function geodir_save_map_cache($map_json){
|
| 87 | 87 | |
| 88 | - // if a search is going on then dont even try to check for cache. |
|
| 89 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 90 | - return $map_json; |
|
| 91 | - } |
|
| 88 | + // if a search is going on then dont even try to check for cache. |
|
| 89 | + if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 90 | + return $map_json; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - $url_params = array(); |
|
| 94 | - $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; |
|
| 95 | - $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : ''; |
|
| 96 | - $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : ''; |
|
| 97 | - $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : ''; |
|
| 98 | - $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : ''; |
|
| 99 | - $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : ''; |
|
| 100 | - $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : ''; |
|
| 101 | - $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : ''; |
|
| 102 | - $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : ''; |
|
| 103 | - $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : ''; |
|
| 104 | - $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : ''; |
|
| 105 | - $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
|
| 106 | - $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
|
| 93 | + $url_params = array(); |
|
| 94 | + $url_params[] = isset($_REQUEST['cat_id']) ? $_REQUEST['cat_id'] : ''; |
|
| 95 | + $url_params[] = isset($_REQUEST['zl']) ? $_REQUEST['zl'] : ''; |
|
| 96 | + $url_params[] = isset($_REQUEST['gd_map_h']) ? $_REQUEST['gd_map_h'] : ''; |
|
| 97 | + $url_params[] = isset($_REQUEST['gd_map_w']) ? $_REQUEST['gd_map_w'] : ''; |
|
| 98 | + $url_params[] = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : ''; |
|
| 99 | + $url_params[] = isset($_REQUEST['lat_ne']) ? $_REQUEST['lat_ne'] : ''; |
|
| 100 | + $url_params[] = isset($_REQUEST['lon_ne']) ? $_REQUEST['lon_ne'] : ''; |
|
| 101 | + $url_params[] = isset($_REQUEST['lat_sw']) ? $_REQUEST['lat_sw'] : ''; |
|
| 102 | + $url_params[] = isset($_REQUEST['lon_sw']) ? $_REQUEST['lon_sw'] : ''; |
|
| 103 | + $url_params[] = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : ''; |
|
| 104 | + $url_params[] = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : ''; |
|
| 105 | + $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
|
| 106 | + $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
|
| 107 | 107 | |
| 108 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 108 | + $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 109 | 109 | |
| 110 | - $blog_id = get_current_blog_id(); |
|
| 111 | - if($blog_id>1){
|
|
| 112 | - $file_name = $blog_id."_".$file_name; |
|
| 113 | - } |
|
| 110 | + $blog_id = get_current_blog_id(); |
|
| 111 | + if($blog_id>1){
|
|
| 112 | + $file_name = $blog_id."_".$file_name; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
|
| 115 | + $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | - global $wp_filesystem; |
|
| 119 | - $wp_filesystem->put_contents( |
|
| 120 | - $file_path.$file_name.".json", |
|
| 121 | - $map_json, |
|
| 122 | - FS_CHMOD_FILE // predefined mode settings for WP files |
|
| 123 | - ); |
|
| 118 | + global $wp_filesystem; |
|
| 119 | + $wp_filesystem->put_contents( |
|
| 120 | + $file_path.$file_name.".json", |
|
| 121 | + $map_json, |
|
| 122 | + FS_CHMOD_FILE // predefined mode settings for WP files |
|
| 123 | + ); |
|
| 124 | 124 | |
| 125 | 125 | |
| 126 | - return $map_json; |
|
| 126 | + return $map_json; |
|
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | 131 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
|
| 132 | - global $gd_session; |
|
| 133 | - $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
| 134 | - $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
|
| 135 | - $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 136 | - $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
| 137 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 138 | - echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
| 139 | - die; |
|
| 132 | + global $gd_session; |
|
| 133 | + $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
| 134 | + $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
|
| 135 | + $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 136 | + $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
| 137 | + $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 138 | + echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
| 139 | + die; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Send the content-type header with correct encoding |
| 143 | 143 | header("Content-type: text/javascript; charset=utf-8");
|
| 144 | 144 | |
| 145 | 145 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
|
| 146 | - echo get_markers(); |
|
| 147 | - exit; |
|
| 146 | + echo get_markers(); |
|
| 147 | + exit; |
|
| 148 | 148 | } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
|
| 149 | - /** |
|
| 150 | - * @global object $wpdb WordPress Database object. |
|
| 151 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 152 | - * @global object $gd_session GeoDirectory Session object. |
|
| 153 | - */ |
|
| 154 | - global $wpdb, $plugin_prefix, $gd_session; |
|
| 155 | - |
|
| 156 | - if ($_REQUEST['m_id'] != '') {
|
|
| 157 | - $pid = (int)$_REQUEST['m_id']; |
|
| 158 | - } else {
|
|
| 159 | - echo __('No marker data found', 'geodirectory');
|
|
| 160 | - exit; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 164 | - $post = (object)$gd_ses_listing; |
|
| 165 | - echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
| 166 | - } else {
|
|
| 167 | - $geodir_post_type = get_post_type($pid); |
|
| 168 | - |
|
| 169 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 170 | - |
|
| 171 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 172 | - |
|
| 173 | - $postinfo = $wpdb->get_results($sql); |
|
| 174 | - |
|
| 175 | - $data_arr = array(); |
|
| 176 | - |
|
| 177 | - if ($postinfo) {
|
|
| 178 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 179 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 180 | - |
|
| 181 | - foreach ($postinfo as $postinfo_obj) {
|
|
| 182 | - echo geodir_get_infowindow_html($postinfo_obj); |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - } |
|
| 186 | - exit; |
|
| 149 | + /** |
|
| 150 | + * @global object $wpdb WordPress Database object. |
|
| 151 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 152 | + * @global object $gd_session GeoDirectory Session object. |
|
| 153 | + */ |
|
| 154 | + global $wpdb, $plugin_prefix, $gd_session; |
|
| 155 | + |
|
| 156 | + if ($_REQUEST['m_id'] != '') {
|
|
| 157 | + $pid = (int)$_REQUEST['m_id']; |
|
| 158 | + } else {
|
|
| 159 | + echo __('No marker data found', 'geodirectory');
|
|
| 160 | + exit; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 164 | + $post = (object)$gd_ses_listing; |
|
| 165 | + echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
| 166 | + } else {
|
|
| 167 | + $geodir_post_type = get_post_type($pid); |
|
| 168 | + |
|
| 169 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 170 | + |
|
| 171 | + $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 172 | + |
|
| 173 | + $postinfo = $wpdb->get_results($sql); |
|
| 174 | + |
|
| 175 | + $data_arr = array(); |
|
| 176 | + |
|
| 177 | + if ($postinfo) {
|
|
| 178 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 179 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 180 | + |
|
| 181 | + foreach ($postinfo as $postinfo_obj) {
|
|
| 182 | + echo geodir_get_infowindow_html($postinfo_obj); |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | + exit; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -202,93 +202,93 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | function get_markers() {
|
| 204 | 204 | |
| 205 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 205 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 206 | 206 | |
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * Filter to allow for any map caching to be output before queries. |
|
| 210 | - * |
|
| 211 | - * @since 1.6.22 |
|
| 212 | - */ |
|
| 213 | - $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 214 | - if($map_cache){
|
|
| 215 | - return $map_cache; |
|
| 216 | - wp_die(); |
|
| 217 | - } |
|
| 208 | + /** |
|
| 209 | + * Filter to allow for any map caching to be output before queries. |
|
| 210 | + * |
|
| 211 | + * @since 1.6.22 |
|
| 212 | + */ |
|
| 213 | + $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 214 | + if($map_cache){
|
|
| 215 | + return $map_cache; |
|
| 216 | + wp_die(); |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | |
| 221 | - $search = ''; |
|
| 221 | + $search = ''; |
|
| 222 | 222 | |
| 223 | - $srcharr = array("'", "/", "-", '"', '\\', ''');
|
|
| 224 | - $replarr = array("′", "⁄", "–", "“", '', "′");
|
|
| 223 | + $srcharr = array("'", "/", "-", '"', '\\', ''');
|
|
| 224 | + $replarr = array("′", "⁄", "–", "“", '', "′");
|
|
| 225 | 225 | |
| 226 | - $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
| 226 | + $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
| 227 | 227 | |
| 228 | - $map_cat_ids_array = array('0');
|
|
| 229 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 228 | + $map_cat_ids_array = array('0');
|
|
| 229 | + $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 230 | 230 | |
| 231 | 231 | |
| 232 | - $field_default_cat = ''; |
|
| 233 | - if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
|
|
| 234 | - $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
| 232 | + $field_default_cat = ''; |
|
| 233 | + if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
|
|
| 234 | + $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
| 235 | 235 | |
| 236 | - if (!empty($map_cat_arr)) {
|
|
| 237 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 236 | + if (!empty($map_cat_arr)) {
|
|
| 237 | + $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 238 | 238 | |
| 239 | - $map_cat_ids_array = explode(',', $map_cat_arr);
|
|
| 240 | - $cat_find_array = array(); |
|
| 241 | - foreach ($map_cat_ids_array as $cat_id) {
|
|
| 242 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 243 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 244 | - $main_query_array[] = $cat_id; |
|
| 245 | - } |
|
| 239 | + $map_cat_ids_array = explode(',', $map_cat_arr);
|
|
| 240 | + $cat_find_array = array(); |
|
| 241 | + foreach ($map_cat_ids_array as $cat_id) {
|
|
| 242 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 243 | + $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 244 | + $main_query_array[] = $cat_id; |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - } |
|
| 248 | - } |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | - if (!empty($field_default_cat)) |
|
| 251 | - $field_default_cat = ''; |
|
| 250 | + if (!empty($field_default_cat)) |
|
| 251 | + $field_default_cat = ''; |
|
| 252 | 252 | |
| 253 | - if (!empty($cat_find_array)) |
|
| 254 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 253 | + if (!empty($cat_find_array)) |
|
| 254 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 255 | 255 | |
| 256 | - $main_query_array = $map_cat_ids_array; |
|
| 256 | + $main_query_array = $map_cat_ids_array; |
|
| 257 | 257 | |
| 258 | - if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
|
| 259 | - $search .= " AND p.post_title LIKE %s"; |
|
| 260 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * Filter the marker query search SQL, values are replaces with %s or %d. |
|
| 265 | - * |
|
| 266 | - * @since 1.5.3 |
|
| 267 | - * |
|
| 268 | - * @param string $search The SQL query for search/where. |
|
| 269 | - */ |
|
| 270 | - $search = apply_filters('geodir_marker_search', $search);
|
|
| 271 | - /** |
|
| 272 | - * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
| 273 | - * |
|
| 274 | - * @since 1.5.3 |
|
| 275 | - * |
|
| 276 | - * @param array $main_query_array The SQL query values for search/where. |
|
| 277 | - */ |
|
| 278 | - $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
|
|
| 279 | - |
|
| 280 | - $gd_posttype = ''; |
|
| 281 | - if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
|
| 282 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 283 | - $gd_posttype = " AND p.post_type = %s"; |
|
| 284 | - $main_query_array[] = $_REQUEST['gd_posttype']; |
|
| 285 | - |
|
| 286 | - } else |
|
| 287 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 288 | - |
|
| 289 | - $join = ", " . $table . " AS pd "; |
|
| 290 | - |
|
| 291 | - /** |
|
| 258 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
|
| 259 | + $search .= " AND p.post_title LIKE %s"; |
|
| 260 | + $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * Filter the marker query search SQL, values are replaces with %s or %d. |
|
| 265 | + * |
|
| 266 | + * @since 1.5.3 |
|
| 267 | + * |
|
| 268 | + * @param string $search The SQL query for search/where. |
|
| 269 | + */ |
|
| 270 | + $search = apply_filters('geodir_marker_search', $search);
|
|
| 271 | + /** |
|
| 272 | + * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
| 273 | + * |
|
| 274 | + * @since 1.5.3 |
|
| 275 | + * |
|
| 276 | + * @param array $main_query_array The SQL query values for search/where. |
|
| 277 | + */ |
|
| 278 | + $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
|
|
| 279 | + |
|
| 280 | + $gd_posttype = ''; |
|
| 281 | + if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
|
| 282 | + $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 283 | + $gd_posttype = " AND p.post_type = %s"; |
|
| 284 | + $main_query_array[] = $_REQUEST['gd_posttype']; |
|
| 285 | + |
|
| 286 | + } else |
|
| 287 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
| 288 | + |
|
| 289 | + $join = ", " . $table . " AS pd "; |
|
| 290 | + |
|
| 291 | + /** |
|
| 292 | 292 | * Filter the SQL JOIN clause for the markers data |
| 293 | 293 | * |
| 294 | 294 | * @since 1.0.0 |
@@ -305,16 +305,16 @@ discard block |
||
| 305 | 305 | * @param string $search Row of searched fields to use in WHERE clause. |
| 306 | 306 | */ |
| 307 | 307 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 308 | - $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
|
| 309 | - $cat_type = $post_type . 'category'; |
|
| 310 | - if ($post_type == 'gd_event') {
|
|
| 311 | - $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
| 312 | - } else {
|
|
| 313 | - $event_select = ""; |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 317 | - /** |
|
| 308 | + $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
|
| 309 | + $cat_type = $post_type . 'category'; |
|
| 310 | + if ($post_type == 'gd_event') {
|
|
| 311 | + $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
| 312 | + } else {
|
|
| 313 | + $event_select = ""; |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 317 | + /** |
|
| 318 | 318 | * Filter the SQL SELECT clause to retrive fields data |
| 319 | 319 | * |
| 320 | 320 | * @since 1.0.0 |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 335 | 335 | |
| 336 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 336 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 337 | 337 | |
| 338 | 338 | /** |
| 339 | 339 | * Filter the SQL query to retrive markers data |
@@ -349,276 +349,276 @@ discard block |
||
| 349 | 349 | // print_r($gd_session); |
| 350 | 350 | // print_r($_SESSION); |
| 351 | 351 | |
| 352 | - $catinfo = $wpdb->get_results($catsql); |
|
| 352 | + $catinfo = $wpdb->get_results($catsql); |
|
| 353 | 353 | |
| 354 | - $cat_content_info = array(); |
|
| 355 | - $content_data = array(); |
|
| 356 | - $post_ids = array(); |
|
| 357 | - |
|
| 358 | - /** |
|
| 359 | - * Called before marker data is processed into JSON. |
|
| 360 | - * |
|
| 361 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 362 | - * |
|
| 363 | - * @since 1.5.3 |
|
| 364 | - * @param object $catinfo The posts object containing all marker data. |
|
| 365 | - * @see 'geodir_after_marker_post_process' |
|
| 366 | - */ |
|
| 367 | - $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
|
|
| 368 | - |
|
| 369 | - /** |
|
| 370 | - * Called before marker data is processed into JSON. |
|
| 371 | - * |
|
| 372 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 373 | - * |
|
| 374 | - * @since 1.4.9 |
|
| 375 | - * @param object $catinfo The posts object containing all marker data. |
|
| 376 | - * @see 'geodir_after_marker_post_process' |
|
| 377 | - */ |
|
| 378 | - do_action('geodir_before_marker_post_process_action', $catinfo);
|
|
| 379 | - |
|
| 380 | - // Sort any posts into a ajax array |
|
| 381 | - if (!empty($catinfo)) {
|
|
| 382 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
| 383 | - global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
|
| 384 | - |
|
| 385 | - $today = strtotime(date_i18n('Y-m-d'));
|
|
| 386 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 354 | + $cat_content_info = array(); |
|
| 355 | + $content_data = array(); |
|
| 356 | + $post_ids = array(); |
|
| 357 | + |
|
| 358 | + /** |
|
| 359 | + * Called before marker data is processed into JSON. |
|
| 360 | + * |
|
| 361 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 362 | + * |
|
| 363 | + * @since 1.5.3 |
|
| 364 | + * @param object $catinfo The posts object containing all marker data. |
|
| 365 | + * @see 'geodir_after_marker_post_process' |
|
| 366 | + */ |
|
| 367 | + $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
|
|
| 368 | + |
|
| 369 | + /** |
|
| 370 | + * Called before marker data is processed into JSON. |
|
| 371 | + * |
|
| 372 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 373 | + * |
|
| 374 | + * @since 1.4.9 |
|
| 375 | + * @param object $catinfo The posts object containing all marker data. |
|
| 376 | + * @see 'geodir_after_marker_post_process' |
|
| 377 | + */ |
|
| 378 | + do_action('geodir_before_marker_post_process_action', $catinfo);
|
|
| 379 | + |
|
| 380 | + // Sort any posts into a ajax array |
|
| 381 | + if (!empty($catinfo)) {
|
|
| 382 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
| 383 | + global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
|
| 384 | + |
|
| 385 | + $today = strtotime(date_i18n('Y-m-d'));
|
|
| 386 | + $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 387 | 387 | |
| 388 | - foreach ($catinfo as $catinfo_obj) {
|
|
| 389 | - $post_title = $catinfo_obj->post_title; |
|
| 388 | + foreach ($catinfo as $catinfo_obj) {
|
|
| 389 | + $post_title = $catinfo_obj->post_title; |
|
| 390 | 390 | |
| 391 | - if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
|
|
| 392 | - $event_dates = ''; |
|
| 393 | - $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
| 391 | + if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates) && $show_dates > 0) {
|
|
| 392 | + $event_dates = ''; |
|
| 393 | + $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
| 394 | 394 | |
| 395 | - $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
| 395 | + $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
| 396 | 396 | |
| 397 | - if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
|
|
| 398 | - $starttimes = ''; |
|
| 399 | - $endtimes = ''; |
|
| 400 | - $astarttimes = array(); |
|
| 401 | - $aendtimes = array(); |
|
| 402 | - if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 403 | - $recurring_data['repeat_type'] = 'custom'; |
|
| 404 | - } |
|
| 405 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 406 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 397 | + if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
|
|
| 398 | + $starttimes = ''; |
|
| 399 | + $endtimes = ''; |
|
| 400 | + $astarttimes = array(); |
|
| 401 | + $aendtimes = array(); |
|
| 402 | + if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 403 | + $recurring_data['repeat_type'] = 'custom'; |
|
| 404 | + } |
|
| 405 | + $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 406 | + $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 407 | 407 | |
| 408 | - $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 408 | + $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 409 | 409 | |
| 410 | - if ( !empty( $recurring_dates ) ) {
|
|
| 411 | - if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 412 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 413 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 414 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 415 | - } else {
|
|
| 416 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 417 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 418 | - } |
|
| 419 | - } |
|
| 410 | + if ( !empty( $recurring_dates ) ) {
|
|
| 411 | + if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 412 | + if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 413 | + $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 414 | + $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 415 | + } else {
|
|
| 416 | + $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 417 | + $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 418 | + } |
|
| 419 | + } |
|
| 420 | 420 | |
| 421 | - $e = 0; |
|
| 422 | - foreach( $recurring_dates as $key => $date ) {
|
|
| 423 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 424 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 425 | - $starttimes = $astarttimes[$key]; |
|
| 426 | - $endtimes = $aendtimes[$key]; |
|
| 427 | - } else {
|
|
| 428 | - $starttimes = ''; |
|
| 429 | - $endtimes = ''; |
|
| 430 | - } |
|
| 431 | - } |
|
| 421 | + $e = 0; |
|
| 422 | + foreach( $recurring_dates as $key => $date ) {
|
|
| 423 | + if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 424 | + if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 425 | + $starttimes = $astarttimes[$key]; |
|
| 426 | + $endtimes = $aendtimes[$key]; |
|
| 427 | + } else {
|
|
| 428 | + $starttimes = ''; |
|
| 429 | + $endtimes = ''; |
|
| 430 | + } |
|
| 431 | + } |
|
| 432 | 432 | |
| 433 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 434 | - $duration--; |
|
| 435 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 433 | + $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 434 | + $duration--; |
|
| 435 | + $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 436 | 436 | |
| 437 | - // Hide past dates |
|
| 438 | - if ( strtotime( $enddate ) < $today ) {
|
|
| 439 | - continue; |
|
| 440 | - } |
|
| 437 | + // Hide past dates |
|
| 438 | + if ( strtotime( $enddate ) < $today ) {
|
|
| 439 | + continue; |
|
| 440 | + } |
|
| 441 | 441 | |
| 442 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 443 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 442 | + $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 443 | + $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 444 | 444 | |
| 445 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 446 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 445 | + $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 446 | + $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 447 | 447 | |
| 448 | - $same_day = false; |
|
| 449 | - $full_day = false; |
|
| 450 | - $same_datetime = false; |
|
| 448 | + $same_day = false; |
|
| 449 | + $full_day = false; |
|
| 450 | + $same_datetime = false; |
|
| 451 | 451 | |
| 452 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 453 | - $full_day = true; |
|
| 454 | - } |
|
| 452 | + if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 453 | + $full_day = true; |
|
| 454 | + } |
|
| 455 | 455 | |
| 456 | - if ( $start_date == $end_date && $full_day ) {
|
|
| 457 | - $same_datetime = true; |
|
| 458 | - } |
|
| 459 | - |
|
| 460 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 461 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 462 | - if ( $full_day ) {
|
|
| 463 | - $start_date = $title_date; |
|
| 464 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 465 | - } |
|
| 456 | + if ( $start_date == $end_date && $full_day ) {
|
|
| 457 | + $same_datetime = true; |
|
| 458 | + } |
|
| 459 | + |
|
| 460 | + $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 461 | + $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 462 | + if ( $full_day ) {
|
|
| 463 | + $start_date = $title_date; |
|
| 464 | + $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 465 | + } |
|
| 466 | 466 | |
| 467 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 468 | - $same_day = true; |
|
| 467 | + if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 468 | + $same_day = true; |
|
| 469 | 469 | |
| 470 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 471 | - } |
|
| 470 | + $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | - $event_dates .= ' :: ' . $start_date; |
|
| 473 | + $event_dates .= ' :: ' . $start_date; |
|
| 474 | 474 | |
| 475 | - if ( !$same_day && !$same_datetime ) {
|
|
| 476 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 477 | - } |
|
| 475 | + if ( !$same_day && !$same_datetime ) {
|
|
| 476 | + $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 477 | + } |
|
| 478 | 478 | |
| 479 | - $e++; |
|
| 479 | + $e++; |
|
| 480 | 480 | |
| 481 | - if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
|
|
| 482 | - break; |
|
| 483 | - } |
|
| 484 | - } |
|
| 485 | - } |
|
| 486 | - } else {
|
|
| 487 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 488 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 489 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 490 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 491 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 481 | + if ($show_dates > 0 && $e == $show_dates) { // only show 3 event dates
|
|
| 482 | + break; |
|
| 483 | + } |
|
| 484 | + } |
|
| 485 | + } |
|
| 486 | + } else {
|
|
| 487 | + $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 488 | + $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 489 | + $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 490 | + $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 491 | + $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 492 | 492 | |
| 493 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 494 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 495 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 493 | + $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 494 | + $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 495 | + $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 496 | 496 | |
| 497 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 498 | - $start_date = $event_recurring_dates[0]; |
|
| 499 | - } |
|
| 497 | + if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 498 | + $start_date = $event_recurring_dates[0]; |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 502 | - $end_date = $start_date; |
|
| 503 | - } |
|
| 501 | + if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 502 | + $end_date = $start_date; |
|
| 503 | + } |
|
| 504 | 504 | |
| 505 | - if ($end_date != '' && strtotime($end_date) >= $today) {
|
|
| 506 | - if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 507 | - $starttime = $starttimes[0]; |
|
| 508 | - $endtime = $endtimes[0]; |
|
| 509 | - } |
|
| 505 | + if ($end_date != '' && strtotime($end_date) >= $today) {
|
|
| 506 | + if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 507 | + $starttime = $starttimes[0]; |
|
| 508 | + $endtime = $endtimes[0]; |
|
| 509 | + } |
|
| 510 | 510 | |
| 511 | - $same_day = false; |
|
| 512 | - $one_day = false; |
|
| 513 | - if ( $start_date == $end_date && $all_day ) {
|
|
| 514 | - $one_day = true; |
|
| 515 | - } |
|
| 516 | - |
|
| 517 | - if ( $all_day ) {
|
|
| 518 | - $start_datetime = strtotime( $start_date ); |
|
| 519 | - $end_datetime = strtotime( $end_date ); |
|
| 511 | + $same_day = false; |
|
| 512 | + $one_day = false; |
|
| 513 | + if ( $start_date == $end_date && $all_day ) {
|
|
| 514 | + $one_day = true; |
|
| 515 | + } |
|
| 516 | + |
|
| 517 | + if ( $all_day ) {
|
|
| 518 | + $start_datetime = strtotime( $start_date ); |
|
| 519 | + $end_datetime = strtotime( $end_date ); |
|
| 520 | 520 | |
| 521 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 522 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 523 | - if ( $start_date == $end_date ) {
|
|
| 524 | - $one_day = true; |
|
| 525 | - } |
|
| 526 | - } else {
|
|
| 527 | - if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 528 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 529 | - $one_day = false; |
|
| 530 | - } |
|
| 531 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 532 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 521 | + $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 522 | + $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 523 | + if ( $start_date == $end_date ) {
|
|
| 524 | + $one_day = true; |
|
| 525 | + } |
|
| 526 | + } else {
|
|
| 527 | + if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 528 | + $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 529 | + $one_day = false; |
|
| 530 | + } |
|
| 531 | + $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 532 | + $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 533 | 533 | |
| 534 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 535 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 536 | - } |
|
| 534 | + $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 535 | + $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 536 | + } |
|
| 537 | 537 | |
| 538 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 539 | - $same_day = true; |
|
| 538 | + if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 539 | + $same_day = true; |
|
| 540 | 540 | |
| 541 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 542 | - } |
|
| 541 | + $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 542 | + } |
|
| 543 | 543 | |
| 544 | - $event_dates .= ' :: ' . $start_date; |
|
| 544 | + $event_dates .= ' :: ' . $start_date; |
|
| 545 | 545 | |
| 546 | - if ( !$same_day && !$one_day ) {
|
|
| 547 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 548 | - } |
|
| 549 | - } |
|
| 550 | - } |
|
| 551 | - |
|
| 552 | - if (empty($event_dates)) {
|
|
| 553 | - continue; |
|
| 554 | - } |
|
| 546 | + if ( !$same_day && !$one_day ) {
|
|
| 547 | + $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 548 | + } |
|
| 549 | + } |
|
| 550 | + } |
|
| 551 | + |
|
| 552 | + if (empty($event_dates)) {
|
|
| 553 | + continue; |
|
| 554 | + } |
|
| 555 | 555 | |
| 556 | - $post_title .= $event_dates; |
|
| 557 | - } |
|
| 556 | + $post_title .= $event_dates; |
|
| 557 | + } |
|
| 558 | 558 | |
| 559 | - $map_cat_ids_array; |
|
| 560 | - $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
| 559 | + $map_cat_ids_array; |
|
| 560 | + $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
|
| 561 | 561 | |
| 562 | - // if single cat lets just show that icon |
|
| 563 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 564 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
| 565 | - } |
|
| 562 | + // if single cat lets just show that icon |
|
| 563 | + if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 564 | + $default_cat = (int)$map_cat_ids_array[0]; |
|
| 565 | + } |
|
| 566 | 566 | |
| 567 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
| 568 | - $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
| 569 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
| 567 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
|
| 568 | + $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
| 569 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
| 570 | 570 | |
| 571 | - if ($icon != '') {
|
|
| 572 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 571 | + if ($icon != '') {
|
|
| 572 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 573 | 573 | |
| 574 | - if (isset($gd_marker_sizes[$icon])) {
|
|
| 575 | - $icon_size = $gd_marker_sizes[$icon]; |
|
| 576 | - } else {
|
|
| 577 | - $icon_size = geodir_get_marker_size($icon); |
|
| 578 | - $gd_marker_sizes[$icon] = $icon_size; |
|
| 579 | - } |
|
| 580 | - } else {
|
|
| 581 | - $icon_size = array('w' => 36, 'h' => 45);
|
|
| 582 | - } |
|
| 583 | - |
|
| 584 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 585 | - $post_ids[] = $catinfo_obj->post_id; |
|
| 586 | - } |
|
| 587 | - } |
|
| 588 | - |
|
| 589 | - /** |
|
| 590 | - * Called after marker data is processed into JSON. |
|
| 591 | - * |
|
| 592 | - * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 593 | - * |
|
| 594 | - * @since 1.4.9 |
|
| 595 | - * @param array $content_data The array containing all markers in JSON format. |
|
| 596 | - * @param object $catinfo The posts object containing all marker data. |
|
| 597 | - * @see 'geodir_before_marker_post_process' |
|
| 598 | - */ |
|
| 599 | - do_action('geodir_after_marker_post_process', $content_data, $catinfo);
|
|
| 600 | - |
|
| 601 | - if (!empty($content_data)) {
|
|
| 602 | - $cat_content_info[] = implode(',', $content_data);
|
|
| 603 | - } |
|
| 604 | - |
|
| 605 | - $totalcount = count(array_unique($post_ids)); |
|
| 606 | - |
|
| 607 | - if (!empty($cat_content_info)) {
|
|
| 608 | - $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 609 | - } |
|
| 610 | - else {
|
|
| 611 | - $map_json = '[{"totalcount":"0"}]';
|
|
| 612 | - } |
|
| 613 | - |
|
| 614 | - |
|
| 615 | - /** |
|
| 616 | - * Filter the marker json return. |
|
| 617 | - * |
|
| 618 | - * @since 1.6.22 |
|
| 619 | - * @param string $map_json The JSON string of the map markers results. |
|
| 620 | - */ |
|
| 621 | - return apply_filters('geodir_markers_json',$map_json);
|
|
| 574 | + if (isset($gd_marker_sizes[$icon])) {
|
|
| 575 | + $icon_size = $gd_marker_sizes[$icon]; |
|
| 576 | + } else {
|
|
| 577 | + $icon_size = geodir_get_marker_size($icon); |
|
| 578 | + $gd_marker_sizes[$icon] = $icon_size; |
|
| 579 | + } |
|
| 580 | + } else {
|
|
| 581 | + $icon_size = array('w' => 36, 'h' => 45);
|
|
| 582 | + } |
|
| 583 | + |
|
| 584 | + $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 585 | + $post_ids[] = $catinfo_obj->post_id; |
|
| 586 | + } |
|
| 587 | + } |
|
| 588 | + |
|
| 589 | + /** |
|
| 590 | + * Called after marker data is processed into JSON. |
|
| 591 | + * |
|
| 592 | + * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 593 | + * |
|
| 594 | + * @since 1.4.9 |
|
| 595 | + * @param array $content_data The array containing all markers in JSON format. |
|
| 596 | + * @param object $catinfo The posts object containing all marker data. |
|
| 597 | + * @see 'geodir_before_marker_post_process' |
|
| 598 | + */ |
|
| 599 | + do_action('geodir_after_marker_post_process', $content_data, $catinfo);
|
|
| 600 | + |
|
| 601 | + if (!empty($content_data)) {
|
|
| 602 | + $cat_content_info[] = implode(',', $content_data);
|
|
| 603 | + } |
|
| 604 | + |
|
| 605 | + $totalcount = count(array_unique($post_ids)); |
|
| 606 | + |
|
| 607 | + if (!empty($cat_content_info)) {
|
|
| 608 | + $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 609 | + } |
|
| 610 | + else {
|
|
| 611 | + $map_json = '[{"totalcount":"0"}]';
|
|
| 612 | + } |
|
| 613 | + |
|
| 614 | + |
|
| 615 | + /** |
|
| 616 | + * Filter the marker json return. |
|
| 617 | + * |
|
| 618 | + * @since 1.6.22 |
|
| 619 | + * @param string $map_json The JSON string of the map markers results. |
|
| 620 | + */ |
|
| 621 | + return apply_filters('geodir_markers_json',$map_json);
|
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Enable map cache if set |
| 10 | -if(get_option('geodir_enable_map_cache')){
|
|
| 11 | - add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | - add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 10 | +if (get_option('geodir_enable_map_cache')) {
|
|
| 11 | + add_filter('geodir_get_markers_cache', 'geodir_get_map_cache');
|
|
| 12 | + add_filter('geodir_markers_json', 'geodir_save_map_cache', 10);
|
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * @since 1.6.22 |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | -function geodir_get_map_cache($cache){
|
|
| 24 | +function geodir_get_map_cache($cache) {
|
|
| 25 | 25 | |
| 26 | 26 | // if a search is going on then dont even try to check for cache. |
| 27 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 27 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 28 | 28 | return $cache; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -43,27 +43,27 @@ discard block |
||
| 43 | 43 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 44 | 44 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 45 | 45 | |
| 46 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 46 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 47 | 47 | |
| 48 | 48 | $blog_id = get_current_blog_id(); |
| 49 | - if($blog_id>1){
|
|
| 49 | + if ($blog_id > 1) {
|
|
| 50 | 50 | $file_name = $blog_id."_".$file_name; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - if(file_exists($file_path.$file_name.".json")){
|
|
| 56 | + if (file_exists($file_path.$file_name.".json")) {
|
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | // do the cache delete stuff |
| 60 | 60 | $cache_time = get_option('geodir_map_cache');
|
| 61 | - if(!$cache_time){
|
|
| 61 | + if (!$cache_time) {
|
|
| 62 | 62 | $cache_time = time(); |
| 63 | 63 | update_option('geodir_map_cache', $cache_time);
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 66 | + if ((time() - $cache_time) > 86400) { // delete the cache every 24 hours
|
|
| 67 | 67 | geodir_delete_map_cache(); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | * @since 1.6.22 |
| 84 | 84 | * @return mixed |
| 85 | 85 | */ |
| 86 | -function geodir_save_map_cache($map_json){
|
|
| 86 | +function geodir_save_map_cache($map_json) {
|
|
| 87 | 87 | |
| 88 | 88 | // if a search is going on then dont even try to check for cache. |
| 89 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 89 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 90 | 90 | return $map_json; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 106 | 106 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 107 | 107 | |
| 108 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 108 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 109 | 109 | |
| 110 | 110 | $blog_id = get_current_blog_id(); |
| 111 | - if($blog_id>1){
|
|
| 111 | + if ($blog_id > 1) {
|
|
| 112 | 112 | $file_name = $blog_id."_".$file_name; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
| 135 | 135 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
| 136 | 136 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
| 137 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 137 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
| 138 | 138 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
| 139 | 139 | die; |
| 140 | 140 | } |
@@ -154,21 +154,21 @@ discard block |
||
| 154 | 154 | global $wpdb, $plugin_prefix, $gd_session; |
| 155 | 155 | |
| 156 | 156 | if ($_REQUEST['m_id'] != '') {
|
| 157 | - $pid = (int)$_REQUEST['m_id']; |
|
| 157 | + $pid = (int) $_REQUEST['m_id']; |
|
| 158 | 158 | } else {
|
| 159 | 159 | echo __('No marker data found', 'geodirectory');
|
| 160 | 160 | exit; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
| 164 | - $post = (object)$gd_ses_listing; |
|
| 164 | + $post = (object) $gd_ses_listing; |
|
| 165 | 165 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
| 166 | 166 | } else {
|
| 167 | 167 | $geodir_post_type = get_post_type($pid); |
| 168 | 168 | |
| 169 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 169 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 170 | 170 | |
| 171 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 171 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
|
|
| 172 | 172 | |
| 173 | 173 | $postinfo = $wpdb->get_results($sql); |
| 174 | 174 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | function get_markers() {
|
| 204 | 204 | |
| 205 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 205 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session; |
|
| 206 | 206 | |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @since 1.6.22 |
| 212 | 212 | */ |
| 213 | - $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 214 | - if($map_cache){
|
|
| 213 | + $map_cache = apply_filters('geodir_get_markers_cache', '');
|
|
| 214 | + if ($map_cache) {
|
|
| 215 | 215 | return $map_cache; |
| 216 | 216 | wp_die(); |
| 217 | 217 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
| 227 | 227 | |
| 228 | 228 | $map_cat_ids_array = array('0');
|
| 229 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 229 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
|
|
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | $field_default_cat = ''; |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
| 235 | 235 | |
| 236 | 236 | if (!empty($map_cat_arr)) {
|
| 237 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 237 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
|
|
| 238 | 238 | |
| 239 | 239 | $map_cat_ids_array = explode(',', $map_cat_arr);
|
| 240 | 240 | $cat_find_array = array(); |
| 241 | 241 | foreach ($map_cat_ids_array as $cat_id) {
|
| 242 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 243 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 242 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
| 243 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
| 244 | 244 | $main_query_array[] = $cat_id; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | $field_default_cat = ''; |
| 252 | 252 | |
| 253 | 253 | if (!empty($cat_find_array)) |
| 254 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 254 | + $search .= "AND (".implode(' OR ', $cat_find_array).")";
|
|
| 255 | 255 | |
| 256 | 256 | $main_query_array = $map_cat_ids_array; |
| 257 | 257 | |
| 258 | 258 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
| 259 | 259 | $search .= " AND p.post_title LIKE %s"; |
| 260 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 260 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -279,14 +279,14 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | $gd_posttype = ''; |
| 281 | 281 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
| 282 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 282 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
| 283 | 283 | $gd_posttype = " AND p.post_type = %s"; |
| 284 | 284 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 285 | 285 | |
| 286 | 286 | } else |
| 287 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 287 | + $table = $plugin_prefix.'gd_place_detail'; |
|
| 288 | 288 | |
| 289 | - $join = ", " . $table . " AS pd "; |
|
| 289 | + $join = ", ".$table." AS pd "; |
|
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | 292 | * Filter the SQL JOIN clause for the markers data |
@@ -306,14 +306,14 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 308 | 308 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
| 309 | - $cat_type = $post_type . 'category'; |
|
| 309 | + $cat_type = $post_type.'category'; |
|
| 310 | 310 | if ($post_type == 'gd_event') {
|
| 311 | 311 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
| 312 | 312 | } else {
|
| 313 | 313 | $event_select = ""; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 316 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
| 317 | 317 | /** |
| 318 | 318 | * Filter the SQL SELECT clause to retrive fields data |
| 319 | 319 | * |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 335 | 335 | |
| 336 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 336 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
|
|
| 337 | 337 | |
| 338 | 338 | /** |
| 339 | 339 | * Filter the SQL query to retrive markers data |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
| 384 | 384 | |
| 385 | 385 | $today = strtotime(date_i18n('Y-m-d'));
|
| 386 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 386 | + $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 387 | 387 | |
| 388 | 388 | foreach ($catinfo as $catinfo_obj) {
|
| 389 | 389 | $post_title = $catinfo_obj->post_title; |
@@ -399,29 +399,29 @@ discard block |
||
| 399 | 399 | $endtimes = ''; |
| 400 | 400 | $astarttimes = array(); |
| 401 | 401 | $aendtimes = array(); |
| 402 | - if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 402 | + if (!isset($recurring_data['repeat_type'])) {
|
|
| 403 | 403 | $recurring_data['repeat_type'] = 'custom'; |
| 404 | 404 | } |
| 405 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 406 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 405 | + $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
|
|
| 406 | + $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false; |
|
| 407 | 407 | |
| 408 | 408 | $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
| 409 | 409 | |
| 410 | - if ( !empty( $recurring_dates ) ) {
|
|
| 411 | - if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 412 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 413 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 414 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 410 | + if (!empty($recurring_dates)) {
|
|
| 411 | + if (empty($recurring_data['all_day'])) {
|
|
| 412 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 413 | + $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 414 | + $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 415 | 415 | } else {
|
| 416 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 417 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 416 | + $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 417 | + $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | $e = 0; |
| 422 | - foreach( $recurring_dates as $key => $date ) {
|
|
| 423 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 424 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 422 | + foreach ($recurring_dates as $key => $date) {
|
|
| 423 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 424 | + if (!empty($astarttimes) && isset($astarttimes[$key])) {
|
|
| 425 | 425 | $starttimes = $astarttimes[$key]; |
| 426 | 426 | $endtimes = $aendtimes[$key]; |
| 427 | 427 | } else {
|
@@ -430,50 +430,50 @@ discard block |
||
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 433 | + $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1; |
|
| 434 | 434 | $duration--; |
| 435 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 435 | + $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day'));
|
|
| 436 | 436 | |
| 437 | 437 | // Hide past dates |
| 438 | - if ( strtotime( $enddate ) < $today ) {
|
|
| 438 | + if (strtotime($enddate) < $today) {
|
|
| 439 | 439 | continue; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 443 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 442 | + $sdate = strtotime($date.' '.$starttimes); |
|
| 443 | + $edate = strtotime($enddate.' '.$endtimes); |
|
| 444 | 444 | |
| 445 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 446 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 445 | + $start_date = date_i18n($geodir_date_time_format, $sdate); |
|
| 446 | + $end_date = date_i18n($geodir_date_time_format, $edate); |
|
| 447 | 447 | |
| 448 | 448 | $same_day = false; |
| 449 | 449 | $full_day = false; |
| 450 | 450 | $same_datetime = false; |
| 451 | 451 | |
| 452 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 452 | + if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) {
|
|
| 453 | 453 | $full_day = true; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - if ( $start_date == $end_date && $full_day ) {
|
|
| 456 | + if ($start_date == $end_date && $full_day) {
|
|
| 457 | 457 | $same_datetime = true; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 461 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 462 | - if ( $full_day ) {
|
|
| 460 | + $link_date = date_i18n('Y-m-d', $sdate);
|
|
| 461 | + $title_date = date_i18n($geodir_date_format, $sdate); |
|
| 462 | + if ($full_day) {
|
|
| 463 | 463 | $start_date = $title_date; |
| 464 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 464 | + $end_date = date_i18n($geodir_date_format, $edate); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 467 | + if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) {
|
|
| 468 | 468 | $same_day = true; |
| 469 | 469 | |
| 470 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 470 | + $start_date .= ' - '.date_i18n($geodir_time_format, $edate); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - $event_dates .= ' :: ' . $start_date; |
|
| 473 | + $event_dates .= ' :: '.$start_date; |
|
| 474 | 474 | |
| 475 | - if ( !$same_day && !$same_datetime ) {
|
|
| 476 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 475 | + if (!$same_day && !$same_datetime) {
|
|
| 476 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $e++; |
@@ -484,67 +484,67 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | } else {
|
| 487 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 488 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 489 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 490 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 491 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 487 | + $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : ''; |
|
| 488 | + $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date; |
|
| 489 | + $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false; |
|
| 490 | + $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 491 | + $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 492 | 492 | |
| 493 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 494 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 495 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 493 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 494 | + $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 495 | + $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 496 | 496 | |
| 497 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 497 | + if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) {
|
|
| 498 | 498 | $start_date = $event_recurring_dates[0]; |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 501 | + if (strtotime($end_date) < strtotime($start_date)) {
|
|
| 502 | 502 | $end_date = $start_date; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | if ($end_date != '' && strtotime($end_date) >= $today) {
|
| 506 | - if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 506 | + if ($starttime == '' && !empty($starttimes)) {
|
|
| 507 | 507 | $starttime = $starttimes[0]; |
| 508 | 508 | $endtime = $endtimes[0]; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | $same_day = false; |
| 512 | 512 | $one_day = false; |
| 513 | - if ( $start_date == $end_date && $all_day ) {
|
|
| 513 | + if ($start_date == $end_date && $all_day) {
|
|
| 514 | 514 | $one_day = true; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if ( $all_day ) {
|
|
| 518 | - $start_datetime = strtotime( $start_date ); |
|
| 519 | - $end_datetime = strtotime( $end_date ); |
|
| 517 | + if ($all_day) {
|
|
| 518 | + $start_datetime = strtotime($start_date); |
|
| 519 | + $end_datetime = strtotime($end_date); |
|
| 520 | 520 | |
| 521 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 522 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 523 | - if ( $start_date == $end_date ) {
|
|
| 521 | + $start_date = date_i18n($geodir_date_format, $start_datetime); |
|
| 522 | + $end_date = date_i18n($geodir_date_format, $end_datetime); |
|
| 523 | + if ($start_date == $end_date) {
|
|
| 524 | 524 | $one_day = true; |
| 525 | 525 | } |
| 526 | 526 | } else {
|
| 527 | - if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 528 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 527 | + if ($start_date == $end_date && $starttime == $endtime) {
|
|
| 528 | + $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day'));
|
|
| 529 | 529 | $one_day = false; |
| 530 | 530 | } |
| 531 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 532 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 531 | + $start_datetime = strtotime($start_date.' '.$starttime); |
|
| 532 | + $end_datetime = strtotime($end_date.' '.$endtime); |
|
| 533 | 533 | |
| 534 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 535 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 534 | + $start_date = date_i18n($geodir_date_time_format, $start_datetime); |
|
| 535 | + $end_date = date_i18n($geodir_date_time_format, $end_datetime); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 538 | + if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) {
|
|
| 539 | 539 | $same_day = true; |
| 540 | 540 | |
| 541 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 541 | + $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - $event_dates .= ' :: ' . $start_date; |
|
| 544 | + $event_dates .= ' :: '.$start_date; |
|
| 545 | 545 | |
| 546 | - if ( !$same_day && !$one_day ) {
|
|
| 547 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 546 | + if (!$same_day && !$one_day) {
|
|
| 547 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | } |
@@ -560,8 +560,8 @@ discard block |
||
| 560 | 560 | $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
| 561 | 561 | |
| 562 | 562 | // if single cat lets just show that icon |
| 563 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 564 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
| 563 | + if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) {
|
|
| 564 | + $default_cat = (int) $map_cat_ids_array[0]; |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | $icon_size = array('w' => 36, 'h' => 45);
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 584 | + $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
|
|
| 585 | 585 | $post_ids[] = $catinfo_obj->post_id; |
| 586 | 586 | } |
| 587 | 587 | } |
@@ -605,10 +605,10 @@ discard block |
||
| 605 | 605 | $totalcount = count(array_unique($post_ids)); |
| 606 | 606 | |
| 607 | 607 | if (!empty($cat_content_info)) {
|
| 608 | - $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 608 | + $map_json = '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
|
|
| 609 | 609 | } |
| 610 | 610 | else {
|
| 611 | - $map_json = '[{"totalcount":"0"}]';
|
|
| 611 | + $map_json = '[{"totalcount":"0"}]';
|
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | * @since 1.6.22 |
| 619 | 619 | * @param string $map_json The JSON string of the map markers results. |
| 620 | 620 | */ |
| 621 | - return apply_filters('geodir_markers_json',$map_json);
|
|
| 621 | + return apply_filters('geodir_markers_json', $map_json);
|
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | |
@@ -247,11 +247,13 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - if (!empty($field_default_cat)) |
|
| 251 | - $field_default_cat = ''; |
|
| 250 | + if (!empty($field_default_cat)) { |
|
| 251 | + $field_default_cat = ''; |
|
| 252 | + } |
|
| 252 | 253 | |
| 253 | - if (!empty($cat_find_array)) |
|
| 254 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 254 | + if (!empty($cat_find_array)) { |
|
| 255 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
| 256 | + } |
|
| 255 | 257 | |
| 256 | 258 | $main_query_array = $map_cat_ids_array; |
| 257 | 259 | |
@@ -283,8 +285,9 @@ discard block |
||
| 283 | 285 | $gd_posttype = " AND p.post_type = %s"; |
| 284 | 286 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 285 | 287 | |
| 286 | - } else |
|
| 287 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 288 | + } else { |
|
| 289 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
| 290 | + } |
|
| 288 | 291 | |
| 289 | 292 | $join = ", " . $table . " AS pd "; |
| 290 | 293 | |
@@ -606,8 +609,7 @@ discard block |
||
| 606 | 609 | |
| 607 | 610 | if (!empty($cat_content_info)) {
|
| 608 | 611 | $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
| 609 | - } |
|
| 610 | - else {
|
|
| 612 | + } else {
|
|
| 611 | 613 | $map_json = '[{"totalcount":"0"}]';
|
| 612 | 614 | } |
| 613 | 615 | |
@@ -20,492 +20,492 @@ discard block |
||
| 20 | 20 | function geodir_set_postcat_structure($post_id, $taxonomy, $default_cat = '', $category_str = '') |
| 21 | 21 | {
|
| 22 | 22 | |
| 23 | - $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy); |
|
| 24 | - if (!empty($post_cat_ids)) |
|
| 25 | - $post_cat_array = explode(",", trim($post_cat_ids, ","));
|
|
| 26 | - |
|
| 27 | - if (!isset($default_cat) || empty($default_cat)) {
|
|
| 28 | - $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : ''; |
|
| 29 | - }else{
|
|
| 30 | - if(!is_int($default_cat)){
|
|
| 31 | - $category = get_term_by('name', $default_cat, $taxonomy);
|
|
| 32 | - if(isset($category->term_id)){
|
|
| 33 | - $default_cat = $category->term_id; |
|
| 34 | - } |
|
| 35 | - } |
|
| 23 | + $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy); |
|
| 24 | + if (!empty($post_cat_ids)) |
|
| 25 | + $post_cat_array = explode(",", trim($post_cat_ids, ","));
|
|
| 26 | + |
|
| 27 | + if (!isset($default_cat) || empty($default_cat)) {
|
|
| 28 | + $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : ''; |
|
| 29 | + }else{
|
|
| 30 | + if(!is_int($default_cat)){
|
|
| 31 | + $category = get_term_by('name', $default_cat, $taxonomy);
|
|
| 32 | + if(isset($category->term_id)){
|
|
| 33 | + $default_cat = $category->term_id; |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - geodir_save_post_meta($post_id, 'default_category', $default_cat); |
|
| 40 | + geodir_save_post_meta($post_id, 'default_category', $default_cat); |
|
| 41 | 41 | |
| 42 | - if (isset($category_str) && empty($category_str)) {
|
|
| 42 | + if (isset($category_str) && empty($category_str)) {
|
|
| 43 | 43 | |
| 44 | - $post_cat_str = ''; |
|
| 45 | - $post_categories = array(); |
|
| 46 | - if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
|
|
| 47 | - $post_cat_str = implode(",y:#", $post_cat_array);
|
|
| 48 | - $post_cat_str .= ",y:"; |
|
| 49 | - $post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
|
|
| 50 | - } |
|
| 51 | - $post_categories[$taxonomy] = $post_cat_str; |
|
| 52 | - $category_str = $post_categories; |
|
| 53 | - } |
|
| 44 | + $post_cat_str = ''; |
|
| 45 | + $post_categories = array(); |
|
| 46 | + if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
|
|
| 47 | + $post_cat_str = implode(",y:#", $post_cat_array);
|
|
| 48 | + $post_cat_str .= ",y:"; |
|
| 49 | + $post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
|
|
| 50 | + } |
|
| 51 | + $post_categories[$taxonomy] = $post_cat_str; |
|
| 52 | + $category_str = $post_categories; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - $change_cat_str = $category_str[$taxonomy]; |
|
| 55 | + $change_cat_str = $category_str[$taxonomy]; |
|
| 56 | 56 | |
| 57 | - $default_pos = strpos($change_cat_str, 'd:'); |
|
| 57 | + $default_pos = strpos($change_cat_str, 'd:'); |
|
| 58 | 58 | |
| 59 | - if ($default_pos === false) {
|
|
| 59 | + if ($default_pos === false) {
|
|
| 60 | 60 | |
| 61 | - $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str); |
|
| 61 | + $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str); |
|
| 62 | 62 | |
| 63 | - } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - $category_str[$taxonomy] = $change_cat_str; |
|
| 65 | + $category_str[$taxonomy] = $change_cat_str; |
|
| 66 | 66 | |
| 67 | - update_post_meta($post_id, 'post_categories', $category_str); |
|
| 67 | + update_post_meta($post_id, 'post_categories', $category_str); |
|
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | if (!function_exists('geodir_save_listing')) {
|
| 73 | - /** |
|
| 74 | - * Saves listing in the database using given information. |
|
| 75 | - * |
|
| 76 | - * @since 1.0.0 |
|
| 77 | - * @since 1.5.4 New parameter $wp_error added. |
|
| 78 | - * @since 1.6.18 Admin use only date field should not lost value if saved by user - FIXED |
|
| 79 | - * @package GeoDirectory |
|
| 80 | - * @global object $wpdb WordPress Database object. |
|
| 81 | - * @global object $post The current post object. |
|
| 82 | - * @global object $current_user Current user object. |
|
| 83 | - * @global object $gd_session GeoDirectory Session object. |
|
| 84 | - * @param array $request_info {
|
|
| 85 | - * Array of request info arguments. |
|
| 86 | - * |
|
| 87 | - * @type string $action Ajax action name. |
|
| 88 | - * @type string $geodir_ajax Ajax type. |
|
| 89 | - * @type string $ajax_action Ajax action. |
|
| 90 | - * @type string $listing_type Listing type. |
|
| 91 | - * @type string $pid Default Post ID. |
|
| 92 | - * @type string $preview Todo Desc needed. |
|
| 93 | - * @type string $add_listing_page_id Add listing page ID. |
|
| 94 | - * @type string $post_title Listing title. |
|
| 95 | - * @type string $post_desc Listing Description. |
|
| 96 | - * @type string $post_tags Listing tags. |
|
| 97 | - * @type array $cat_limit Category limit. |
|
| 98 | - * @type array $post_category Category IDs. |
|
| 99 | - * @type array $post_category_str Category string. |
|
| 100 | - * @type string $post_default_category Default category ID. |
|
| 101 | - * @type string $post_address Listing address. |
|
| 102 | - * @type string $geodir_location_add_listing_country_val Add listing country value. |
|
| 103 | - * @type string $post_country Listing country. |
|
| 104 | - * @type string $geodir_location_add_listing_region_val Add listing region value. |
|
| 105 | - * @type string $post_region Listing region. |
|
| 106 | - * @type string $geodir_location_add_listing_city_val Add listing city value. |
|
| 107 | - * @type string $post_city Listing city. |
|
| 108 | - * @type string $post_zip Listing zip. |
|
| 109 | - * @type string $post_latitude Listing latitude. |
|
| 110 | - * @type string $post_longitude Listing longitude. |
|
| 111 | - * @type string $post_mapview Listing mapview. Default "ROADMAP". |
|
| 112 | - * @type string $post_mapzoom Listing mapzoom Default "9". |
|
| 113 | - * @type string $geodir_timing Business timing info. |
|
| 114 | - * @type string $geodir_contact Contact number. |
|
| 115 | - * @type string $geodir_email Business contact email. |
|
| 116 | - * @type string $geodir_website Business website. |
|
| 117 | - * @type string $geodir_twitter Twitter link. |
|
| 118 | - * @type string $geodir_facebook Facebook link. |
|
| 119 | - * @type string $geodir_video Video link. |
|
| 120 | - * @type string $geodir_special_offers Special offers. |
|
| 121 | - * @type string $post_images Post image urls. |
|
| 122 | - * @type string $post_imagesimage_limit Post images limit. |
|
| 123 | - * @type string $post_imagestotImg Todo Desc needed. |
|
| 124 | - * @type string $geodir_accept_term_condition Has accepted terms and conditions?. |
|
| 125 | - * @type string $geodir_spamblocker Todo Desc needed. |
|
| 126 | - * @type string $geodir_filled_by_spam_bot Todo Desc needed. |
|
| 127 | - * |
|
| 128 | - * } |
|
| 129 | - * @param bool $dummy Optional. Is this a dummy listing? Default false. |
|
| 130 | - * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false. |
|
| 131 | - * @return int|string|WP_Error Created post id or WP_Error on failure. |
|
| 132 | - */ |
|
| 133 | - function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false) |
|
| 134 | - {
|
|
| 135 | - global $wpdb, $current_user, $gd_session; |
|
| 136 | - |
|
| 137 | - $last_post_id = ''; |
|
| 138 | - |
|
| 139 | - if ($gd_session->get('listing') && !$dummy) {
|
|
| 140 | - $request_info = array(); |
|
| 141 | - $request_session = $gd_session->get('listing');
|
|
| 142 | - $request_info = array_merge($_REQUEST, $request_session); |
|
| 143 | - } else if (!$gd_session->get('listing') && !$dummy) {
|
|
| 144 | - global $post; |
|
| 73 | + /** |
|
| 74 | + * Saves listing in the database using given information. |
|
| 75 | + * |
|
| 76 | + * @since 1.0.0 |
|
| 77 | + * @since 1.5.4 New parameter $wp_error added. |
|
| 78 | + * @since 1.6.18 Admin use only date field should not lost value if saved by user - FIXED |
|
| 79 | + * @package GeoDirectory |
|
| 80 | + * @global object $wpdb WordPress Database object. |
|
| 81 | + * @global object $post The current post object. |
|
| 82 | + * @global object $current_user Current user object. |
|
| 83 | + * @global object $gd_session GeoDirectory Session object. |
|
| 84 | + * @param array $request_info {
|
|
| 85 | + * Array of request info arguments. |
|
| 86 | + * |
|
| 87 | + * @type string $action Ajax action name. |
|
| 88 | + * @type string $geodir_ajax Ajax type. |
|
| 89 | + * @type string $ajax_action Ajax action. |
|
| 90 | + * @type string $listing_type Listing type. |
|
| 91 | + * @type string $pid Default Post ID. |
|
| 92 | + * @type string $preview Todo Desc needed. |
|
| 93 | + * @type string $add_listing_page_id Add listing page ID. |
|
| 94 | + * @type string $post_title Listing title. |
|
| 95 | + * @type string $post_desc Listing Description. |
|
| 96 | + * @type string $post_tags Listing tags. |
|
| 97 | + * @type array $cat_limit Category limit. |
|
| 98 | + * @type array $post_category Category IDs. |
|
| 99 | + * @type array $post_category_str Category string. |
|
| 100 | + * @type string $post_default_category Default category ID. |
|
| 101 | + * @type string $post_address Listing address. |
|
| 102 | + * @type string $geodir_location_add_listing_country_val Add listing country value. |
|
| 103 | + * @type string $post_country Listing country. |
|
| 104 | + * @type string $geodir_location_add_listing_region_val Add listing region value. |
|
| 105 | + * @type string $post_region Listing region. |
|
| 106 | + * @type string $geodir_location_add_listing_city_val Add listing city value. |
|
| 107 | + * @type string $post_city Listing city. |
|
| 108 | + * @type string $post_zip Listing zip. |
|
| 109 | + * @type string $post_latitude Listing latitude. |
|
| 110 | + * @type string $post_longitude Listing longitude. |
|
| 111 | + * @type string $post_mapview Listing mapview. Default "ROADMAP". |
|
| 112 | + * @type string $post_mapzoom Listing mapzoom Default "9". |
|
| 113 | + * @type string $geodir_timing Business timing info. |
|
| 114 | + * @type string $geodir_contact Contact number. |
|
| 115 | + * @type string $geodir_email Business contact email. |
|
| 116 | + * @type string $geodir_website Business website. |
|
| 117 | + * @type string $geodir_twitter Twitter link. |
|
| 118 | + * @type string $geodir_facebook Facebook link. |
|
| 119 | + * @type string $geodir_video Video link. |
|
| 120 | + * @type string $geodir_special_offers Special offers. |
|
| 121 | + * @type string $post_images Post image urls. |
|
| 122 | + * @type string $post_imagesimage_limit Post images limit. |
|
| 123 | + * @type string $post_imagestotImg Todo Desc needed. |
|
| 124 | + * @type string $geodir_accept_term_condition Has accepted terms and conditions?. |
|
| 125 | + * @type string $geodir_spamblocker Todo Desc needed. |
|
| 126 | + * @type string $geodir_filled_by_spam_bot Todo Desc needed. |
|
| 127 | + * |
|
| 128 | + * } |
|
| 129 | + * @param bool $dummy Optional. Is this a dummy listing? Default false. |
|
| 130 | + * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false. |
|
| 131 | + * @return int|string|WP_Error Created post id or WP_Error on failure. |
|
| 132 | + */ |
|
| 133 | + function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false) |
|
| 134 | + {
|
|
| 135 | + global $wpdb, $current_user, $gd_session; |
|
| 136 | + |
|
| 137 | + $last_post_id = ''; |
|
| 138 | + |
|
| 139 | + if ($gd_session->get('listing') && !$dummy) {
|
|
| 140 | + $request_info = array(); |
|
| 141 | + $request_session = $gd_session->get('listing');
|
|
| 142 | + $request_info = array_merge($_REQUEST, $request_session); |
|
| 143 | + } else if (!$gd_session->get('listing') && !$dummy) {
|
|
| 144 | + global $post; |
|
| 145 | 145 | |
| 146 | - $gd_post = $post; |
|
| 147 | - if (!empty($gd_post) && is_array($gd_post)) {
|
|
| 148 | - $gd_post = (object)$post; |
|
| 146 | + $gd_post = $post; |
|
| 147 | + if (!empty($gd_post) && is_array($gd_post)) {
|
|
| 148 | + $gd_post = (object)$post; |
|
| 149 | 149 | |
| 150 | - // Fix WPML duplicate. |
|
| 151 | - if (geodir_is_wpml() && !empty($request_info['action']) && $request_info['action'] == 'editpost' && !empty($request_info['icl_trid']) && !isset($post['post_date'])) {
|
|
| 152 | - return false; |
|
| 153 | - } |
|
| 154 | - } |
|
| 150 | + // Fix WPML duplicate. |
|
| 151 | + if (geodir_is_wpml() && !empty($request_info['action']) && $request_info['action'] == 'editpost' && !empty($request_info['icl_trid']) && !isset($post['post_date'])) {
|
|
| 152 | + return false; |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - $request_info['pid'] = !empty($gd_post->ID) ? $gd_post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL); |
|
| 157 | - $request_info['post_title'] = $request_info['post_title']; |
|
| 158 | - $request_info['listing_type'] = !empty($gd_post->post_type) ? $gd_post->post_type : (!empty($request_info['post_type']) ? $request_info['post_type'] : get_post_type($request_info['pid'])); |
|
| 159 | - $request_info['post_desc'] = $request_info['content']; |
|
| 160 | - } else if (!$dummy) {
|
|
| 161 | - return false; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Filter the request_info array. |
|
| 166 | - * |
|
| 167 | - * You can use this filter to modify request_info array. |
|
| 168 | - * |
|
| 169 | - * @since 1.0.0 |
|
| 170 | - * @package GeoDirectory |
|
| 171 | - * @param array $request_info See {@see geodir_save_listing()} for accepted args.
|
|
| 172 | - */ |
|
| 173 | - $request_info = apply_filters('geodir_action_get_request_info', $request_info);
|
|
| 174 | - |
|
| 175 | - // Check if we need to save post location as new location |
|
| 176 | - $location_result = geodir_get_default_location(); |
|
| 177 | - |
|
| 178 | - if ($location_result->location_id > 0) {
|
|
| 179 | - if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
|
|
| 180 | - $request_info['post_location'] = array( |
|
| 181 | - 'city' => $request_info['post_city'], |
|
| 182 | - 'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '', |
|
| 183 | - 'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '', |
|
| 184 | - 'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '', |
|
| 185 | - 'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : '' |
|
| 186 | - ); |
|
| 187 | - |
|
| 188 | - $post_location_info = $request_info['post_location']; |
|
| 189 | - |
|
| 190 | - if ($location_id = geodir_add_new_location($post_location_info)) {
|
|
| 191 | - $post_location_id = $location_id; |
|
| 192 | - } |
|
| 193 | - } else {
|
|
| 194 | - $post_location_id = $location_result->location_id; |
|
| 195 | - } |
|
| 196 | - } else {
|
|
| 197 | - $post_location_id = $location_result->location_id; |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - if ($dummy) {
|
|
| 201 | - $post_status = 'publish'; |
|
| 202 | - } else {
|
|
| 203 | - $post_status = geodir_new_post_default_status(); |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - if (isset($request_info['pid']) && $request_info['pid'] != '') {
|
|
| 207 | - $post_status = get_post_status($request_info['pid']); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - /* fix change of slug on every title edit */ |
|
| 211 | - if (!isset($request_info['post_name'])) {
|
|
| 212 | - $request_info['post_name'] = $request_info['post_title']; |
|
| 213 | - |
|
| 214 | - if (!empty($request_info['pid'])) {
|
|
| 215 | - $post_info = get_post($request_info['pid']); |
|
| 216 | - |
|
| 217 | - if (!empty($post_info) && isset($post_info->post_name)) {
|
|
| 218 | - $request_info['post_name'] = $post_info->post_name; |
|
| 219 | - } |
|
| 220 | - } |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - $post = array( |
|
| 224 | - 'post_content' => $request_info['post_desc'], |
|
| 225 | - 'post_status' => $post_status, |
|
| 226 | - 'post_title' => $request_info['post_title'], |
|
| 227 | - 'post_name' => $request_info['post_name'], |
|
| 228 | - 'post_type' => $request_info['listing_type'] |
|
| 229 | - ); |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * Called before a listing is saved to the database. |
|
| 233 | - * |
|
| 234 | - * @since 1.0.0 |
|
| 235 | - * @param object $post The post object. |
|
| 236 | - */ |
|
| 237 | - do_action_ref_array('geodir_before_save_listing', $post);
|
|
| 156 | + $request_info['pid'] = !empty($gd_post->ID) ? $gd_post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL); |
|
| 157 | + $request_info['post_title'] = $request_info['post_title']; |
|
| 158 | + $request_info['listing_type'] = !empty($gd_post->post_type) ? $gd_post->post_type : (!empty($request_info['post_type']) ? $request_info['post_type'] : get_post_type($request_info['pid'])); |
|
| 159 | + $request_info['post_desc'] = $request_info['content']; |
|
| 160 | + } else if (!$dummy) {
|
|
| 161 | + return false; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * Filter the request_info array. |
|
| 166 | + * |
|
| 167 | + * You can use this filter to modify request_info array. |
|
| 168 | + * |
|
| 169 | + * @since 1.0.0 |
|
| 170 | + * @package GeoDirectory |
|
| 171 | + * @param array $request_info See {@see geodir_save_listing()} for accepted args.
|
|
| 172 | + */ |
|
| 173 | + $request_info = apply_filters('geodir_action_get_request_info', $request_info);
|
|
| 174 | + |
|
| 175 | + // Check if we need to save post location as new location |
|
| 176 | + $location_result = geodir_get_default_location(); |
|
| 177 | + |
|
| 178 | + if ($location_result->location_id > 0) {
|
|
| 179 | + if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
|
|
| 180 | + $request_info['post_location'] = array( |
|
| 181 | + 'city' => $request_info['post_city'], |
|
| 182 | + 'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '', |
|
| 183 | + 'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '', |
|
| 184 | + 'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '', |
|
| 185 | + 'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : '' |
|
| 186 | + ); |
|
| 187 | + |
|
| 188 | + $post_location_info = $request_info['post_location']; |
|
| 189 | + |
|
| 190 | + if ($location_id = geodir_add_new_location($post_location_info)) {
|
|
| 191 | + $post_location_id = $location_id; |
|
| 192 | + } |
|
| 193 | + } else {
|
|
| 194 | + $post_location_id = $location_result->location_id; |
|
| 195 | + } |
|
| 196 | + } else {
|
|
| 197 | + $post_location_id = $location_result->location_id; |
|
| 198 | + } |
|
| 238 | 199 | |
| 239 | - $send_post_submit_mail = false; |
|
| 200 | + if ($dummy) {
|
|
| 201 | + $post_status = 'publish'; |
|
| 202 | + } else {
|
|
| 203 | + $post_status = geodir_new_post_default_status(); |
|
| 204 | + } |
|
| 240 | 205 | |
| 241 | - // unhook this function so it doesn't loop infinitely |
|
| 242 | - remove_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 206 | + if (isset($request_info['pid']) && $request_info['pid'] != '') {
|
|
| 207 | + $post_status = get_post_status($request_info['pid']); |
|
| 208 | + } |
|
| 243 | 209 | |
| 244 | - if (isset($request_info['pid']) && $request_info['pid'] != '') {
|
|
| 245 | - $post['ID'] = $request_info['pid']; |
|
| 210 | + /* fix change of slug on every title edit */ |
|
| 211 | + if (!isset($request_info['post_name'])) {
|
|
| 212 | + $request_info['post_name'] = $request_info['post_title']; |
|
| 246 | 213 | |
| 247 | - $last_post_id = wp_update_post($post, $wp_error); |
|
| 248 | - } else {
|
|
| 249 | - $last_post_id = wp_insert_post($post, $wp_error); |
|
| 214 | + if (!empty($request_info['pid'])) {
|
|
| 215 | + $post_info = get_post($request_info['pid']); |
|
| 250 | 216 | |
| 251 | - if (!$dummy && $last_post_id) {
|
|
| 252 | - $send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email) |
|
| 253 | - //geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
|
|
| 254 | - } |
|
| 255 | - } |
|
| 217 | + if (!empty($post_info) && isset($post_info->post_name)) {
|
|
| 218 | + $request_info['post_name'] = $post_info->post_name; |
|
| 219 | + } |
|
| 220 | + } |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + $post = array( |
|
| 224 | + 'post_content' => $request_info['post_desc'], |
|
| 225 | + 'post_status' => $post_status, |
|
| 226 | + 'post_title' => $request_info['post_title'], |
|
| 227 | + 'post_name' => $request_info['post_name'], |
|
| 228 | + 'post_type' => $request_info['listing_type'] |
|
| 229 | + ); |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * Called before a listing is saved to the database. |
|
| 233 | + * |
|
| 234 | + * @since 1.0.0 |
|
| 235 | + * @param object $post The post object. |
|
| 236 | + */ |
|
| 237 | + do_action_ref_array('geodir_before_save_listing', $post);
|
|
| 238 | + |
|
| 239 | + $send_post_submit_mail = false; |
|
| 240 | + |
|
| 241 | + // unhook this function so it doesn't loop infinitely |
|
| 242 | + remove_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 243 | + |
|
| 244 | + if (isset($request_info['pid']) && $request_info['pid'] != '') {
|
|
| 245 | + $post['ID'] = $request_info['pid']; |
|
| 246 | + |
|
| 247 | + $last_post_id = wp_update_post($post, $wp_error); |
|
| 248 | + } else {
|
|
| 249 | + $last_post_id = wp_insert_post($post, $wp_error); |
|
| 250 | + |
|
| 251 | + if (!$dummy && $last_post_id) {
|
|
| 252 | + $send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email) |
|
| 253 | + //geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
|
|
| 254 | + } |
|
| 255 | + } |
|
| 256 | 256 | |
| 257 | - if ($wp_error && is_wp_error($last_post_id)) {
|
|
| 258 | - return $last_post_id; // Return WP_Error on save failure. |
|
| 259 | - } |
|
| 257 | + if ($wp_error && is_wp_error($last_post_id)) {
|
|
| 258 | + return $last_post_id; // Return WP_Error on save failure. |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - if (!$last_post_id) {
|
|
| 262 | - return false; // Save failure. |
|
| 263 | - } |
|
| 261 | + if (!$last_post_id) {
|
|
| 262 | + return false; // Save failure. |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - // re-hook this function |
|
| 266 | - add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 265 | + // re-hook this function |
|
| 266 | + add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 267 | 267 | |
| 268 | - $post_tags = ''; |
|
| 269 | - if (!isset($request_info['post_tags'])) {
|
|
| 268 | + $post_tags = ''; |
|
| 269 | + if (!isset($request_info['post_tags'])) {
|
|
| 270 | 270 | |
| 271 | - $post_type = $request_info['listing_type']; |
|
| 272 | - $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
|
|
| 271 | + $post_type = $request_info['listing_type']; |
|
| 272 | + $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
|
|
| 273 | 273 | |
| 274 | - } |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - $gd_post_info = array( |
|
| 277 | - "post_title" => $request_info['post_title'], |
|
| 278 | - "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags, |
|
| 279 | - "post_status" => $post_status, |
|
| 280 | - "post_location_id" => $post_location_id, |
|
| 281 | - "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '', |
|
| 282 | - "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '', |
|
| 283 | - "submit_time" => time(), |
|
| 284 | - "submit_ip" => $_SERVER['REMOTE_ADDR'], |
|
| 285 | - ); |
|
| 276 | + $gd_post_info = array( |
|
| 277 | + "post_title" => $request_info['post_title'], |
|
| 278 | + "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags, |
|
| 279 | + "post_status" => $post_status, |
|
| 280 | + "post_location_id" => $post_location_id, |
|
| 281 | + "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '', |
|
| 282 | + "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '', |
|
| 283 | + "submit_time" => time(), |
|
| 284 | + "submit_ip" => $_SERVER['REMOTE_ADDR'], |
|
| 285 | + ); |
|
| 286 | 286 | |
| 287 | - $payment_info = array(); |
|
| 288 | - $package_info = array(); |
|
| 287 | + $payment_info = array(); |
|
| 288 | + $package_info = array(); |
|
| 289 | 289 | |
| 290 | - $package_info = (array)geodir_post_package_info($package_info, $post); |
|
| 290 | + $package_info = (array)geodir_post_package_info($package_info, $post); |
|
| 291 | 291 | |
| 292 | - $post_package_id = geodir_get_post_meta($last_post_id, 'package_id'); |
|
| 292 | + $post_package_id = geodir_get_post_meta($last_post_id, 'package_id'); |
|
| 293 | 293 | |
| 294 | - if (!empty($package_info) && !$post_package_id) {
|
|
| 295 | - if (isset($package_info['days']) && $package_info['days'] != 0) {
|
|
| 296 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
|
|
| 297 | - } else {
|
|
| 298 | - $payment_info['expire_date'] = 'Never'; |
|
| 299 | - } |
|
| 294 | + if (!empty($package_info) && !$post_package_id) {
|
|
| 295 | + if (isset($package_info['days']) && $package_info['days'] != 0) {
|
|
| 296 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
|
|
| 297 | + } else {
|
|
| 298 | + $payment_info['expire_date'] = 'Never'; |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | - $payment_info['package_id'] = $package_info['pid']; |
|
| 302 | - $payment_info['alive_days'] = $package_info['days']; |
|
| 303 | - $payment_info['is_featured'] = $package_info['is_featured']; |
|
| 301 | + $payment_info['package_id'] = $package_info['pid']; |
|
| 302 | + $payment_info['alive_days'] = $package_info['days']; |
|
| 303 | + $payment_info['is_featured'] = $package_info['is_featured']; |
|
| 304 | 304 | |
| 305 | - $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
| 306 | - } |
|
| 305 | + $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | - $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
|
|
| 308 | + $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
|
|
| 309 | 309 | |
| 310 | - foreach ($custom_metaboxes as $key => $val): |
|
| 310 | + foreach ($custom_metaboxes as $key => $val): |
|
| 311 | 311 | |
| 312 | - $name = $val['name']; |
|
| 313 | - $type = $val['type']; |
|
| 314 | - $extrafields = $val['extra_fields']; |
|
| 312 | + $name = $val['name']; |
|
| 313 | + $type = $val['type']; |
|
| 314 | + $extrafields = $val['extra_fields']; |
|
| 315 | 315 | |
| 316 | - if (trim($type) == 'address') {
|
|
| 317 | - $prefix = $name . '_'; |
|
| 318 | - $address = $prefix . 'address'; |
|
| 316 | + if (trim($type) == 'address') {
|
|
| 317 | + $prefix = $name . '_'; |
|
| 318 | + $address = $prefix . 'address'; |
|
| 319 | 319 | |
| 320 | - if (isset($request_info[$address]) && $request_info[$address] != '') {
|
|
| 321 | - $gd_post_info[$address] = wp_slash($request_info[$address]); |
|
| 322 | - } |
|
| 320 | + if (isset($request_info[$address]) && $request_info[$address] != '') {
|
|
| 321 | + $gd_post_info[$address] = wp_slash($request_info[$address]); |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | - if ($extrafields != '') {
|
|
| 325 | - $extrafields = unserialize($extrafields); |
|
| 324 | + if ($extrafields != '') {
|
|
| 325 | + $extrafields = unserialize($extrafields); |
|
| 326 | 326 | |
| 327 | 327 | |
| 328 | - if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
|
|
| 328 | + if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
|
|
| 329 | 329 | |
| 330 | - $location_result = geodir_get_default_location(); |
|
| 330 | + $location_result = geodir_get_default_location(); |
|
| 331 | 331 | |
| 332 | - $gd_post_info[$prefix . 'city'] = $location_result->city; |
|
| 333 | - $gd_post_info[$prefix . 'region'] = $location_result->region; |
|
| 334 | - $gd_post_info[$prefix . 'country'] = $location_result->country; |
|
| 332 | + $gd_post_info[$prefix . 'city'] = $location_result->city; |
|
| 333 | + $gd_post_info[$prefix . 'region'] = $location_result->region; |
|
| 334 | + $gd_post_info[$prefix . 'country'] = $location_result->country; |
|
| 335 | 335 | |
| 336 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 336 | + $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 337 | 337 | |
| 338 | - } else {
|
|
| 338 | + } else {
|
|
| 339 | 339 | |
| 340 | - $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city']; |
|
| 341 | - $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region']; |
|
| 342 | - $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country']; |
|
| 340 | + $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city']; |
|
| 341 | + $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region']; |
|
| 342 | + $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country']; |
|
| 343 | 343 | |
| 344 | - //----------set post locations when import dummy data------- |
|
| 345 | - $location_result = geodir_get_default_location(); |
|
| 344 | + //----------set post locations when import dummy data------- |
|
| 345 | + $location_result = geodir_get_default_location(); |
|
| 346 | 346 | |
| 347 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 348 | - //----------------------------------------------------------------- |
|
| 347 | + $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 348 | + //----------------------------------------------------------------- |
|
| 349 | 349 | |
| 350 | - } |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | 352 | |
| 353 | - if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
|
|
| 354 | - $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip']; |
|
| 355 | - } |
|
| 353 | + if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
|
|
| 354 | + $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip']; |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | 357 | |
| 358 | - if (isset($extrafields['show_map']) && $extrafields['show_map']) {
|
|
| 358 | + if (isset($extrafields['show_map']) && $extrafields['show_map']) {
|
|
| 359 | 359 | |
| 360 | - if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
|
|
| 361 | - $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude']; |
|
| 362 | - } |
|
| 360 | + if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
|
|
| 361 | + $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude']; |
|
| 362 | + } |
|
| 363 | 363 | |
| 364 | - if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
|
|
| 365 | - $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude']; |
|
| 366 | - } |
|
| 364 | + if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
|
|
| 365 | + $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude']; |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | - if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
|
|
| 369 | - $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview']; |
|
| 370 | - } |
|
| 368 | + if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
|
|
| 369 | + $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview']; |
|
| 370 | + } |
|
| 371 | 371 | |
| 372 | - if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
|
|
| 373 | - $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom']; |
|
| 374 | - } |
|
| 372 | + if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
|
|
| 373 | + $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom']; |
|
| 374 | + } |
|
| 375 | 375 | |
| 376 | - } |
|
| 376 | + } |
|
| 377 | 377 | |
| 378 | - // show lat lng |
|
| 379 | - if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
|
|
| 380 | - $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng']; |
|
| 381 | - } |
|
| 382 | - } |
|
| 378 | + // show lat lng |
|
| 379 | + if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
|
|
| 380 | + $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng']; |
|
| 381 | + } |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | - } elseif (trim($type) == 'file') {
|
|
| 385 | - if (isset($request_info[$name])) {
|
|
| 386 | - $request_files = array(); |
|
| 387 | - if ($request_info[$name] != '') |
|
| 388 | - $request_files = explode(",", $request_info[$name]);
|
|
| 384 | + } elseif (trim($type) == 'file') {
|
|
| 385 | + if (isset($request_info[$name])) {
|
|
| 386 | + $request_files = array(); |
|
| 387 | + if ($request_info[$name] != '') |
|
| 388 | + $request_files = explode(",", $request_info[$name]);
|
|
| 389 | 389 | |
| 390 | - $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL; |
|
| 391 | - geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields); |
|
| 392 | - } |
|
| 393 | - } elseif (trim($type) == 'datepicker') {
|
|
| 394 | - if (isset($request_info[$name])) {
|
|
| 395 | - $datetime = ''; |
|
| 390 | + $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL; |
|
| 391 | + geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields); |
|
| 392 | + } |
|
| 393 | + } elseif (trim($type) == 'datepicker') {
|
|
| 394 | + if (isset($request_info[$name])) {
|
|
| 395 | + $datetime = ''; |
|
| 396 | 396 | |
| 397 | - if (!empty($request_info[$name])) {
|
|
| 398 | - $date_format = geodir_default_date_format(); |
|
| 399 | - if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
|
|
| 400 | - $extra_fields = unserialize($val['extra_fields']); |
|
| 401 | - $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format; |
|
| 402 | - } |
|
| 403 | - |
|
| 404 | - // check if we need to change the format or not |
|
| 405 | - $date_format_len = strlen(str_replace(' ', '', $date_format));
|
|
| 406 | - if($date_format_len>5){// if greater then 5 then it's the old style format.
|
|
| 397 | + if (!empty($request_info[$name])) {
|
|
| 398 | + $date_format = geodir_default_date_format(); |
|
| 399 | + if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
|
|
| 400 | + $extra_fields = unserialize($val['extra_fields']); |
|
| 401 | + $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format; |
|
| 402 | + } |
|
| 407 | 403 | |
| 408 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
|
|
| 409 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
|
| 404 | + // check if we need to change the format or not |
|
| 405 | + $date_format_len = strlen(str_replace(' ', '', $date_format));
|
|
| 406 | + if($date_format_len>5){// if greater then 5 then it's the old style format.
|
|
| 410 | 407 | |
| 411 | - $date_format = str_replace($search, $replace, $date_format); |
|
| 408 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
|
|
| 409 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
|
| 412 | 410 | |
| 413 | - $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
|
|
| 411 | + $date_format = str_replace($search, $replace, $date_format); |
|
| 414 | 412 | |
| 415 | - }else{
|
|
| 416 | - $post_htmlvar_value = $request_info[$name]; |
|
| 417 | - } |
|
| 413 | + $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
|
|
| 418 | 414 | |
| 419 | - $post_htmlvar_value = geodir_date($post_htmlvar_value, 'Y-m-d', $date_format); // save as sql format Y-m-d |
|
| 420 | - $datetime = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated |
|
| 421 | - } |
|
| 415 | + }else{
|
|
| 416 | + $post_htmlvar_value = $request_info[$name]; |
|
| 417 | + } |
|
| 422 | 418 | |
| 423 | - $gd_post_info[$name] = $datetime; |
|
| 424 | - } |
|
| 425 | - } else if ($type == 'multiselect') {
|
|
| 426 | - if (isset($request_info[$name])) {
|
|
| 427 | - $gd_post_info[$name] = $request_info[$name]; |
|
| 428 | - } else {
|
|
| 429 | - if (isset($request_info['gd_field_' . $name])) {
|
|
| 430 | - $gd_post_info[$name] = ''; /* fix de-select for multiselect */ |
|
| 431 | - } |
|
| 432 | - } |
|
| 433 | - } else if (isset($request_info[$name])) {
|
|
| 434 | - $gd_post_info[$name] = $request_info[$name]; |
|
| 435 | - } |
|
| 419 | + $post_htmlvar_value = geodir_date($post_htmlvar_value, 'Y-m-d', $date_format); // save as sql format Y-m-d |
|
| 420 | + $datetime = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated |
|
| 421 | + } |
|
| 436 | 422 | |
| 437 | - endforeach; |
|
| 423 | + $gd_post_info[$name] = $datetime; |
|
| 424 | + } |
|
| 425 | + } else if ($type == 'multiselect') {
|
|
| 426 | + if (isset($request_info[$name])) {
|
|
| 427 | + $gd_post_info[$name] = $request_info[$name]; |
|
| 428 | + } else {
|
|
| 429 | + if (isset($request_info['gd_field_' . $name])) {
|
|
| 430 | + $gd_post_info[$name] = ''; /* fix de-select for multiselect */ |
|
| 431 | + } |
|
| 432 | + } |
|
| 433 | + } else if (isset($request_info[$name])) {
|
|
| 434 | + $gd_post_info[$name] = $request_info[$name]; |
|
| 435 | + } |
|
| 438 | 436 | |
| 439 | - if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
|
|
| 440 | - $gd_post_info['post_dummy'] = $request_info['post_dummy']; |
|
| 441 | - } |
|
| 437 | + endforeach; |
|
| 442 | 438 | |
| 443 | - // Save post detail info in detail table |
|
| 444 | - if (!empty($gd_post_info)) {
|
|
| 445 | - geodir_save_post_info($last_post_id, $gd_post_info); |
|
| 446 | - } |
|
| 439 | + if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
|
|
| 440 | + $gd_post_info['post_dummy'] = $request_info['post_dummy']; |
|
| 441 | + } |
|
| 447 | 442 | |
| 443 | + // Save post detail info in detail table |
|
| 444 | + if (!empty($gd_post_info)) {
|
|
| 445 | + geodir_save_post_info($last_post_id, $gd_post_info); |
|
| 446 | + } |
|
| 448 | 447 | |
| 449 | - // Set categories to the listing |
|
| 450 | - if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
|
|
| 451 | - $post_category = array(); |
|
| 452 | 448 | |
| 453 | - foreach ($request_info['post_category'] as $taxonomy => $cat) {
|
|
| 449 | + // Set categories to the listing |
|
| 450 | + if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
|
|
| 451 | + $post_category = array(); |
|
| 454 | 452 | |
| 455 | - if ($dummy) |
|
| 456 | - $post_category = $cat; |
|
| 457 | - else {
|
|
| 453 | + foreach ($request_info['post_category'] as $taxonomy => $cat) {
|
|
| 458 | 454 | |
| 459 | - if (!is_array($cat) && strstr($cat, ',')) |
|
| 460 | - $cat = explode(',', $cat);
|
|
| 455 | + if ($dummy) |
|
| 456 | + $post_category = $cat; |
|
| 457 | + else {
|
|
| 461 | 458 | |
| 462 | - if (!empty($cat) && is_array($cat)) |
|
| 463 | - $post_category = array_map('intval', $cat);
|
|
| 464 | - } |
|
| 459 | + if (!is_array($cat) && strstr($cat, ',')) |
|
| 460 | + $cat = explode(',', $cat);
|
|
| 465 | 461 | |
| 466 | - wp_set_object_terms($last_post_id, $post_category, $taxonomy); |
|
| 467 | - } |
|
| 462 | + if (!empty($cat) && is_array($cat)) |
|
| 463 | + $post_category = array_map('intval', $cat);
|
|
| 464 | + } |
|
| 468 | 465 | |
| 469 | - $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : ''; |
|
| 466 | + wp_set_object_terms($last_post_id, $post_category, $taxonomy); |
|
| 467 | + } |
|
| 468 | + |
|
| 469 | + $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : ''; |
|
| 470 | 470 | |
| 471 | - $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : ''; |
|
| 472 | - geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str); |
|
| 471 | + $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : ''; |
|
| 472 | + geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str); |
|
| 473 | 473 | |
| 474 | - } |
|
| 474 | + } |
|
| 475 | 475 | |
| 476 | - $post_tags = ''; |
|
| 477 | - // Set tags to the listing |
|
| 478 | - if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
|
|
| 479 | - $post_tags = explode(",", $request_info['post_tags']);
|
|
| 480 | - } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
|
|
| 481 | - if ($dummy) |
|
| 482 | - $post_tags = $request_info['post_tags']; |
|
| 483 | - } else {
|
|
| 484 | - if ($dummy) |
|
| 485 | - $post_tags = array($request_info['post_title']); |
|
| 486 | - } |
|
| 476 | + $post_tags = ''; |
|
| 477 | + // Set tags to the listing |
|
| 478 | + if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
|
|
| 479 | + $post_tags = explode(",", $request_info['post_tags']);
|
|
| 480 | + } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
|
|
| 481 | + if ($dummy) |
|
| 482 | + $post_tags = $request_info['post_tags']; |
|
| 483 | + } else {
|
|
| 484 | + if ($dummy) |
|
| 485 | + $post_tags = array($request_info['post_title']); |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | - if (is_array($post_tags)) {
|
|
| 489 | - $taxonomy = $request_info['listing_type'] . '_tags'; |
|
| 490 | - wp_set_object_terms($last_post_id, $post_tags, $taxonomy); |
|
| 491 | - } |
|
| 488 | + if (is_array($post_tags)) {
|
|
| 489 | + $taxonomy = $request_info['listing_type'] . '_tags'; |
|
| 490 | + wp_set_object_terms($last_post_id, $post_tags, $taxonomy); |
|
| 491 | + } |
|
| 492 | 492 | |
| 493 | 493 | |
| 494 | - // Insert attachment |
|
| 494 | + // Insert attachment |
|
| 495 | 495 | |
| 496 | - if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
|
|
| 497 | - if (!$dummy) {
|
|
| 498 | - $tmpimgArr = trim($request_info['post_images'], ","); |
|
| 499 | - $tmpimgArr = explode(",", $tmpimgArr);
|
|
| 500 | - geodir_save_post_images($last_post_id, $tmpimgArr, $dummy); |
|
| 501 | - } else{
|
|
| 502 | - geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy); |
|
| 503 | - } |
|
| 496 | + if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
|
|
| 497 | + if (!$dummy) {
|
|
| 498 | + $tmpimgArr = trim($request_info['post_images'], ","); |
|
| 499 | + $tmpimgArr = explode(",", $tmpimgArr);
|
|
| 500 | + geodir_save_post_images($last_post_id, $tmpimgArr, $dummy); |
|
| 501 | + } else{
|
|
| 502 | + geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy); |
|
| 503 | + } |
|
| 504 | 504 | |
| 505 | 505 | |
| 506 | - } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
|
|
| 506 | + } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
|
|
| 507 | 507 | |
| 508 | - /* Delete Attachments |
|
| 508 | + /* Delete Attachments |
|
| 509 | 509 | $postcurr_images = geodir_get_images($last_post_id); |
| 510 | 510 | |
| 511 | 511 | $wpdb->query( |
@@ -521,34 +521,34 @@ discard block |
||
| 521 | 521 | geodir_save_post_info($last_post_id, $gd_post_featured_img); |
| 522 | 522 | */ |
| 523 | 523 | |
| 524 | - } |
|
| 524 | + } |
|
| 525 | 525 | |
| 526 | - geodir_remove_temp_images(); |
|
| 527 | - geodir_set_wp_featured_image($last_post_id); |
|
| 526 | + geodir_remove_temp_images(); |
|
| 527 | + geodir_set_wp_featured_image($last_post_id); |
|
| 528 | 528 | |
| 529 | - /** |
|
| 530 | - * Called after a listing is saved to the database and before any email have been sent. |
|
| 531 | - * |
|
| 532 | - * @since 1.0.0 |
|
| 533 | - * @param int $last_post_id The saved post ID. |
|
| 534 | - * @param array $request_info The post details in an array. |
|
| 535 | - * @see 'geodir_after_save_listinginfo' |
|
| 536 | - */ |
|
| 537 | - do_action('geodir_after_save_listing', $last_post_id, $request_info);
|
|
| 529 | + /** |
|
| 530 | + * Called after a listing is saved to the database and before any email have been sent. |
|
| 531 | + * |
|
| 532 | + * @since 1.0.0 |
|
| 533 | + * @param int $last_post_id The saved post ID. |
|
| 534 | + * @param array $request_info The post details in an array. |
|
| 535 | + * @see 'geodir_after_save_listinginfo' |
|
| 536 | + */ |
|
| 537 | + do_action('geodir_after_save_listing', $last_post_id, $request_info);
|
|
| 538 | 538 | |
| 539 | - //die; |
|
| 539 | + //die; |
|
| 540 | 540 | |
| 541 | - if ($send_post_submit_mail) { // if new post send out email
|
|
| 542 | - $to_name = geodir_get_client_name($current_user->ID); |
|
| 543 | - geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
|
|
| 544 | - } |
|
| 545 | - /* |
|
| 541 | + if ($send_post_submit_mail) { // if new post send out email
|
|
| 542 | + $to_name = geodir_get_client_name($current_user->ID); |
|
| 543 | + geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
|
|
| 544 | + } |
|
| 545 | + /* |
|
| 546 | 546 | * Unset the session so we don't loop. |
| 547 | 547 | */ |
| 548 | - $gd_session->un_set('listing');
|
|
| 549 | - return $last_post_id; |
|
| 548 | + $gd_session->un_set('listing');
|
|
| 549 | + return $last_post_id; |
|
| 550 | 550 | |
| 551 | - } |
|
| 551 | + } |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | |
@@ -567,611 +567,611 @@ discard block |
||
| 567 | 567 | function geodir_get_post_info($post_id = '') |
| 568 | 568 | {
|
| 569 | 569 | |
| 570 | - global $wpdb, $plugin_prefix, $post, $post_info; |
|
| 570 | + global $wpdb, $plugin_prefix, $post, $post_info; |
|
| 571 | 571 | |
| 572 | - if ($post_id == '' && !empty($post)) |
|
| 573 | - $post_id = $post->ID; |
|
| 572 | + if ($post_id == '' && !empty($post)) |
|
| 573 | + $post_id = $post->ID; |
|
| 574 | 574 | |
| 575 | - $post_type = get_post_type($post_id); |
|
| 575 | + $post_type = get_post_type($post_id); |
|
| 576 | 576 | |
| 577 | - $all_postypes = geodir_get_posttypes(); |
|
| 577 | + $all_postypes = geodir_get_posttypes(); |
|
| 578 | 578 | |
| 579 | - if (!in_array($post_type, $all_postypes)) |
|
| 580 | - return false; |
|
| 579 | + if (!in_array($post_type, $all_postypes)) |
|
| 580 | + return false; |
|
| 581 | 581 | |
| 582 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 582 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 583 | 583 | |
| 584 | - /** |
|
| 585 | - * Apply Filter to change Post info |
|
| 586 | - * |
|
| 587 | - * You can use this filter to change Post info. |
|
| 588 | - * |
|
| 589 | - * @since 1.0.0 |
|
| 590 | - * @package GeoDirectory |
|
| 591 | - */ |
|
| 592 | - $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
|
|
| 584 | + /** |
|
| 585 | + * Apply Filter to change Post info |
|
| 586 | + * |
|
| 587 | + * You can use this filter to change Post info. |
|
| 588 | + * |
|
| 589 | + * @since 1.0.0 |
|
| 590 | + * @package GeoDirectory |
|
| 591 | + */ |
|
| 592 | + $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
|
|
| 593 | 593 | WHERE p.ID = pd.post_id |
| 594 | 594 | AND pd.post_id = %d", $post_id)); |
| 595 | 595 | |
| 596 | - $post_detail = $wpdb->get_row($query); |
|
| 596 | + $post_detail = $wpdb->get_row($query); |
|
| 597 | 597 | |
| 598 | - return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false; |
|
| 598 | + return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false; |
|
| 599 | 599 | |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | |
| 603 | 603 | if (!function_exists('geodir_save_post_info')) {
|
| 604 | - /** |
|
| 605 | - * Saves post detail info in detail table. |
|
| 606 | - * |
|
| 607 | - * @since 1.0.0 |
|
| 608 | - * @package GeoDirectory |
|
| 609 | - * @global object $wpdb WordPress Database object. |
|
| 610 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 611 | - * @param int $post_id The post ID. |
|
| 612 | - * @param array $postinfo_array {
|
|
| 613 | - * Post info that needs to be saved in detail table. |
|
| 614 | - * |
|
| 615 | - * @type string $post_title Listing title. |
|
| 616 | - * @type string $post_tags Listing tags. |
|
| 617 | - * @type string $post_status Listing post status. |
|
| 618 | - * @type string $post_location_id Listing location ID. |
|
| 619 | - * @type string $claimed Todo Desc needed. |
|
| 620 | - * @type string $businesses Todo Desc needed. |
|
| 621 | - * @type int $submit_time Submitted time in unix timestamp. |
|
| 622 | - * @type string $submit_ip Submitted IP. |
|
| 623 | - * @type string $expire_date Listing expiration date. |
|
| 624 | - * @type int $package_id Listing package ID. |
|
| 625 | - * @type int $alive_days Todo Desc needed. |
|
| 626 | - * @type int $is_featured Is this a featured listing?. |
|
| 627 | - * @type string $post_address Listing address. |
|
| 628 | - * @type string $post_city Listing city. |
|
| 629 | - * @type string $post_region Listing region. |
|
| 630 | - * @type string $post_country Listing country. |
|
| 631 | - * @type string $post_locations Listing locations. |
|
| 632 | - * @type string $post_zip Listing zip. |
|
| 633 | - * @type string $post_latitude Listing latitude. |
|
| 634 | - * @type string $post_longitude Listing longitude. |
|
| 635 | - * @type string $post_mapview Listing mapview. Default "ROADMAP". |
|
| 636 | - * @type string $post_mapzoom Listing mapzoom Default "9". |
|
| 637 | - * @type string $geodir_timing Business timing info. |
|
| 638 | - * @type string $geodir_contact Contact number. |
|
| 639 | - * @type string $geodir_email Business contact email. |
|
| 640 | - * @type string $geodir_website Business website. |
|
| 641 | - * @type string $geodir_twitter Twitter link. |
|
| 642 | - * @type string $geodir_facebook Facebook link. |
|
| 643 | - * @type string $geodir_video Video link. |
|
| 644 | - * @type string $geodir_special_offers Special offers. |
|
| 645 | - * |
|
| 646 | - * } |
|
| 647 | - * @return bool |
|
| 648 | - */ |
|
| 649 | - function geodir_save_post_info($post_id, $postinfo_array = array()) |
|
| 650 | - {
|
|
| 651 | - global $wpdb, $plugin_prefix; |
|
| 652 | - |
|
| 653 | - $post_type = get_post_type($post_id); |
|
| 654 | - |
|
| 655 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 656 | - |
|
| 657 | - /** |
|
| 658 | - * Filter to change Post info |
|
| 659 | - * |
|
| 660 | - * You can use this filter to change Post info. |
|
| 661 | - * |
|
| 662 | - * @since 1.0.0 |
|
| 663 | - * @package GeoDirectory |
|
| 664 | - * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
|
|
| 665 | - * @param int $post_id The post ID. |
|
| 666 | - */ |
|
| 667 | - $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
|
|
| 604 | + /** |
|
| 605 | + * Saves post detail info in detail table. |
|
| 606 | + * |
|
| 607 | + * @since 1.0.0 |
|
| 608 | + * @package GeoDirectory |
|
| 609 | + * @global object $wpdb WordPress Database object. |
|
| 610 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 611 | + * @param int $post_id The post ID. |
|
| 612 | + * @param array $postinfo_array {
|
|
| 613 | + * Post info that needs to be saved in detail table. |
|
| 614 | + * |
|
| 615 | + * @type string $post_title Listing title. |
|
| 616 | + * @type string $post_tags Listing tags. |
|
| 617 | + * @type string $post_status Listing post status. |
|
| 618 | + * @type string $post_location_id Listing location ID. |
|
| 619 | + * @type string $claimed Todo Desc needed. |
|
| 620 | + * @type string $businesses Todo Desc needed. |
|
| 621 | + * @type int $submit_time Submitted time in unix timestamp. |
|
| 622 | + * @type string $submit_ip Submitted IP. |
|
| 623 | + * @type string $expire_date Listing expiration date. |
|
| 624 | + * @type int $package_id Listing package ID. |
|
| 625 | + * @type int $alive_days Todo Desc needed. |
|
| 626 | + * @type int $is_featured Is this a featured listing?. |
|
| 627 | + * @type string $post_address Listing address. |
|
| 628 | + * @type string $post_city Listing city. |
|
| 629 | + * @type string $post_region Listing region. |
|
| 630 | + * @type string $post_country Listing country. |
|
| 631 | + * @type string $post_locations Listing locations. |
|
| 632 | + * @type string $post_zip Listing zip. |
|
| 633 | + * @type string $post_latitude Listing latitude. |
|
| 634 | + * @type string $post_longitude Listing longitude. |
|
| 635 | + * @type string $post_mapview Listing mapview. Default "ROADMAP". |
|
| 636 | + * @type string $post_mapzoom Listing mapzoom Default "9". |
|
| 637 | + * @type string $geodir_timing Business timing info. |
|
| 638 | + * @type string $geodir_contact Contact number. |
|
| 639 | + * @type string $geodir_email Business contact email. |
|
| 640 | + * @type string $geodir_website Business website. |
|
| 641 | + * @type string $geodir_twitter Twitter link. |
|
| 642 | + * @type string $geodir_facebook Facebook link. |
|
| 643 | + * @type string $geodir_video Video link. |
|
| 644 | + * @type string $geodir_special_offers Special offers. |
|
| 645 | + * |
|
| 646 | + * } |
|
| 647 | + * @return bool |
|
| 648 | + */ |
|
| 649 | + function geodir_save_post_info($post_id, $postinfo_array = array()) |
|
| 650 | + {
|
|
| 651 | + global $wpdb, $plugin_prefix; |
|
| 652 | + |
|
| 653 | + $post_type = get_post_type($post_id); |
|
| 654 | + |
|
| 655 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 656 | + |
|
| 657 | + /** |
|
| 658 | + * Filter to change Post info |
|
| 659 | + * |
|
| 660 | + * You can use this filter to change Post info. |
|
| 661 | + * |
|
| 662 | + * @since 1.0.0 |
|
| 663 | + * @package GeoDirectory |
|
| 664 | + * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
|
|
| 665 | + * @param int $post_id The post ID. |
|
| 666 | + */ |
|
| 667 | + $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
|
|
| 668 | + |
|
| 669 | + $query_string_escaped = ''; |
|
| 670 | + $query_string_array = array(); |
|
| 671 | + |
|
| 672 | + if (!empty($postmeta) && $post_id) {
|
|
| 673 | + |
|
| 674 | + $columns = $wpdb->get_col("show columns from $table");
|
|
| 675 | + foreach ($postmeta as $mkey => $mval) {
|
|
| 676 | + if(in_array($mkey,$columns)) {
|
|
| 677 | + if (is_array($mval)) {
|
|
| 678 | + $mval = implode(",", $mval);
|
|
| 679 | + } |
|
| 680 | + $query_string_escaped .= " $mkey = %s, "; // we can set the key here as we check if the column exists above |
|
| 681 | + $query_string_array[] = stripslashes($mval); // we strip slashes as we are using wpdb prepare |
|
| 668 | 682 | |
| 669 | - $query_string_escaped = ''; |
|
| 670 | - $query_string_array = array(); |
|
| 683 | + } |
|
| 684 | + } |
|
| 671 | 685 | |
| 672 | - if (!empty($postmeta) && $post_id) {
|
|
| 686 | + $query_string_escaped = trim($query_string_escaped, ", "); |
|
| 673 | 687 | |
| 674 | - $columns = $wpdb->get_col("show columns from $table");
|
|
| 675 | - foreach ($postmeta as $mkey => $mval) {
|
|
| 676 | - if(in_array($mkey,$columns)) {
|
|
| 677 | - if (is_array($mval)) {
|
|
| 678 | - $mval = implode(",", $mval);
|
|
| 679 | - } |
|
| 680 | - $query_string_escaped .= " $mkey = %s, "; // we can set the key here as we check if the column exists above |
|
| 681 | - $query_string_array[] = stripslashes($mval); // we strip slashes as we are using wpdb prepare |
|
| 688 | + if (empty($query_string_array) || trim($query_string_escaped) == '') {
|
|
| 689 | + return false; |
|
| 690 | + } |
|
| 682 | 691 | |
| 683 | - } |
|
| 684 | - } |
|
| 692 | + $query_string_array = str_replace(array("'%", "%'"), array("'%%", "%%'"), $query_string_array);
|
|
| 685 | 693 | |
| 686 | - $query_string_escaped = trim($query_string_escaped, ", "); |
|
| 687 | 694 | |
| 688 | - if (empty($query_string_array) || trim($query_string_escaped) == '') {
|
|
| 689 | - return false; |
|
| 690 | - } |
|
| 695 | + /** |
|
| 696 | + * Called before saving the listing info. |
|
| 697 | + * |
|
| 698 | + * @since 1.0.0 |
|
| 699 | + * @package GeoDirectory |
|
| 700 | + * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
|
|
| 701 | + * @param int $post_id The post ID. |
|
| 702 | + */ |
|
| 703 | + do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
|
|
| 691 | 704 | |
| 692 | - $query_string_array = str_replace(array("'%", "%'"), array("'%%", "%%'"), $query_string_array);
|
|
| 705 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 693 | 706 | |
| 707 | + $query_string_array[] = $post_id; |
|
| 708 | + $wpdb->query( |
|
| 709 | + $wpdb->prepare( |
|
| 710 | + "UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d", |
|
| 711 | + $query_string_array |
|
| 712 | + ) |
|
| 713 | + ); |
|
| 694 | 714 | |
| 695 | - /** |
|
| 696 | - * Called before saving the listing info. |
|
| 697 | - * |
|
| 698 | - * @since 1.0.0 |
|
| 699 | - * @package GeoDirectory |
|
| 700 | - * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
|
|
| 701 | - * @param int $post_id The post ID. |
|
| 702 | - */ |
|
| 703 | - do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
|
|
| 704 | 715 | |
| 705 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 716 | + } else {
|
|
| 706 | 717 | |
| 707 | - $query_string_array[] = $post_id; |
|
| 708 | - $wpdb->query( |
|
| 709 | - $wpdb->prepare( |
|
| 710 | - "UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d", |
|
| 711 | - $query_string_array |
|
| 712 | - ) |
|
| 713 | - ); |
|
| 718 | + array_unshift($query_string_array, $post_id); |
|
| 719 | + $wpdb->query( |
|
| 720 | + $wpdb->prepare( |
|
| 721 | + "INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped, |
|
| 722 | + $query_string_array |
|
| 723 | + ) |
|
| 724 | + ); |
|
| 725 | + |
|
| 726 | + } |
|
| 714 | 727 | |
| 728 | + /** |
|
| 729 | + * Called after saving the listing info. |
|
| 730 | + * |
|
| 731 | + * @since 1.0.0 |
|
| 732 | + * @package GeoDirectory |
|
| 733 | + * @param array $postinfo_array Post info that needs to be saved in detail table. |
|
| 734 | + * @param int $post_id The post ID. |
|
| 735 | + * @see 'geodir_after_save_listing' |
|
| 736 | + */ |
|
| 737 | + do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
|
|
| 738 | + |
|
| 739 | + return true; |
|
| 740 | + } else |
|
| 741 | + return false; |
|
| 715 | 742 | |
| 716 | - } else {
|
|
| 743 | + } |
|
| 744 | +} |
|
| 717 | 745 | |
| 718 | - array_unshift($query_string_array, $post_id); |
|
| 719 | - $wpdb->query( |
|
| 720 | - $wpdb->prepare( |
|
| 721 | - "INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped, |
|
| 722 | - $query_string_array |
|
| 723 | - ) |
|
| 724 | - ); |
|
| 725 | - |
|
| 726 | - } |
|
| 727 | 746 | |
| 728 | - /** |
|
| 729 | - * Called after saving the listing info. |
|
| 730 | - * |
|
| 731 | - * @since 1.0.0 |
|
| 732 | - * @package GeoDirectory |
|
| 733 | - * @param array $postinfo_array Post info that needs to be saved in detail table. |
|
| 734 | - * @param int $post_id The post ID. |
|
| 735 | - * @see 'geodir_after_save_listing' |
|
| 736 | - */ |
|
| 737 | - do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
|
|
| 747 | +if (!function_exists('geodir_save_post_meta')) {
|
|
| 748 | + /** |
|
| 749 | + * Save or update post custom fields. |
|
| 750 | + * |
|
| 751 | + * @since 1.0.0 |
|
| 752 | + * @package GeoDirectory |
|
| 753 | + * @global object $wpdb WordPress Database object. |
|
| 754 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 755 | + * @param int $post_id The post ID. |
|
| 756 | + * @param string $postmeta Detail table column name. |
|
| 757 | + * @param string $meta_value Detail table column value. |
|
| 758 | + * @return void|bool |
|
| 759 | + */ |
|
| 760 | + function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '') |
|
| 761 | + {
|
|
| 762 | + |
|
| 763 | + global $wpdb, $plugin_prefix; |
|
| 764 | + |
|
| 765 | + $post_type = get_post_type($post_id); |
|
| 766 | + |
|
| 767 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 768 | + |
|
| 769 | + if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
|
|
| 770 | + |
|
| 771 | + if (is_array($meta_value)) {
|
|
| 772 | + $meta_value = implode(",", $meta_value);
|
|
| 773 | + } |
|
| 738 | 774 | |
| 739 | - return true; |
|
| 740 | - } else |
|
| 741 | - return false; |
|
| 775 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 742 | 776 | |
| 743 | - } |
|
| 744 | -} |
|
| 777 | + $wpdb->query( |
|
| 778 | + $wpdb->prepare( |
|
| 779 | + "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d", |
|
| 780 | + array($post_id) |
|
| 781 | + ) |
|
| 782 | + ); |
|
| 745 | 783 | |
| 784 | + } else {
|
|
| 746 | 785 | |
| 747 | -if (!function_exists('geodir_save_post_meta')) {
|
|
| 748 | - /** |
|
| 749 | - * Save or update post custom fields. |
|
| 750 | - * |
|
| 751 | - * @since 1.0.0 |
|
| 752 | - * @package GeoDirectory |
|
| 753 | - * @global object $wpdb WordPress Database object. |
|
| 754 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 755 | - * @param int $post_id The post ID. |
|
| 756 | - * @param string $postmeta Detail table column name. |
|
| 757 | - * @param string $meta_value Detail table column value. |
|
| 758 | - * @return void|bool |
|
| 759 | - */ |
|
| 760 | - function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '') |
|
| 761 | - {
|
|
| 762 | - |
|
| 763 | - global $wpdb, $plugin_prefix; |
|
| 764 | - |
|
| 765 | - $post_type = get_post_type($post_id); |
|
| 766 | - |
|
| 767 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 768 | - |
|
| 769 | - if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
|
|
| 770 | - |
|
| 771 | - if (is_array($meta_value)) {
|
|
| 772 | - $meta_value = implode(",", $meta_value);
|
|
| 773 | - } |
|
| 774 | - |
|
| 775 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 776 | - |
|
| 777 | - $wpdb->query( |
|
| 778 | - $wpdb->prepare( |
|
| 779 | - "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d", |
|
| 780 | - array($post_id) |
|
| 781 | - ) |
|
| 782 | - ); |
|
| 783 | - |
|
| 784 | - } else {
|
|
| 785 | - |
|
| 786 | - $wpdb->query( |
|
| 787 | - $wpdb->prepare( |
|
| 788 | - "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'", |
|
| 789 | - array($post_id) |
|
| 790 | - ) |
|
| 791 | - ); |
|
| 792 | - } |
|
| 793 | - |
|
| 794 | - |
|
| 795 | - } else |
|
| 796 | - return false; |
|
| 797 | - } |
|
| 786 | + $wpdb->query( |
|
| 787 | + $wpdb->prepare( |
|
| 788 | + "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'", |
|
| 789 | + array($post_id) |
|
| 790 | + ) |
|
| 791 | + ); |
|
| 792 | + } |
|
| 793 | + |
|
| 794 | + |
|
| 795 | + } else |
|
| 796 | + return false; |
|
| 797 | + } |
|
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | if (!function_exists('geodir_delete_post_meta')) {
|
| 801 | - /** |
|
| 802 | - * Delete post custom fields. |
|
| 803 | - * |
|
| 804 | - * @since 1.0.0 |
|
| 805 | - * @package GeoDirectory |
|
| 806 | - * @global object $wpdb WordPress Database object. |
|
| 807 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 808 | - * @param int $post_id The post ID. |
|
| 809 | - * @param string $postmeta Detail table column name. |
|
| 810 | - * @todo check if this is depreciated |
|
| 811 | - * @todo Fix unknown variable mval |
|
| 812 | - * @return bool |
|
| 813 | - */ |
|
| 814 | - function geodir_delete_post_meta($post_id, $postmeta) |
|
| 815 | - {
|
|
| 816 | - |
|
| 817 | - global $wpdb, $plugin_prefix; |
|
| 818 | - |
|
| 819 | - $post_type = get_post_type($post_id); |
|
| 820 | - |
|
| 821 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 822 | - |
|
| 823 | - if (is_array($postmeta) && !empty($postmeta) && $post_id) {
|
|
| 824 | - $post_meta_set_query = ''; |
|
| 825 | - |
|
| 826 | - foreach ($postmeta as $mkey) {
|
|
| 827 | - if ($mval != '') |
|
| 828 | - $post_meta_set_query .= $mkey . " = '', "; |
|
| 829 | - } |
|
| 830 | - |
|
| 831 | - $post_meta_set_query = trim($post_meta_set_query, ", "); |
|
| 801 | + /** |
|
| 802 | + * Delete post custom fields. |
|
| 803 | + * |
|
| 804 | + * @since 1.0.0 |
|
| 805 | + * @package GeoDirectory |
|
| 806 | + * @global object $wpdb WordPress Database object. |
|
| 807 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 808 | + * @param int $post_id The post ID. |
|
| 809 | + * @param string $postmeta Detail table column name. |
|
| 810 | + * @todo check if this is depreciated |
|
| 811 | + * @todo Fix unknown variable mval |
|
| 812 | + * @return bool |
|
| 813 | + */ |
|
| 814 | + function geodir_delete_post_meta($post_id, $postmeta) |
|
| 815 | + {
|
|
| 816 | + |
|
| 817 | + global $wpdb, $plugin_prefix; |
|
| 818 | + |
|
| 819 | + $post_type = get_post_type($post_id); |
|
| 820 | + |
|
| 821 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 822 | + |
|
| 823 | + if (is_array($postmeta) && !empty($postmeta) && $post_id) {
|
|
| 824 | + $post_meta_set_query = ''; |
|
| 825 | + |
|
| 826 | + foreach ($postmeta as $mkey) {
|
|
| 827 | + if ($mval != '') |
|
| 828 | + $post_meta_set_query .= $mkey . " = '', "; |
|
| 829 | + } |
|
| 830 | + |
|
| 831 | + $post_meta_set_query = trim($post_meta_set_query, ", "); |
|
| 832 | 832 | |
| 833 | - if (empty($post_meta_set_query) || trim($post_meta_set_query) == '') {
|
|
| 834 | - return false; |
|
| 835 | - } |
|
| 836 | - |
|
| 837 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 838 | - |
|
| 839 | - $wpdb->query( |
|
| 840 | - $wpdb->prepare( |
|
| 841 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d", |
|
| 842 | - array($post_id) |
|
| 843 | - ) |
|
| 844 | - ); |
|
| 845 | - |
|
| 846 | - return true; |
|
| 847 | - } |
|
| 848 | - |
|
| 849 | - } elseif ($postmeta != '' && $post_id) {
|
|
| 850 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 851 | - |
|
| 852 | - $wpdb->query( |
|
| 853 | - $wpdb->prepare( |
|
| 854 | - "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d", |
|
| 855 | - array($post_id) |
|
| 856 | - ) |
|
| 857 | - ); |
|
| 858 | - |
|
| 859 | - return true; |
|
| 860 | - } |
|
| 861 | - |
|
| 862 | - } else |
|
| 863 | - return false; |
|
| 864 | - } |
|
| 833 | + if (empty($post_meta_set_query) || trim($post_meta_set_query) == '') {
|
|
| 834 | + return false; |
|
| 835 | + } |
|
| 836 | + |
|
| 837 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 838 | + |
|
| 839 | + $wpdb->query( |
|
| 840 | + $wpdb->prepare( |
|
| 841 | + "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d", |
|
| 842 | + array($post_id) |
|
| 843 | + ) |
|
| 844 | + ); |
|
| 845 | + |
|
| 846 | + return true; |
|
| 847 | + } |
|
| 848 | + |
|
| 849 | + } elseif ($postmeta != '' && $post_id) {
|
|
| 850 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 851 | + |
|
| 852 | + $wpdb->query( |
|
| 853 | + $wpdb->prepare( |
|
| 854 | + "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d", |
|
| 855 | + array($post_id) |
|
| 856 | + ) |
|
| 857 | + ); |
|
| 858 | + |
|
| 859 | + return true; |
|
| 860 | + } |
|
| 861 | + |
|
| 862 | + } else |
|
| 863 | + return false; |
|
| 864 | + } |
|
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | |
| 868 | 868 | if (!function_exists('geodir_get_post_meta')) {
|
| 869 | - /** |
|
| 870 | - * Get post custom meta. |
|
| 871 | - * |
|
| 872 | - * @since 1.0.0 |
|
| 873 | - * @since 1.6.20 Hook added to filter value. |
|
| 874 | - * @package GeoDirectory |
|
| 875 | - * @global object $wpdb WordPress Database object. |
|
| 876 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 877 | - * @param int $post_id The post ID. |
|
| 878 | - * @param string $meta_key The meta key to retrieve. |
|
| 879 | - * @param bool $single Optional. Whether to return a single value. Default false. |
|
| 880 | - * @todo single variable not yet implemented. |
|
| 881 | - * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true. |
|
| 882 | - */ |
|
| 883 | - function geodir_get_post_meta($post_id, $meta_key, $single = false) {
|
|
| 884 | - if (!$post_id) {
|
|
| 885 | - return false; |
|
| 886 | - } |
|
| 887 | - global $wpdb, $plugin_prefix; |
|
| 888 | - |
|
| 889 | - $all_postypes = geodir_get_posttypes(); |
|
| 890 | - |
|
| 891 | - $post_type = get_post_type($post_id); |
|
| 892 | - |
|
| 893 | - if (!in_array($post_type, $all_postypes)) |
|
| 894 | - return false; |
|
| 895 | - |
|
| 896 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 897 | - |
|
| 898 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
|
|
| 899 | - $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
|
|
| 869 | + /** |
|
| 870 | + * Get post custom meta. |
|
| 871 | + * |
|
| 872 | + * @since 1.0.0 |
|
| 873 | + * @since 1.6.20 Hook added to filter value. |
|
| 874 | + * @package GeoDirectory |
|
| 875 | + * @global object $wpdb WordPress Database object. |
|
| 876 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 877 | + * @param int $post_id The post ID. |
|
| 878 | + * @param string $meta_key The meta key to retrieve. |
|
| 879 | + * @param bool $single Optional. Whether to return a single value. Default false. |
|
| 880 | + * @todo single variable not yet implemented. |
|
| 881 | + * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true. |
|
| 882 | + */ |
|
| 883 | + function geodir_get_post_meta($post_id, $meta_key, $single = false) {
|
|
| 884 | + if (!$post_id) {
|
|
| 885 | + return false; |
|
| 886 | + } |
|
| 887 | + global $wpdb, $plugin_prefix; |
|
| 888 | + |
|
| 889 | + $all_postypes = geodir_get_posttypes(); |
|
| 890 | + |
|
| 891 | + $post_type = get_post_type($post_id); |
|
| 892 | + |
|
| 893 | + if (!in_array($post_type, $all_postypes)) |
|
| 894 | + return false; |
|
| 895 | + |
|
| 896 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 897 | + |
|
| 898 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
|
|
| 899 | + $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
|
|
| 900 | 900 | |
| 901 | - if ($meta_value && $meta_value !== '') {
|
|
| 902 | - $meta_value = maybe_serialize($meta_value); |
|
| 903 | - } |
|
| 904 | - } else {
|
|
| 905 | - $meta_value = false; |
|
| 906 | - } |
|
| 901 | + if ($meta_value && $meta_value !== '') {
|
|
| 902 | + $meta_value = maybe_serialize($meta_value); |
|
| 903 | + } |
|
| 904 | + } else {
|
|
| 905 | + $meta_value = false; |
|
| 906 | + } |
|
| 907 | 907 | |
| 908 | - /** |
|
| 909 | - * Filter the listing custom meta. |
|
| 910 | - * |
|
| 911 | - * @since 1.6.20 |
|
| 912 | - * |
|
| 913 | - * @param bool|mixed|null|string $meta_value Will be an array if $single is false. Will be value of meta data field if $single is true. |
|
| 914 | - * @param int $post_id The post ID. |
|
| 915 | - * @param string $meta_key The meta key to retrieve. |
|
| 916 | - * @param bool $single Optional. Whether to return a single value. Default false. |
|
| 917 | - */ |
|
| 918 | - return apply_filters( 'geodir_get_post_meta', $meta_value, $post_id, $meta_key, $single ); |
|
| 919 | - } |
|
| 908 | + /** |
|
| 909 | + * Filter the listing custom meta. |
|
| 910 | + * |
|
| 911 | + * @since 1.6.20 |
|
| 912 | + * |
|
| 913 | + * @param bool|mixed|null|string $meta_value Will be an array if $single is false. Will be value of meta data field if $single is true. |
|
| 914 | + * @param int $post_id The post ID. |
|
| 915 | + * @param string $meta_key The meta key to retrieve. |
|
| 916 | + * @param bool $single Optional. Whether to return a single value. Default false. |
|
| 917 | + */ |
|
| 918 | + return apply_filters( 'geodir_get_post_meta', $meta_value, $post_id, $meta_key, $single ); |
|
| 919 | + } |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | |
| 923 | 923 | if (!function_exists('geodir_save_post_images')) {
|
| 924 | - /** |
|
| 925 | - * Save post attachments. |
|
| 926 | - * |
|
| 927 | - * @since 1.0.0 |
|
| 928 | - * @package GeoDirectory |
|
| 929 | - * @global object $wpdb WordPress Database object. |
|
| 930 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 931 | - * @global object $current_user Current user object. |
|
| 932 | - * @param int $post_id The post ID. |
|
| 933 | - * @param array $post_image Post image urls as an array. |
|
| 934 | - * @param bool $dummy Optional. Is this a dummy listing? Default false. |
|
| 935 | - */ |
|
| 936 | - function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false) |
|
| 937 | - {
|
|
| 924 | + /** |
|
| 925 | + * Save post attachments. |
|
| 926 | + * |
|
| 927 | + * @since 1.0.0 |
|
| 928 | + * @package GeoDirectory |
|
| 929 | + * @global object $wpdb WordPress Database object. |
|
| 930 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 931 | + * @global object $current_user Current user object. |
|
| 932 | + * @param int $post_id The post ID. |
|
| 933 | + * @param array $post_image Post image urls as an array. |
|
| 934 | + * @param bool $dummy Optional. Is this a dummy listing? Default false. |
|
| 935 | + */ |
|
| 936 | + function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false) |
|
| 937 | + {
|
|
| 938 | 938 | |
| 939 | 939 | |
| 940 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 940 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 941 | 941 | |
| 942 | - $post_type = get_post_type($post_id); |
|
| 942 | + $post_type = get_post_type($post_id); |
|
| 943 | 943 | |
| 944 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 944 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 945 | 945 | |
| 946 | - $post_images = geodir_get_images($post_id); |
|
| 946 | + $post_images = geodir_get_images($post_id); |
|
| 947 | 947 | |
| 948 | - $wpdb->query( |
|
| 949 | - $wpdb->prepare( |
|
| 950 | - "UPDATE " . $table . " SET featured_image = '' where post_id =%d", |
|
| 951 | - array($post_id) |
|
| 952 | - ) |
|
| 953 | - ); |
|
| 948 | + $wpdb->query( |
|
| 949 | + $wpdb->prepare( |
|
| 950 | + "UPDATE " . $table . " SET featured_image = '' where post_id =%d", |
|
| 951 | + array($post_id) |
|
| 952 | + ) |
|
| 953 | + ); |
|
| 954 | 954 | |
| 955 | - $invalid_files = $post_images; |
|
| 956 | - $valid_file_ids = array(); |
|
| 957 | - $valid_files_condition = ''; |
|
| 958 | - $geodir_uploaddir = ''; |
|
| 955 | + $invalid_files = $post_images; |
|
| 956 | + $valid_file_ids = array(); |
|
| 957 | + $valid_files_condition = ''; |
|
| 958 | + $geodir_uploaddir = ''; |
|
| 959 | 959 | |
| 960 | - $remove_files = array(); |
|
| 960 | + $remove_files = array(); |
|
| 961 | 961 | |
| 962 | - if (!empty($post_image)) {
|
|
| 962 | + if (!empty($post_image)) {
|
|
| 963 | 963 | |
| 964 | - $uploads = wp_upload_dir(); |
|
| 965 | - $uploads_dir = $uploads['path']; |
|
| 964 | + $uploads = wp_upload_dir(); |
|
| 965 | + $uploads_dir = $uploads['path']; |
|
| 966 | 966 | |
| 967 | - $geodir_uploadpath = $uploads['path']; |
|
| 968 | - $geodir_uploadurl = $uploads['url']; |
|
| 969 | - $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : ''; |
|
| 967 | + $geodir_uploadpath = $uploads['path']; |
|
| 968 | + $geodir_uploadurl = $uploads['url']; |
|
| 969 | + $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : ''; |
|
| 970 | 970 | |
| 971 | - $invalid_files = array(); |
|
| 972 | - $postcurr_images = array(); |
|
| 971 | + $invalid_files = array(); |
|
| 972 | + $postcurr_images = array(); |
|
| 973 | 973 | |
| 974 | - for ($m = 0; $m < count($post_image); $m++) {
|
|
| 975 | - $menu_order = $m + 1; |
|
| 974 | + for ($m = 0; $m < count($post_image); $m++) {
|
|
| 975 | + $menu_order = $m + 1; |
|
| 976 | 976 | |
| 977 | - $file_path = ''; |
|
| 978 | - /* --------- start ------- */ |
|
| 977 | + $file_path = ''; |
|
| 978 | + /* --------- start ------- */ |
|
| 979 | 979 | |
| 980 | - $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
|
|
| 980 | + $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
|
|
| 981 | 981 | |
| 982 | - $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
| 982 | + $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
| 983 | 983 | |
| 984 | 984 | |
| 985 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
|
|
| 985 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
|
|
| 986 | 986 | |
| 987 | - /* --------- end ------- */ |
|
| 988 | - $curr_img_url = $post_image[$m]; |
|
| 987 | + /* --------- end ------- */ |
|
| 988 | + $curr_img_url = $post_image[$m]; |
|
| 989 | 989 | |
| 990 | - $image_name_arr = explode('/', $curr_img_url);
|
|
| 990 | + $image_name_arr = explode('/', $curr_img_url);
|
|
| 991 | 991 | |
| 992 | - $count_image_name_arr = count($image_name_arr) - 2; |
|
| 992 | + $count_image_name_arr = count($image_name_arr) - 2; |
|
| 993 | 993 | |
| 994 | - $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0; |
|
| 994 | + $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0; |
|
| 995 | 995 | |
| 996 | - $curr_img_dir = $image_name_arr[$count_image_name_arr]; |
|
| 996 | + $curr_img_dir = $image_name_arr[$count_image_name_arr]; |
|
| 997 | 997 | |
| 998 | - $filename = end($image_name_arr); |
|
| 999 | - if (strpos($filename, '?') !== false) {
|
|
| 1000 | - list($filename) = explode('?', $filename);
|
|
| 1001 | - } |
|
| 998 | + $filename = end($image_name_arr); |
|
| 999 | + if (strpos($filename, '?') !== false) {
|
|
| 1000 | + list($filename) = explode('?', $filename);
|
|
| 1001 | + } |
|
| 1002 | 1002 | |
| 1003 | - $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url); |
|
| 1004 | - $curr_img_dir = str_replace($filename, "", $curr_img_dir); |
|
| 1003 | + $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url); |
|
| 1004 | + $curr_img_dir = str_replace($filename, "", $curr_img_dir); |
|
| 1005 | 1005 | |
| 1006 | - $img_name_arr = explode('.', $filename);
|
|
| 1006 | + $img_name_arr = explode('.', $filename);
|
|
| 1007 | 1007 | |
| 1008 | - $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename; |
|
| 1009 | - if (!empty($img_name_arr) && count($img_name_arr) > 2) {
|
|
| 1010 | - $new_img_name_arr = $img_name_arr; |
|
| 1011 | - if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
|
|
| 1012 | - unset($new_img_name_arr[count($img_name_arr) - 1]); |
|
| 1013 | - $file_title = implode('.', $new_img_name_arr);
|
|
| 1014 | - } |
|
| 1015 | - } |
|
| 1016 | - $file_title = sanitize_file_name($file_title); |
|
| 1017 | - $file_name = sanitize_file_name($filename); |
|
| 1008 | + $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename; |
|
| 1009 | + if (!empty($img_name_arr) && count($img_name_arr) > 2) {
|
|
| 1010 | + $new_img_name_arr = $img_name_arr; |
|
| 1011 | + if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
|
|
| 1012 | + unset($new_img_name_arr[count($img_name_arr) - 1]); |
|
| 1013 | + $file_title = implode('.', $new_img_name_arr);
|
|
| 1014 | + } |
|
| 1015 | + } |
|
| 1016 | + $file_title = sanitize_file_name($file_title); |
|
| 1017 | + $file_name = sanitize_file_name($filename); |
|
| 1018 | 1018 | |
| 1019 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1019 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1020 | 1020 | |
| 1021 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1021 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1022 | 1022 | |
| 1023 | - // Set an array containing a list of acceptable formats |
|
| 1024 | - $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
|
|
| 1023 | + // Set an array containing a list of acceptable formats |
|
| 1024 | + $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
|
|
| 1025 | 1025 | |
| 1026 | - // If the uploaded file is the right format |
|
| 1027 | - if (in_array($uploaded_file_type, $allowed_file_types)) {
|
|
| 1028 | - if (!function_exists('wp_handle_upload')) {
|
|
| 1029 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1030 | - } |
|
| 1026 | + // If the uploaded file is the right format |
|
| 1027 | + if (in_array($uploaded_file_type, $allowed_file_types)) {
|
|
| 1028 | + if (!function_exists('wp_handle_upload')) {
|
|
| 1029 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1030 | + } |
|
| 1031 | 1031 | |
| 1032 | - if (!is_dir($geodir_uploadpath)) {
|
|
| 1033 | - mkdir($geodir_uploadpath); |
|
| 1034 | - } |
|
| 1032 | + if (!is_dir($geodir_uploadpath)) {
|
|
| 1033 | + mkdir($geodir_uploadpath); |
|
| 1034 | + } |
|
| 1035 | 1035 | |
| 1036 | - $external_img = false; |
|
| 1037 | - if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) {
|
|
| 1038 | - } else {
|
|
| 1039 | - $external_img = true; |
|
| 1040 | - } |
|
| 1036 | + $external_img = false; |
|
| 1037 | + if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) {
|
|
| 1038 | + } else {
|
|
| 1039 | + $external_img = true; |
|
| 1040 | + } |
|
| 1041 | 1041 | |
| 1042 | - if ($dummy || $external_img) {
|
|
| 1043 | - $uploaded_file = array(); |
|
| 1044 | - $uploaded = (array)fetch_remote_file($curr_img_url); |
|
| 1042 | + if ($dummy || $external_img) {
|
|
| 1043 | + $uploaded_file = array(); |
|
| 1044 | + $uploaded = (array)fetch_remote_file($curr_img_url); |
|
| 1045 | 1045 | |
| 1046 | - if (isset($uploaded['error']) && empty($uploaded['error'])) {
|
|
| 1047 | - $new_name = basename($uploaded['file']); |
|
| 1048 | - $uploaded_file = $uploaded; |
|
| 1049 | - }else{
|
|
| 1050 | - print_r($uploaded);exit; |
|
| 1051 | - } |
|
| 1052 | - $external_img = false; |
|
| 1053 | - } else {
|
|
| 1054 | - $new_name = $post_id . '_' . $file_name; |
|
| 1046 | + if (isset($uploaded['error']) && empty($uploaded['error'])) {
|
|
| 1047 | + $new_name = basename($uploaded['file']); |
|
| 1048 | + $uploaded_file = $uploaded; |
|
| 1049 | + }else{
|
|
| 1050 | + print_r($uploaded);exit; |
|
| 1051 | + } |
|
| 1052 | + $external_img = false; |
|
| 1053 | + } else {
|
|
| 1054 | + $new_name = $post_id . '_' . $file_name; |
|
| 1055 | 1055 | |
| 1056 | - if ($curr_img_dir == $sub_dir) {
|
|
| 1057 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1058 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1059 | - } else {
|
|
| 1060 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1061 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1062 | - } |
|
| 1056 | + if ($curr_img_dir == $sub_dir) {
|
|
| 1057 | + $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1058 | + $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1059 | + } else {
|
|
| 1060 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1061 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1062 | + } |
|
| 1063 | 1063 | |
| 1064 | - $uploaded_file = ''; |
|
| 1064 | + $uploaded_file = ''; |
|
| 1065 | 1065 | |
| 1066 | - if (file_exists($img_path)) {
|
|
| 1067 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1068 | - $file_path = ''; |
|
| 1069 | - } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
|
|
| 1070 | - $uploaded_file = true; |
|
| 1071 | - $file_path = $curr_img_dir . '/' . $filename; |
|
| 1072 | - } |
|
| 1066 | + if (file_exists($img_path)) {
|
|
| 1067 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1068 | + $file_path = ''; |
|
| 1069 | + } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
|
|
| 1070 | + $uploaded_file = true; |
|
| 1071 | + $file_path = $curr_img_dir . '/' . $filename; |
|
| 1072 | + } |
|
| 1073 | 1073 | |
| 1074 | - if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
|
| 1075 | - unlink($img_path); |
|
| 1076 | - } |
|
| 1074 | + if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
|
| 1075 | + unlink($img_path); |
|
| 1076 | + } |
|
| 1077 | 1077 | |
| 1078 | - if (!empty($uploaded_file)) {
|
|
| 1079 | - if (!isset($file_path) || !$file_path) {
|
|
| 1080 | - $file_path = $sub_dir . '/' . $new_name; |
|
| 1081 | - } |
|
| 1078 | + if (!empty($uploaded_file)) {
|
|
| 1079 | + if (!isset($file_path) || !$file_path) {
|
|
| 1080 | + $file_path = $sub_dir . '/' . $new_name; |
|
| 1081 | + } |
|
| 1082 | 1082 | |
| 1083 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
|
|
| 1083 | + $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
|
|
| 1084 | 1084 | |
| 1085 | - if ($menu_order == 1) {
|
|
| 1085 | + if ($menu_order == 1) {
|
|
| 1086 | 1086 | |
| 1087 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
|
|
| 1087 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
|
|
| 1088 | 1088 | |
| 1089 | - } |
|
| 1089 | + } |
|
| 1090 | 1090 | |
| 1091 | - // Set up options array to add this file as an attachment |
|
| 1092 | - $attachment = array(); |
|
| 1093 | - $attachment['post_id'] = $post_id; |
|
| 1094 | - $attachment['title'] = $file_title; |
|
| 1095 | - $attachment['content'] = ''; |
|
| 1096 | - $attachment['file'] = $file_path; |
|
| 1097 | - $attachment['mime_type'] = $uploaded_file_type; |
|
| 1098 | - $attachment['menu_order'] = $menu_order; |
|
| 1099 | - $attachment['is_featured'] = 0; |
|
| 1091 | + // Set up options array to add this file as an attachment |
|
| 1092 | + $attachment = array(); |
|
| 1093 | + $attachment['post_id'] = $post_id; |
|
| 1094 | + $attachment['title'] = $file_title; |
|
| 1095 | + $attachment['content'] = ''; |
|
| 1096 | + $attachment['file'] = $file_path; |
|
| 1097 | + $attachment['mime_type'] = $uploaded_file_type; |
|
| 1098 | + $attachment['menu_order'] = $menu_order; |
|
| 1099 | + $attachment['is_featured'] = 0; |
|
| 1100 | 1100 | |
| 1101 | - $attachment_set = ''; |
|
| 1101 | + $attachment_set = ''; |
|
| 1102 | 1102 | |
| 1103 | - foreach ($attachment as $key => $val) {
|
|
| 1104 | - if ($val != '') |
|
| 1105 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1106 | - } |
|
| 1103 | + foreach ($attachment as $key => $val) {
|
|
| 1104 | + if ($val != '') |
|
| 1105 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1106 | + } |
|
| 1107 | 1107 | |
| 1108 | - $attachment_set = trim($attachment_set, ", "); |
|
| 1108 | + $attachment_set = trim($attachment_set, ", "); |
|
| 1109 | + |
|
| 1110 | + $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 1109 | 1111 | |
| 1110 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 1112 | + $valid_file_ids[] = $wpdb->insert_id; |
|
| 1113 | + } |
|
| 1111 | 1114 | |
| 1112 | - $valid_file_ids[] = $wpdb->insert_id; |
|
| 1113 | - } |
|
| 1115 | + } |
|
| 1114 | 1116 | |
| 1115 | - } |
|
| 1116 | 1117 | |
| 1118 | + } else {
|
|
| 1119 | + $valid_file_ids[] = $find_image; |
|
| 1117 | 1120 | |
| 1118 | - } else {
|
|
| 1119 | - $valid_file_ids[] = $find_image; |
|
| 1120 | - |
|
| 1121 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
|
|
| 1121 | + $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
|
|
| 1122 | 1122 | |
| 1123 | - $wpdb->query( |
|
| 1124 | - $wpdb->prepare( |
|
| 1125 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d", |
|
| 1126 | - array($menu_order, $split_img_path[1], $post_id) |
|
| 1127 | - ) |
|
| 1128 | - ); |
|
| 1123 | + $wpdb->query( |
|
| 1124 | + $wpdb->prepare( |
|
| 1125 | + "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d", |
|
| 1126 | + array($menu_order, $split_img_path[1], $post_id) |
|
| 1127 | + ) |
|
| 1128 | + ); |
|
| 1129 | 1129 | |
| 1130 | - if ($menu_order == 1) |
|
| 1131 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1130 | + if ($menu_order == 1) |
|
| 1131 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1132 | 1132 | |
| 1133 | - } |
|
| 1133 | + } |
|
| 1134 | 1134 | |
| 1135 | 1135 | |
| 1136 | - } |
|
| 1136 | + } |
|
| 1137 | 1137 | |
| 1138 | - if (!empty($valid_file_ids)) {
|
|
| 1138 | + if (!empty($valid_file_ids)) {
|
|
| 1139 | 1139 | |
| 1140 | - $remove_files = $valid_file_ids; |
|
| 1140 | + $remove_files = $valid_file_ids; |
|
| 1141 | 1141 | |
| 1142 | - $remove_files_length = count($remove_files); |
|
| 1143 | - $remove_files_format = array_fill(0, $remove_files_length, '%d'); |
|
| 1144 | - $format = implode(',', $remove_files_format);
|
|
| 1145 | - $valid_files_condition = " ID NOT IN ($format) AND "; |
|
| 1142 | + $remove_files_length = count($remove_files); |
|
| 1143 | + $remove_files_format = array_fill(0, $remove_files_length, '%d'); |
|
| 1144 | + $format = implode(',', $remove_files_format);
|
|
| 1145 | + $valid_files_condition = " ID NOT IN ($format) AND "; |
|
| 1146 | 1146 | |
| 1147 | - } |
|
| 1147 | + } |
|
| 1148 | 1148 | |
| 1149 | - //Get and remove all old images of post from database to set by new order |
|
| 1149 | + //Get and remove all old images of post from database to set by new order |
|
| 1150 | 1150 | |
| 1151 | - if (!empty($post_images)) {
|
|
| 1151 | + if (!empty($post_images)) {
|
|
| 1152 | 1152 | |
| 1153 | - foreach ($post_images as $img) {
|
|
| 1153 | + foreach ($post_images as $img) {
|
|
| 1154 | 1154 | |
| 1155 | - if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
|
|
| 1155 | + if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
|
|
| 1156 | 1156 | |
| 1157 | - $invalid_files[] = (object)array('src' => $img->src);
|
|
| 1157 | + $invalid_files[] = (object)array('src' => $img->src);
|
|
| 1158 | 1158 | |
| 1159 | - } |
|
| 1159 | + } |
|
| 1160 | 1160 | |
| 1161 | - } |
|
| 1161 | + } |
|
| 1162 | 1162 | |
| 1163 | - } |
|
| 1163 | + } |
|
| 1164 | 1164 | |
| 1165 | - $invalid_files = (object)$invalid_files; |
|
| 1166 | - } |
|
| 1165 | + $invalid_files = (object)$invalid_files; |
|
| 1166 | + } |
|
| 1167 | 1167 | |
| 1168 | - $remove_files[] = $post_id; |
|
| 1168 | + $remove_files[] = $post_id; |
|
| 1169 | 1169 | |
| 1170 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
|
|
| 1170 | + $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
|
|
| 1171 | 1171 | |
| 1172 | - if (!empty($invalid_files)) |
|
| 1173 | - geodir_remove_attachments($invalid_files); |
|
| 1174 | - } |
|
| 1172 | + if (!empty($invalid_files)) |
|
| 1173 | + geodir_remove_attachments($invalid_files); |
|
| 1174 | + } |
|
| 1175 | 1175 | |
| 1176 | 1176 | } |
| 1177 | 1177 | |
@@ -1185,12 +1185,12 @@ discard block |
||
| 1185 | 1185 | function geodir_remove_temp_images() |
| 1186 | 1186 | {
|
| 1187 | 1187 | |
| 1188 | - global $current_user; |
|
| 1188 | + global $current_user; |
|
| 1189 | 1189 | |
| 1190 | - $uploads = wp_upload_dir(); |
|
| 1191 | - $uploads_dir = $uploads['path']; |
|
| 1190 | + $uploads = wp_upload_dir(); |
|
| 1191 | + $uploads_dir = $uploads['path']; |
|
| 1192 | 1192 | |
| 1193 | - /* if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
|
|
| 1193 | + /* if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
|
|
| 1194 | 1194 | |
| 1195 | 1195 | $dirPath = $uploads_dir.'/temp_'.$current_user->data->ID; |
| 1196 | 1196 | if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
|
@@ -1207,8 +1207,8 @@ discard block |
||
| 1207 | 1207 | rmdir($dirPath); |
| 1208 | 1208 | } */ |
| 1209 | 1209 | |
| 1210 | - $dirname = $uploads_dir . '/temp_' . $current_user->ID; |
|
| 1211 | - geodir_delete_directory($dirname); |
|
| 1210 | + $dirname = $uploads_dir . '/temp_' . $current_user->ID; |
|
| 1211 | + geodir_delete_directory($dirname); |
|
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | 1214 | |
@@ -1222,129 +1222,129 @@ discard block |
||
| 1222 | 1222 | */ |
| 1223 | 1223 | function geodir_delete_directory($dirname) |
| 1224 | 1224 | {
|
| 1225 | - $dir_handle = ''; |
|
| 1226 | - if (is_dir($dirname)) |
|
| 1227 | - $dir_handle = opendir($dirname); |
|
| 1228 | - if (!$dir_handle) |
|
| 1229 | - return false; |
|
| 1230 | - while ($file = readdir($dir_handle)) {
|
|
| 1231 | - if ($file != "." && $file != "..") {
|
|
| 1232 | - if (!is_dir($dirname . "/" . $file)) |
|
| 1233 | - unlink($dirname . "/" . $file); |
|
| 1234 | - else |
|
| 1235 | - geodir_delete_directory($dirname . '/' . $file); |
|
| 1236 | - } |
|
| 1237 | - } |
|
| 1238 | - closedir($dir_handle); |
|
| 1239 | - rmdir($dirname); |
|
| 1240 | - return true; |
|
| 1225 | + $dir_handle = ''; |
|
| 1226 | + if (is_dir($dirname)) |
|
| 1227 | + $dir_handle = opendir($dirname); |
|
| 1228 | + if (!$dir_handle) |
|
| 1229 | + return false; |
|
| 1230 | + while ($file = readdir($dir_handle)) {
|
|
| 1231 | + if ($file != "." && $file != "..") {
|
|
| 1232 | + if (!is_dir($dirname . "/" . $file)) |
|
| 1233 | + unlink($dirname . "/" . $file); |
|
| 1234 | + else |
|
| 1235 | + geodir_delete_directory($dirname . '/' . $file); |
|
| 1236 | + } |
|
| 1237 | + } |
|
| 1238 | + closedir($dir_handle); |
|
| 1239 | + rmdir($dirname); |
|
| 1240 | + return true; |
|
| 1241 | 1241 | |
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | |
| 1245 | 1245 | if (!function_exists('geodir_remove_attachments')) {
|
| 1246 | - /** |
|
| 1247 | - * Remove post attachments. |
|
| 1248 | - * |
|
| 1249 | - * @since 1.0.0 |
|
| 1250 | - * @package GeoDirectory |
|
| 1251 | - * @param array $postcurr_images Array of image objects. |
|
| 1252 | - */ |
|
| 1253 | - function geodir_remove_attachments($postcurr_images = array()) |
|
| 1254 | - {
|
|
| 1255 | - // Unlink all past images of post |
|
| 1256 | - if (!empty($postcurr_images)) {
|
|
| 1257 | - |
|
| 1258 | - $uploads = wp_upload_dir(); |
|
| 1259 | - $uploads_dir = $uploads['path']; |
|
| 1260 | - |
|
| 1261 | - foreach ($postcurr_images as $postimg) {
|
|
| 1262 | - $image_name_arr = explode('/', $postimg->src);
|
|
| 1263 | - $filename = end($image_name_arr); |
|
| 1264 | - if (file_exists($uploads_dir . '/' . $filename)) |
|
| 1265 | - unlink($uploads_dir . '/' . $filename); |
|
| 1266 | - } |
|
| 1267 | - |
|
| 1268 | - } // endif |
|
| 1269 | - // Unlink all past images of post end |
|
| 1270 | - } |
|
| 1246 | + /** |
|
| 1247 | + * Remove post attachments. |
|
| 1248 | + * |
|
| 1249 | + * @since 1.0.0 |
|
| 1250 | + * @package GeoDirectory |
|
| 1251 | + * @param array $postcurr_images Array of image objects. |
|
| 1252 | + */ |
|
| 1253 | + function geodir_remove_attachments($postcurr_images = array()) |
|
| 1254 | + {
|
|
| 1255 | + // Unlink all past images of post |
|
| 1256 | + if (!empty($postcurr_images)) {
|
|
| 1257 | + |
|
| 1258 | + $uploads = wp_upload_dir(); |
|
| 1259 | + $uploads_dir = $uploads['path']; |
|
| 1260 | + |
|
| 1261 | + foreach ($postcurr_images as $postimg) {
|
|
| 1262 | + $image_name_arr = explode('/', $postimg->src);
|
|
| 1263 | + $filename = end($image_name_arr); |
|
| 1264 | + if (file_exists($uploads_dir . '/' . $filename)) |
|
| 1265 | + unlink($uploads_dir . '/' . $filename); |
|
| 1266 | + } |
|
| 1267 | + |
|
| 1268 | + } // endif |
|
| 1269 | + // Unlink all past images of post end |
|
| 1270 | + } |
|
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | 1273 | if (!function_exists('geodir_get_featured_image')) {
|
| 1274 | - /** |
|
| 1275 | - * Gets the post featured image. |
|
| 1276 | - * |
|
| 1277 | - * @since 1.0.0 |
|
| 1278 | - * @package GeoDirectory |
|
| 1279 | - * @global object $wpdb WordPress Database object. |
|
| 1280 | - * @global object $post The current post object. |
|
| 1281 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1282 | - * @param int|string $post_id The post ID. |
|
| 1283 | - * @param string $size Optional. Thumbnail size. Default: thumbnail. |
|
| 1284 | - * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false. |
|
| 1285 | - * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false. |
|
| 1286 | - * @return bool|object Image details as an object. |
|
| 1287 | - */ |
|
| 1288 | - function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false) |
|
| 1289 | - {
|
|
| 1290 | - |
|
| 1291 | - /*$img_arr['src'] = get_the_post_thumbnail_url( $post_id, 'medium');//medium/thumbnail |
|
| 1274 | + /** |
|
| 1275 | + * Gets the post featured image. |
|
| 1276 | + * |
|
| 1277 | + * @since 1.0.0 |
|
| 1278 | + * @package GeoDirectory |
|
| 1279 | + * @global object $wpdb WordPress Database object. |
|
| 1280 | + * @global object $post The current post object. |
|
| 1281 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1282 | + * @param int|string $post_id The post ID. |
|
| 1283 | + * @param string $size Optional. Thumbnail size. Default: thumbnail. |
|
| 1284 | + * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false. |
|
| 1285 | + * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false. |
|
| 1286 | + * @return bool|object Image details as an object. |
|
| 1287 | + */ |
|
| 1288 | + function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false) |
|
| 1289 | + {
|
|
| 1290 | + |
|
| 1291 | + /*$img_arr['src'] = get_the_post_thumbnail_url( $post_id, 'medium');//medium/thumbnail |
|
| 1292 | 1292 | $img_arr['path'] = ''; |
| 1293 | 1293 | $img_arr['width'] = ''; |
| 1294 | 1294 | $img_arr['height'] = ''; |
| 1295 | 1295 | $img_arr['title'] = ''; |
| 1296 | 1296 | return (object)$img_arr;*/ |
| 1297 | - global $wpdb, $plugin_prefix, $post; |
|
| 1297 | + global $wpdb, $plugin_prefix, $post; |
|
| 1298 | 1298 | |
| 1299 | - if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
|
|
| 1300 | - $post_type = $post->post_type; |
|
| 1301 | - } else {
|
|
| 1302 | - $post_type = get_post_type($post_id); |
|
| 1303 | - } |
|
| 1299 | + if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
|
|
| 1300 | + $post_type = $post->post_type; |
|
| 1301 | + } else {
|
|
| 1302 | + $post_type = get_post_type($post_id); |
|
| 1303 | + } |
|
| 1304 | 1304 | |
| 1305 | - if (!in_array($post_type, geodir_get_posttypes())) {
|
|
| 1306 | - return false;// if not a GD CPT return; |
|
| 1307 | - } |
|
| 1305 | + if (!in_array($post_type, geodir_get_posttypes())) {
|
|
| 1306 | + return false;// if not a GD CPT return; |
|
| 1307 | + } |
|
| 1308 | 1308 | |
| 1309 | 1309 | |
| 1310 | - $list_img_size = get_option('geodir_listing_img_size','default');
|
|
| 1310 | + $list_img_size = get_option('geodir_listing_img_size','default');
|
|
| 1311 | 1311 | |
| 1312 | - if( $size=='list-thumb' && $list_img_size != 'default' ){
|
|
| 1313 | - $fimg = get_the_post_thumbnail_url($post_id,$list_img_size); |
|
| 1314 | - if($fimg){
|
|
| 1315 | - $uploads = wp_upload_dir(); |
|
| 1316 | - $uploads_baseurl = $uploads['baseurl']; |
|
| 1317 | - $file = str_replace($uploads_baseurl,'',$fimg); |
|
| 1318 | - } |
|
| 1319 | - } |
|
| 1312 | + if( $size=='list-thumb' && $list_img_size != 'default' ){
|
|
| 1313 | + $fimg = get_the_post_thumbnail_url($post_id,$list_img_size); |
|
| 1314 | + if($fimg){
|
|
| 1315 | + $uploads = wp_upload_dir(); |
|
| 1316 | + $uploads_baseurl = $uploads['baseurl']; |
|
| 1317 | + $file = str_replace($uploads_baseurl,'',$fimg); |
|
| 1318 | + } |
|
| 1319 | + } |
|
| 1320 | 1320 | |
| 1321 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1321 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1322 | 1322 | |
| 1323 | - if (!$file) {
|
|
| 1324 | - if (isset($post->featured_image)) {
|
|
| 1325 | - $file = $post->featured_image; |
|
| 1326 | - } else {
|
|
| 1327 | - $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
|
|
| 1328 | - } |
|
| 1329 | - } |
|
| 1323 | + if (!$file) {
|
|
| 1324 | + if (isset($post->featured_image)) {
|
|
| 1325 | + $file = $post->featured_image; |
|
| 1326 | + } else {
|
|
| 1327 | + $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
|
|
| 1328 | + } |
|
| 1329 | + } |
|
| 1330 | 1330 | |
| 1331 | - if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
|
| 1332 | - $img_arr = array(); |
|
| 1331 | + if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
|
| 1332 | + $img_arr = array(); |
|
| 1333 | 1333 | |
| 1334 | - $file_info = pathinfo($file); |
|
| 1335 | - $sub_dir = ''; |
|
| 1336 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
|
|
| 1337 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1338 | - } |
|
| 1334 | + $file_info = pathinfo($file); |
|
| 1335 | + $sub_dir = ''; |
|
| 1336 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
|
|
| 1337 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1338 | + } |
|
| 1339 | 1339 | |
| 1340 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
| 1341 | - $uploads_baseurl = $uploads['baseurl']; |
|
| 1342 | - $uploads_path = $uploads['path']; |
|
| 1340 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
| 1341 | + $uploads_baseurl = $uploads['baseurl']; |
|
| 1342 | + $uploads_path = $uploads['path']; |
|
| 1343 | 1343 | |
| 1344 | - $file_name = $file_info['basename']; |
|
| 1344 | + $file_name = $file_info['basename']; |
|
| 1345 | 1345 | |
| 1346 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1347 | - /* |
|
| 1346 | + $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1347 | + /* |
|
| 1348 | 1348 | * Allows the filter of image src for such things as CDN change. |
| 1349 | 1349 | * |
| 1350 | 1350 | * @since 1.5.7 |
@@ -1353,158 +1353,158 @@ discard block |
||
| 1353 | 1353 | * @param string $uploads_url The server upload directory url. |
| 1354 | 1354 | * @param string $uploads_baseurl The uploads dir base url. |
| 1355 | 1355 | */ |
| 1356 | - $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1357 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1358 | - $width = 0; |
|
| 1359 | - $height = 0; |
|
| 1360 | - if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
|
| 1361 | - $imagesize = getimagesize($img_arr['path']); |
|
| 1362 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1363 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1364 | - } |
|
| 1365 | - $img_arr['width'] = $width; |
|
| 1366 | - $img_arr['height'] = $height; |
|
| 1367 | - $img_arr['title'] = $post->post_title; |
|
| 1368 | - } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
|
|
| 1369 | - foreach ($post_images as $image) {
|
|
| 1370 | - return $image; |
|
| 1371 | - } |
|
| 1372 | - } else if ($no_image) {
|
|
| 1373 | - $img_arr = array(); |
|
| 1374 | - |
|
| 1375 | - $default_img = ''; |
|
| 1376 | - if (isset($post->default_category) && $post->default_category) {
|
|
| 1377 | - $default_cat = $post->default_category; |
|
| 1378 | - } else {
|
|
| 1379 | - $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
|
| 1380 | - } |
|
| 1381 | - |
|
| 1382 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1383 | - $default_img = $default_catimg['src']; |
|
| 1384 | - elseif ($no_image) {
|
|
| 1385 | - $default_img = get_option('geodir_listing_no_img');
|
|
| 1386 | - } |
|
| 1387 | - |
|
| 1388 | - if (!empty($default_img)) {
|
|
| 1389 | - $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 1390 | - $uploads_baseurl = $uploads['baseurl']; |
|
| 1391 | - $uploads_path = $uploads['path']; |
|
| 1392 | - |
|
| 1393 | - $img_arr = array(); |
|
| 1394 | - |
|
| 1395 | - $file_info = pathinfo($default_img); |
|
| 1396 | - |
|
| 1397 | - $file_name = $file_info['basename']; |
|
| 1398 | - |
|
| 1399 | - $img_arr['src'] = $default_img; |
|
| 1400 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1401 | - |
|
| 1402 | - $width = 0; |
|
| 1403 | - $height = 0; |
|
| 1404 | - if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
|
| 1405 | - $imagesize = getimagesize($img_arr['path']); |
|
| 1406 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1407 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1408 | - } |
|
| 1409 | - $img_arr['width'] = $width; |
|
| 1410 | - $img_arr['height'] = $height; |
|
| 1411 | - |
|
| 1412 | - $img_arr['title'] = $post->post_title; // add the title to the array |
|
| 1413 | - } |
|
| 1414 | - } |
|
| 1415 | - |
|
| 1416 | - if (!empty($img_arr)) |
|
| 1417 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1418 | - else |
|
| 1419 | - return false; |
|
| 1420 | - } |
|
| 1356 | + $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1357 | + $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1358 | + $width = 0; |
|
| 1359 | + $height = 0; |
|
| 1360 | + if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
|
| 1361 | + $imagesize = getimagesize($img_arr['path']); |
|
| 1362 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1363 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1364 | + } |
|
| 1365 | + $img_arr['width'] = $width; |
|
| 1366 | + $img_arr['height'] = $height; |
|
| 1367 | + $img_arr['title'] = $post->post_title; |
|
| 1368 | + } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
|
|
| 1369 | + foreach ($post_images as $image) {
|
|
| 1370 | + return $image; |
|
| 1371 | + } |
|
| 1372 | + } else if ($no_image) {
|
|
| 1373 | + $img_arr = array(); |
|
| 1374 | + |
|
| 1375 | + $default_img = ''; |
|
| 1376 | + if (isset($post->default_category) && $post->default_category) {
|
|
| 1377 | + $default_cat = $post->default_category; |
|
| 1378 | + } else {
|
|
| 1379 | + $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
|
| 1380 | + } |
|
| 1381 | + |
|
| 1382 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1383 | + $default_img = $default_catimg['src']; |
|
| 1384 | + elseif ($no_image) {
|
|
| 1385 | + $default_img = get_option('geodir_listing_no_img');
|
|
| 1386 | + } |
|
| 1387 | + |
|
| 1388 | + if (!empty($default_img)) {
|
|
| 1389 | + $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 1390 | + $uploads_baseurl = $uploads['baseurl']; |
|
| 1391 | + $uploads_path = $uploads['path']; |
|
| 1392 | + |
|
| 1393 | + $img_arr = array(); |
|
| 1394 | + |
|
| 1395 | + $file_info = pathinfo($default_img); |
|
| 1396 | + |
|
| 1397 | + $file_name = $file_info['basename']; |
|
| 1398 | + |
|
| 1399 | + $img_arr['src'] = $default_img; |
|
| 1400 | + $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1401 | + |
|
| 1402 | + $width = 0; |
|
| 1403 | + $height = 0; |
|
| 1404 | + if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
|
| 1405 | + $imagesize = getimagesize($img_arr['path']); |
|
| 1406 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1407 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1408 | + } |
|
| 1409 | + $img_arr['width'] = $width; |
|
| 1410 | + $img_arr['height'] = $height; |
|
| 1411 | + |
|
| 1412 | + $img_arr['title'] = $post->post_title; // add the title to the array |
|
| 1413 | + } |
|
| 1414 | + } |
|
| 1415 | + |
|
| 1416 | + if (!empty($img_arr)) |
|
| 1417 | + return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1418 | + else |
|
| 1419 | + return false; |
|
| 1420 | + } |
|
| 1421 | 1421 | } |
| 1422 | 1422 | |
| 1423 | 1423 | if (!function_exists('geodir_show_featured_image')) {
|
| 1424 | - /** |
|
| 1425 | - * Gets the post featured image. |
|
| 1426 | - * |
|
| 1427 | - * @since 1.0.0 |
|
| 1428 | - * @package GeoDirectory |
|
| 1429 | - * @param int|string $post_id The post ID. |
|
| 1430 | - * @param string $size Optional. Thumbnail size. Default: thumbnail. |
|
| 1431 | - * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false. |
|
| 1432 | - * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true. |
|
| 1433 | - * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false. |
|
| 1434 | - * @return bool|string Returns image html. |
|
| 1435 | - */ |
|
| 1436 | - function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false) |
|
| 1437 | - {
|
|
| 1438 | - $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage); |
|
| 1439 | - |
|
| 1440 | - $html = geodir_show_image($image, $size, $no_image, false); |
|
| 1441 | - |
|
| 1442 | - if (!empty($html) && $echo) {
|
|
| 1443 | - echo $html; |
|
| 1444 | - } elseif (!empty($html)) {
|
|
| 1445 | - return $html; |
|
| 1446 | - } else |
|
| 1447 | - return false; |
|
| 1448 | - } |
|
| 1424 | + /** |
|
| 1425 | + * Gets the post featured image. |
|
| 1426 | + * |
|
| 1427 | + * @since 1.0.0 |
|
| 1428 | + * @package GeoDirectory |
|
| 1429 | + * @param int|string $post_id The post ID. |
|
| 1430 | + * @param string $size Optional. Thumbnail size. Default: thumbnail. |
|
| 1431 | + * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false. |
|
| 1432 | + * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true. |
|
| 1433 | + * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false. |
|
| 1434 | + * @return bool|string Returns image html. |
|
| 1435 | + */ |
|
| 1436 | + function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false) |
|
| 1437 | + {
|
|
| 1438 | + $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage); |
|
| 1439 | + |
|
| 1440 | + $html = geodir_show_image($image, $size, $no_image, false); |
|
| 1441 | + |
|
| 1442 | + if (!empty($html) && $echo) {
|
|
| 1443 | + echo $html; |
|
| 1444 | + } elseif (!empty($html)) {
|
|
| 1445 | + return $html; |
|
| 1446 | + } else |
|
| 1447 | + return false; |
|
| 1448 | + } |
|
| 1449 | 1449 | } |
| 1450 | 1450 | |
| 1451 | 1451 | if (!function_exists('geodir_get_images')) {
|
| 1452 | - /** |
|
| 1453 | - * Gets the post images. |
|
| 1454 | - * |
|
| 1455 | - * @since 1.0.0 |
|
| 1456 | - * @package GeoDirectory |
|
| 1457 | - * @global object $wpdb WordPress Database object. |
|
| 1458 | - * @param int $post_id The post ID. |
|
| 1459 | - * @param string $img_size Optional. Thumbnail size. |
|
| 1460 | - * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false. |
|
| 1461 | - * @param bool $add_featured Optional. Do you want to include featured images too? Default: true. |
|
| 1462 | - * @param int|string $limit Optional. Number of images. |
|
| 1463 | - * @return array|bool Returns images as an array. Each item is an object. |
|
| 1464 | - */ |
|
| 1465 | - function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '') |
|
| 1466 | - {
|
|
| 1467 | - global $wpdb; |
|
| 1468 | - if ($limit) {
|
|
| 1469 | - $limit_q = " LIMIT $limit "; |
|
| 1470 | - } else {
|
|
| 1471 | - $limit_q = ''; |
|
| 1472 | - } |
|
| 1473 | - $not_featured = ''; |
|
| 1474 | - $sub_dir = ''; |
|
| 1475 | - if (!$add_featured) |
|
| 1476 | - $not_featured = " AND is_featured = 0 "; |
|
| 1477 | - |
|
| 1478 | - $arrImages = $wpdb->get_results( |
|
| 1479 | - $wpdb->prepare( |
|
| 1480 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ", |
|
| 1481 | - array('%image%', $post_id)
|
|
| 1482 | - ) |
|
| 1483 | - ); |
|
| 1484 | - |
|
| 1485 | - $counter = 0; |
|
| 1486 | - $return_arr = array(); |
|
| 1487 | - |
|
| 1488 | - if (!empty($arrImages)) {
|
|
| 1489 | - foreach ($arrImages as $attechment) {
|
|
| 1490 | - |
|
| 1491 | - $img_arr = array(); |
|
| 1492 | - $img_arr['id'] = $attechment->ID; |
|
| 1493 | - $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0; |
|
| 1494 | - |
|
| 1495 | - $file_info = pathinfo($attechment->file); |
|
| 1496 | - |
|
| 1497 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 1498 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1499 | - |
|
| 1500 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
| 1501 | - $uploads_baseurl = $uploads['baseurl']; |
|
| 1502 | - $uploads_path = $uploads['path']; |
|
| 1503 | - |
|
| 1504 | - $file_name = $file_info['basename']; |
|
| 1505 | - |
|
| 1506 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1507 | - /* |
|
| 1452 | + /** |
|
| 1453 | + * Gets the post images. |
|
| 1454 | + * |
|
| 1455 | + * @since 1.0.0 |
|
| 1456 | + * @package GeoDirectory |
|
| 1457 | + * @global object $wpdb WordPress Database object. |
|
| 1458 | + * @param int $post_id The post ID. |
|
| 1459 | + * @param string $img_size Optional. Thumbnail size. |
|
| 1460 | + * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false. |
|
| 1461 | + * @param bool $add_featured Optional. Do you want to include featured images too? Default: true. |
|
| 1462 | + * @param int|string $limit Optional. Number of images. |
|
| 1463 | + * @return array|bool Returns images as an array. Each item is an object. |
|
| 1464 | + */ |
|
| 1465 | + function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '') |
|
| 1466 | + {
|
|
| 1467 | + global $wpdb; |
|
| 1468 | + if ($limit) {
|
|
| 1469 | + $limit_q = " LIMIT $limit "; |
|
| 1470 | + } else {
|
|
| 1471 | + $limit_q = ''; |
|
| 1472 | + } |
|
| 1473 | + $not_featured = ''; |
|
| 1474 | + $sub_dir = ''; |
|
| 1475 | + if (!$add_featured) |
|
| 1476 | + $not_featured = " AND is_featured = 0 "; |
|
| 1477 | + |
|
| 1478 | + $arrImages = $wpdb->get_results( |
|
| 1479 | + $wpdb->prepare( |
|
| 1480 | + "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ", |
|
| 1481 | + array('%image%', $post_id)
|
|
| 1482 | + ) |
|
| 1483 | + ); |
|
| 1484 | + |
|
| 1485 | + $counter = 0; |
|
| 1486 | + $return_arr = array(); |
|
| 1487 | + |
|
| 1488 | + if (!empty($arrImages)) {
|
|
| 1489 | + foreach ($arrImages as $attechment) {
|
|
| 1490 | + |
|
| 1491 | + $img_arr = array(); |
|
| 1492 | + $img_arr['id'] = $attechment->ID; |
|
| 1493 | + $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0; |
|
| 1494 | + |
|
| 1495 | + $file_info = pathinfo($attechment->file); |
|
| 1496 | + |
|
| 1497 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 1498 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1499 | + |
|
| 1500 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
| 1501 | + $uploads_baseurl = $uploads['baseurl']; |
|
| 1502 | + $uploads_path = $uploads['path']; |
|
| 1503 | + |
|
| 1504 | + $file_name = $file_info['basename']; |
|
| 1505 | + |
|
| 1506 | + $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1507 | + /* |
|
| 1508 | 1508 | * Allows the filter of image src for such things as CDN change. |
| 1509 | 1509 | * |
| 1510 | 1510 | * @since 1.5.7 |
@@ -1513,532 +1513,532 @@ discard block |
||
| 1513 | 1513 | * @param string $uploads_url The server upload directory url. |
| 1514 | 1514 | * @param string $uploads_baseurl The uploads dir base url. |
| 1515 | 1515 | */ |
| 1516 | - $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1517 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1518 | - $width = 0; |
|
| 1519 | - $height = 0; |
|
| 1520 | - if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
|
| 1521 | - $imagesize = getimagesize($img_arr['path']); |
|
| 1522 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1523 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1524 | - } |
|
| 1525 | - $img_arr['width'] = $width; |
|
| 1526 | - $img_arr['height'] = $height; |
|
| 1527 | - |
|
| 1528 | - $img_arr['file'] = $file_name; // add the title to the array |
|
| 1529 | - $img_arr['title'] = $attechment->title; // add the title to the array |
|
| 1530 | - $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array |
|
| 1531 | - $img_arr['content'] = $attechment->content; // add the description to the array |
|
| 1532 | - $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1. |
|
| 1533 | - |
|
| 1534 | - $return_arr[] = (object)$img_arr; |
|
| 1535 | - |
|
| 1536 | - $counter++; |
|
| 1537 | - } |
|
| 1538 | - //return (object)$return_arr; |
|
| 1539 | - /** |
|
| 1540 | - * Filter the images array so things can be changed. |
|
| 1541 | - * |
|
| 1542 | - * @since 1.6.20 |
|
| 1543 | - * @param array $return_arr The array of image objects. |
|
| 1544 | - */ |
|
| 1545 | - return apply_filters('geodir_get_images_arr',$return_arr);
|
|
| 1546 | - } else if ($no_images) {
|
|
| 1547 | - $default_img = ''; |
|
| 1548 | - $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
|
| 1549 | - $post_type = get_post_type($post_id); |
|
| 1550 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1551 | - $default_img = $default_catimg['src']; |
|
| 1552 | - elseif ($no_images) {
|
|
| 1553 | - $default_img = get_option('geodir_listing_no_img');
|
|
| 1554 | - } |
|
| 1555 | - |
|
| 1556 | - if (!empty($default_img)) {
|
|
| 1557 | - $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 1516 | + $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1517 | + $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1518 | + $width = 0; |
|
| 1519 | + $height = 0; |
|
| 1520 | + if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
|
| 1521 | + $imagesize = getimagesize($img_arr['path']); |
|
| 1522 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1523 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1524 | + } |
|
| 1525 | + $img_arr['width'] = $width; |
|
| 1526 | + $img_arr['height'] = $height; |
|
| 1527 | + |
|
| 1528 | + $img_arr['file'] = $file_name; // add the title to the array |
|
| 1529 | + $img_arr['title'] = $attechment->title; // add the title to the array |
|
| 1530 | + $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array |
|
| 1531 | + $img_arr['content'] = $attechment->content; // add the description to the array |
|
| 1532 | + $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1. |
|
| 1533 | + |
|
| 1534 | + $return_arr[] = (object)$img_arr; |
|
| 1535 | + |
|
| 1536 | + $counter++; |
|
| 1537 | + } |
|
| 1538 | + //return (object)$return_arr; |
|
| 1539 | + /** |
|
| 1540 | + * Filter the images array so things can be changed. |
|
| 1541 | + * |
|
| 1542 | + * @since 1.6.20 |
|
| 1543 | + * @param array $return_arr The array of image objects. |
|
| 1544 | + */ |
|
| 1545 | + return apply_filters('geodir_get_images_arr',$return_arr);
|
|
| 1546 | + } else if ($no_images) {
|
|
| 1547 | + $default_img = ''; |
|
| 1548 | + $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
|
| 1549 | + $post_type = get_post_type($post_id); |
|
| 1550 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1551 | + $default_img = $default_catimg['src']; |
|
| 1552 | + elseif ($no_images) {
|
|
| 1553 | + $default_img = get_option('geodir_listing_no_img');
|
|
| 1554 | + } |
|
| 1555 | + |
|
| 1556 | + if (!empty($default_img)) {
|
|
| 1557 | + $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 1558 | 1558 | |
| 1559 | - $image_path = $default_img; |
|
| 1560 | - if (!path_is_absolute($image_path)) {
|
|
| 1561 | - $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path); |
|
| 1562 | - } |
|
| 1563 | - |
|
| 1564 | - $file_info = pathinfo($default_img); |
|
| 1565 | - $file_name = $file_info['basename']; |
|
| 1566 | - |
|
| 1567 | - $width = ''; |
|
| 1568 | - $height = ''; |
|
| 1569 | - if (is_file($image_path) && file_exists($image_path)) {
|
|
| 1570 | - $imagesize = getimagesize($image_path); |
|
| 1571 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1572 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1573 | - } |
|
| 1559 | + $image_path = $default_img; |
|
| 1560 | + if (!path_is_absolute($image_path)) {
|
|
| 1561 | + $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path); |
|
| 1562 | + } |
|
| 1563 | + |
|
| 1564 | + $file_info = pathinfo($default_img); |
|
| 1565 | + $file_name = $file_info['basename']; |
|
| 1566 | + |
|
| 1567 | + $width = ''; |
|
| 1568 | + $height = ''; |
|
| 1569 | + if (is_file($image_path) && file_exists($image_path)) {
|
|
| 1570 | + $imagesize = getimagesize($image_path); |
|
| 1571 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1572 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1573 | + } |
|
| 1574 | 1574 | |
| 1575 | - $img_arr = array(); |
|
| 1576 | - $img_arr['src'] = $default_img; |
|
| 1577 | - $img_arr['path'] = $image_path; |
|
| 1578 | - $img_arr['width'] = $width; |
|
| 1579 | - $img_arr['height'] = $height; |
|
| 1580 | - $img_arr['file'] = $file_name; // add the title to the array |
|
| 1581 | - $img_arr['title'] = $file_info['filename']; // add the title to the array |
|
| 1582 | - $img_arr['content'] = $file_info['filename']; // add the description to the array |
|
| 1583 | - |
|
| 1584 | - $return_arr[] = (object)$img_arr; |
|
| 1585 | - |
|
| 1586 | - /** |
|
| 1587 | - * Filter the images array so things can be changed. |
|
| 1588 | - * |
|
| 1589 | - * @since 1.6.20 |
|
| 1590 | - * @param array $return_arr The array of image objects. |
|
| 1591 | - */ |
|
| 1592 | - return apply_filters('geodir_get_images_arr',$return_arr);
|
|
| 1593 | - } else |
|
| 1594 | - return false; |
|
| 1595 | - } |
|
| 1596 | - } |
|
| 1575 | + $img_arr = array(); |
|
| 1576 | + $img_arr['src'] = $default_img; |
|
| 1577 | + $img_arr['path'] = $image_path; |
|
| 1578 | + $img_arr['width'] = $width; |
|
| 1579 | + $img_arr['height'] = $height; |
|
| 1580 | + $img_arr['file'] = $file_name; // add the title to the array |
|
| 1581 | + $img_arr['title'] = $file_info['filename']; // add the title to the array |
|
| 1582 | + $img_arr['content'] = $file_info['filename']; // add the description to the array |
|
| 1583 | + |
|
| 1584 | + $return_arr[] = (object)$img_arr; |
|
| 1585 | + |
|
| 1586 | + /** |
|
| 1587 | + * Filter the images array so things can be changed. |
|
| 1588 | + * |
|
| 1589 | + * @since 1.6.20 |
|
| 1590 | + * @param array $return_arr The array of image objects. |
|
| 1591 | + */ |
|
| 1592 | + return apply_filters('geodir_get_images_arr',$return_arr);
|
|
| 1593 | + } else |
|
| 1594 | + return false; |
|
| 1595 | + } |
|
| 1596 | + } |
|
| 1597 | 1597 | } |
| 1598 | 1598 | |
| 1599 | 1599 | if (!function_exists('geodir_show_image')) {
|
| 1600 | - /** |
|
| 1601 | - * Show image using image details. |
|
| 1602 | - * |
|
| 1603 | - * @since 1.0.0 |
|
| 1604 | - * @package GeoDirectory |
|
| 1605 | - * @param array|object $request Image info either as an array or object. |
|
| 1606 | - * @param string $size Optional. Thumbnail size. Default: thumbnail. |
|
| 1607 | - * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false. |
|
| 1608 | - * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true. |
|
| 1609 | - * @return bool|string Returns image html. |
|
| 1610 | - */ |
|
| 1611 | - function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true) |
|
| 1612 | - {
|
|
| 1613 | - $image = new stdClass(); |
|
| 1614 | - |
|
| 1615 | - $html = ''; |
|
| 1616 | - if (!empty($request)) {
|
|
| 1617 | - if (!is_object($request)){
|
|
| 1618 | - $request = (object)$request; |
|
| 1619 | - } |
|
| 1620 | - |
|
| 1621 | - if (isset($request->src) && !isset($request->path)) {
|
|
| 1622 | - $request->path = $request->src; |
|
| 1623 | - } |
|
| 1624 | - |
|
| 1625 | - /* |
|
| 1600 | + /** |
|
| 1601 | + * Show image using image details. |
|
| 1602 | + * |
|
| 1603 | + * @since 1.0.0 |
|
| 1604 | + * @package GeoDirectory |
|
| 1605 | + * @param array|object $request Image info either as an array or object. |
|
| 1606 | + * @param string $size Optional. Thumbnail size. Default: thumbnail. |
|
| 1607 | + * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false. |
|
| 1608 | + * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true. |
|
| 1609 | + * @return bool|string Returns image html. |
|
| 1610 | + */ |
|
| 1611 | + function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true) |
|
| 1612 | + {
|
|
| 1613 | + $image = new stdClass(); |
|
| 1614 | + |
|
| 1615 | + $html = ''; |
|
| 1616 | + if (!empty($request)) {
|
|
| 1617 | + if (!is_object($request)){
|
|
| 1618 | + $request = (object)$request; |
|
| 1619 | + } |
|
| 1620 | + |
|
| 1621 | + if (isset($request->src) && !isset($request->path)) {
|
|
| 1622 | + $request->path = $request->src; |
|
| 1623 | + } |
|
| 1624 | + |
|
| 1625 | + /* |
|
| 1626 | 1626 | * getimagesize() works faster from path than url so we try and get path if we can. |
| 1627 | 1627 | */ |
| 1628 | - $upload_dir = wp_upload_dir(); |
|
| 1629 | - $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
|
|
| 1630 | - $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
|
|
| 1631 | - if (strpos($img_no_http, $upload_no_http) !== false) {
|
|
| 1632 | - $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path); |
|
| 1633 | - } |
|
| 1628 | + $upload_dir = wp_upload_dir(); |
|
| 1629 | + $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
|
|
| 1630 | + $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
|
|
| 1631 | + if (strpos($img_no_http, $upload_no_http) !== false) {
|
|
| 1632 | + $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path); |
|
| 1633 | + } |
|
| 1634 | 1634 | |
| 1635 | - $width = 0; |
|
| 1636 | - $height = 0; |
|
| 1637 | - if (is_file($request->path) && file_exists($request->path)) {
|
|
| 1638 | - $imagesize = getimagesize($request->path); |
|
| 1639 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1640 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1641 | - } |
|
| 1642 | - |
|
| 1643 | - |
|
| 1644 | - $image->src = $request->src; |
|
| 1645 | - $image->width = $width; |
|
| 1646 | - $image->height = $height; |
|
| 1647 | - $image->title = isset($request->title) ? $request->title : ''; |
|
| 1648 | - |
|
| 1649 | - $max_size = (object)geodir_get_imagesize($size); |
|
| 1650 | - |
|
| 1651 | - if (!is_wp_error($max_size)) {
|
|
| 1652 | - if ($image->width) {
|
|
| 1653 | - if ($image->height >= $image->width) {
|
|
| 1654 | - $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2); |
|
| 1655 | - } else if ($image->width < ($max_size->h)) {
|
|
| 1656 | - $width_per = round((($image->width / $max_size->w) * 100), 2); |
|
| 1657 | - } else |
|
| 1658 | - $width_per = 100; |
|
| 1659 | - } |
|
| 1660 | - |
|
| 1661 | - if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
|
|
| 1662 | - $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>'; |
|
| 1663 | - } else {
|
|
| 1664 | - if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
|
|
| 1665 | - $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');" title="'.$image->title.'" aria-label="'.$image->title.'" ></div>'; |
|
| 1666 | - }else{
|
|
| 1667 | - $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" title="'.$image->title.'" aria-label="'.$image->title.'"></div>';
|
|
| 1668 | - } |
|
| 1669 | - |
|
| 1670 | - } |
|
| 1671 | - } |
|
| 1672 | - } |
|
| 1673 | - |
|
| 1674 | - if (!empty($html) && $echo) {
|
|
| 1675 | - echo $html; |
|
| 1676 | - } elseif (!empty($html)) {
|
|
| 1677 | - return $html; |
|
| 1678 | - } else |
|
| 1679 | - return false; |
|
| 1680 | - } |
|
| 1681 | -} |
|
| 1635 | + $width = 0; |
|
| 1636 | + $height = 0; |
|
| 1637 | + if (is_file($request->path) && file_exists($request->path)) {
|
|
| 1638 | + $imagesize = getimagesize($request->path); |
|
| 1639 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : ''; |
|
| 1640 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : ''; |
|
| 1641 | + } |
|
| 1682 | 1642 | |
| 1683 | -if (!function_exists('geodir_set_post_terms')) {
|
|
| 1684 | - /** |
|
| 1685 | - * Set post Categories. |
|
| 1686 | - * |
|
| 1687 | - * @since 1.0.0 |
|
| 1688 | - * @package GeoDirectory |
|
| 1689 | - * @global object $wpdb WordPress Database object. |
|
| 1690 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1691 | - * @param int $post_id The post ID. |
|
| 1692 | - * @param array $terms An array of term objects. |
|
| 1693 | - * @param array $tt_ids An array of term taxonomy IDs. |
|
| 1694 | - * @param string $taxonomy Taxonomy slug. |
|
| 1695 | - */ |
|
| 1696 | - function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy) |
|
| 1697 | - {
|
|
| 1698 | - global $wpdb, $plugin_prefix; |
|
| 1699 | 1643 | |
| 1700 | - $post_type = get_post_type($post_id); |
|
| 1644 | + $image->src = $request->src; |
|
| 1645 | + $image->width = $width; |
|
| 1646 | + $image->height = $height; |
|
| 1647 | + $image->title = isset($request->title) ? $request->title : ''; |
|
| 1701 | 1648 | |
| 1702 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1649 | + $max_size = (object)geodir_get_imagesize($size); |
|
| 1703 | 1650 | |
| 1704 | - if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
|
|
| 1651 | + if (!is_wp_error($max_size)) {
|
|
| 1652 | + if ($image->width) {
|
|
| 1653 | + if ($image->height >= $image->width) {
|
|
| 1654 | + $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2); |
|
| 1655 | + } else if ($image->width < ($max_size->h)) {
|
|
| 1656 | + $width_per = round((($image->width / $max_size->w) * 100), 2); |
|
| 1657 | + } else |
|
| 1658 | + $width_per = 100; |
|
| 1659 | + } |
|
| 1705 | 1660 | |
| 1706 | - if ($taxonomy == $post_type . '_tags') {
|
|
| 1707 | - if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
|
| 1708 | - geodir_save_post_meta($post_id, 'post_tags', $terms); |
|
| 1709 | - } |
|
| 1710 | - } elseif ($taxonomy == $post_type . 'category') {
|
|
| 1711 | - $srcharr = array('"', '\\');
|
|
| 1712 | - $replarr = array(""", '');
|
|
| 1661 | + if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
|
|
| 1662 | + $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>'; |
|
| 1663 | + } else {
|
|
| 1664 | + if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
|
|
| 1665 | + $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');" title="'.$image->title.'" aria-label="'.$image->title.'" ></div>'; |
|
| 1666 | + }else{
|
|
| 1667 | + $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" title="'.$image->title.'" aria-label="'.$image->title.'"></div>';
|
|
| 1668 | + } |
|
| 1713 | 1669 | |
| 1714 | - $post_obj = get_post($post_id); |
|
| 1670 | + } |
|
| 1671 | + } |
|
| 1672 | + } |
|
| 1673 | + |
|
| 1674 | + if (!empty($html) && $echo) {
|
|
| 1675 | + echo $html; |
|
| 1676 | + } elseif (!empty($html)) {
|
|
| 1677 | + return $html; |
|
| 1678 | + } else |
|
| 1679 | + return false; |
|
| 1680 | + } |
|
| 1681 | +} |
|
| 1715 | 1682 | |
| 1716 | - $cat_ids = array('0');
|
|
| 1717 | - if (is_array($tt_ids)) |
|
| 1718 | - $cat_ids = $tt_ids; |
|
| 1683 | +if (!function_exists('geodir_set_post_terms')) {
|
|
| 1684 | + /** |
|
| 1685 | + * Set post Categories. |
|
| 1686 | + * |
|
| 1687 | + * @since 1.0.0 |
|
| 1688 | + * @package GeoDirectory |
|
| 1689 | + * @global object $wpdb WordPress Database object. |
|
| 1690 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1691 | + * @param int $post_id The post ID. |
|
| 1692 | + * @param array $terms An array of term objects. |
|
| 1693 | + * @param array $tt_ids An array of term taxonomy IDs. |
|
| 1694 | + * @param string $taxonomy Taxonomy slug. |
|
| 1695 | + */ |
|
| 1696 | + function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy) |
|
| 1697 | + {
|
|
| 1698 | + global $wpdb, $plugin_prefix; |
|
| 1699 | + |
|
| 1700 | + $post_type = get_post_type($post_id); |
|
| 1701 | + |
|
| 1702 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1703 | + |
|
| 1704 | + if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
|
|
| 1705 | + |
|
| 1706 | + if ($taxonomy == $post_type . '_tags') {
|
|
| 1707 | + if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
|
| 1708 | + geodir_save_post_meta($post_id, 'post_tags', $terms); |
|
| 1709 | + } |
|
| 1710 | + } elseif ($taxonomy == $post_type . 'category') {
|
|
| 1711 | + $srcharr = array('"', '\\');
|
|
| 1712 | + $replarr = array(""", '');
|
|
| 1719 | 1713 | |
| 1714 | + $post_obj = get_post($post_id); |
|
| 1720 | 1715 | |
| 1721 | - if (!empty($cat_ids)) {
|
|
| 1722 | - $cat_ids_array = $cat_ids; |
|
| 1723 | - $cat_ids_length = count($cat_ids_array); |
|
| 1724 | - $cat_ids_format = array_fill(0, $cat_ids_length, '%d'); |
|
| 1725 | - $format = implode(',', $cat_ids_format);
|
|
| 1716 | + $cat_ids = array('0');
|
|
| 1717 | + if (is_array($tt_ids)) |
|
| 1718 | + $cat_ids = $tt_ids; |
|
| 1726 | 1719 | |
| 1727 | - $cat_ids_array_del = $cat_ids_array; |
|
| 1728 | - $cat_ids_array_del[] = $post_id; |
|
| 1729 | 1720 | |
| 1730 | - $wpdb->get_var( |
|
| 1731 | - $wpdb->prepare( |
|
| 1732 | - "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
| 1733 | - $cat_ids_array_del |
|
| 1734 | - ) |
|
| 1735 | - ); |
|
| 1721 | + if (!empty($cat_ids)) {
|
|
| 1722 | + $cat_ids_array = $cat_ids; |
|
| 1723 | + $cat_ids_length = count($cat_ids_array); |
|
| 1724 | + $cat_ids_format = array_fill(0, $cat_ids_length, '%d'); |
|
| 1725 | + $format = implode(',', $cat_ids_format);
|
|
| 1736 | 1726 | |
| 1727 | + $cat_ids_array_del = $cat_ids_array; |
|
| 1728 | + $cat_ids_array_del[] = $post_id; |
|
| 1737 | 1729 | |
| 1738 | - $post_term = $wpdb->get_col( |
|
| 1739 | - $wpdb->prepare( |
|
| 1740 | - "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
| 1741 | - $cat_ids_array |
|
| 1742 | - ) |
|
| 1743 | - ); |
|
| 1730 | + $wpdb->get_var( |
|
| 1731 | + $wpdb->prepare( |
|
| 1732 | + "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
| 1733 | + $cat_ids_array_del |
|
| 1734 | + ) |
|
| 1735 | + ); |
|
| 1744 | 1736 | |
| 1745 | - } |
|
| 1746 | 1737 | |
| 1747 | - $post_marker_json = ''; |
|
| 1738 | + $post_term = $wpdb->get_col( |
|
| 1739 | + $wpdb->prepare( |
|
| 1740 | + "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
| 1741 | + $cat_ids_array |
|
| 1742 | + ) |
|
| 1743 | + ); |
|
| 1744 | + |
|
| 1745 | + } |
|
| 1748 | 1746 | |
| 1749 | - if (!empty($post_term)): |
|
| 1747 | + $post_marker_json = ''; |
|
| 1750 | 1748 | |
| 1751 | - foreach ($post_term as $cat_id): |
|
| 1749 | + if (!empty($post_term)): |
|
| 1752 | 1750 | |
| 1753 | - $term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type); |
|
| 1754 | - $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : ''; |
|
| 1751 | + foreach ($post_term as $cat_id): |
|
| 1755 | 1752 | |
| 1756 | - $post_title = $post_obj->title; |
|
| 1757 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
| 1753 | + $term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type); |
|
| 1754 | + $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : ''; |
|
| 1758 | 1755 | |
| 1759 | - $lat = geodir_get_post_meta($post_id, 'post_latitude', true); |
|
| 1760 | - $lng = geodir_get_post_meta($post_id, 'post_longitude', true); |
|
| 1756 | + $post_title = $post_obj->title; |
|
| 1757 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
| 1761 | 1758 | |
| 1762 | - $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
|
|
| 1763 | - $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true); |
|
| 1759 | + $lat = geodir_get_post_meta($post_id, 'post_latitude', true); |
|
| 1760 | + $lng = geodir_get_post_meta($post_id, 'post_longitude', true); |
|
| 1764 | 1761 | |
| 1765 | - $json = '{';
|
|
| 1766 | - $json .= '"id":"' . $post_id . '",'; |
|
| 1767 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
| 1768 | - $json .= '"long_pos": "' . $lng . '",'; |
|
| 1769 | - $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",'; |
|
| 1770 | - $json .= '"icon":"' . $term_icon . '",'; |
|
| 1771 | - $json .= '"group":"catgroup' . $cat_id . '"'; |
|
| 1772 | - $json .= '}'; |
|
| 1762 | + $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
|
|
| 1763 | + $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true); |
|
| 1773 | 1764 | |
| 1765 | + $json = '{';
|
|
| 1766 | + $json .= '"id":"' . $post_id . '",'; |
|
| 1767 | + $json .= '"lat_pos": "' . $lat . '",'; |
|
| 1768 | + $json .= '"long_pos": "' . $lng . '",'; |
|
| 1769 | + $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",'; |
|
| 1770 | + $json .= '"icon":"' . $term_icon . '",'; |
|
| 1771 | + $json .= '"group":"catgroup' . $cat_id . '"'; |
|
| 1772 | + $json .= '}'; |
|
| 1774 | 1773 | |
| 1775 | - if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) |
|
| 1776 | - $post_marker_json = $json; |
|
| 1777 | 1774 | |
| 1775 | + if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) |
|
| 1776 | + $post_marker_json = $json; |
|
| 1778 | 1777 | |
| 1779 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
|
|
| 1780 | 1778 | |
| 1781 | - $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
|
|
| 1779 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
|
|
| 1780 | + |
|
| 1781 | + $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
|
|
| 1782 | 1782 | post_title = %s, |
| 1783 | 1783 | json = %s |
| 1784 | 1784 | WHERE post_id = %d AND cat_id = %d ", |
| 1785 | - array($post_title, $json, $post_id, $cat_id)); |
|
| 1785 | + array($post_title, $json, $post_id, $cat_id)); |
|
| 1786 | 1786 | |
| 1787 | - } else {
|
|
| 1787 | + } else {
|
|
| 1788 | 1788 | |
| 1789 | - $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
|
|
| 1789 | + $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
|
|
| 1790 | 1790 | post_id = %d, |
| 1791 | 1791 | post_title = %s, |
| 1792 | 1792 | cat_id = %d, |
| 1793 | 1793 | json = %s", |
| 1794 | - array($post_id, $post_title, $cat_id, $json)); |
|
| 1794 | + array($post_id, $post_title, $cat_id, $json)); |
|
| 1795 | 1795 | |
| 1796 | - } |
|
| 1796 | + } |
|
| 1797 | 1797 | |
| 1798 | - $wpdb->query($json_query); |
|
| 1798 | + $wpdb->query($json_query); |
|
| 1799 | 1799 | |
| 1800 | - endforeach; |
|
| 1800 | + endforeach; |
|
| 1801 | 1801 | |
| 1802 | - endif; |
|
| 1802 | + endif; |
|
| 1803 | 1803 | |
| 1804 | - if (!empty($post_term) && is_array($post_term)) {
|
|
| 1805 | - $categories = implode(',', $post_term);
|
|
| 1804 | + if (!empty($post_term) && is_array($post_term)) {
|
|
| 1805 | + $categories = implode(',', $post_term);
|
|
| 1806 | 1806 | |
| 1807 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
| 1807 | + if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
| 1808 | 1808 | |
| 1809 | - if (empty($post_marker_json)) |
|
| 1810 | - $post_marker_json = isset($json) ? $json : ''; |
|
| 1809 | + if (empty($post_marker_json)) |
|
| 1810 | + $post_marker_json = isset($json) ? $json : ''; |
|
| 1811 | 1811 | |
| 1812 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 1812 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 1813 | 1813 | |
| 1814 | - $wpdb->query( |
|
| 1815 | - $wpdb->prepare( |
|
| 1816 | - "UPDATE " . $table . " SET |
|
| 1814 | + $wpdb->query( |
|
| 1815 | + $wpdb->prepare( |
|
| 1816 | + "UPDATE " . $table . " SET |
|
| 1817 | 1817 | " . $taxonomy . " = %s, |
| 1818 | 1818 | marker_json = %s |
| 1819 | 1819 | where post_id = %d", |
| 1820 | - array($categories, $post_marker_json, $post_id) |
|
| 1821 | - ) |
|
| 1822 | - ); |
|
| 1820 | + array($categories, $post_marker_json, $post_id) |
|
| 1821 | + ) |
|
| 1822 | + ); |
|
| 1823 | 1823 | |
| 1824 | - if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
|
|
| 1824 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
|
|
| 1825 | 1825 | |
| 1826 | - $categories = trim($categories, ','); |
|
| 1826 | + $categories = trim($categories, ','); |
|
| 1827 | 1827 | |
| 1828 | - if ($categories) {
|
|
| 1828 | + if ($categories) {
|
|
| 1829 | 1829 | |
| 1830 | - $categories = explode(',', $categories);
|
|
| 1830 | + $categories = explode(',', $categories);
|
|
| 1831 | 1831 | |
| 1832 | - $default_category = geodir_get_post_meta($post_id, 'default_category', true); |
|
| 1832 | + $default_category = geodir_get_post_meta($post_id, 'default_category', true); |
|
| 1833 | 1833 | |
| 1834 | - if (!in_array($default_category, $categories)) {
|
|
| 1834 | + if (!in_array($default_category, $categories)) {
|
|
| 1835 | 1835 | |
| 1836 | - $wpdb->query( |
|
| 1837 | - $wpdb->prepare( |
|
| 1838 | - "UPDATE " . $table . " SET |
|
| 1836 | + $wpdb->query( |
|
| 1837 | + $wpdb->prepare( |
|
| 1838 | + "UPDATE " . $table . " SET |
|
| 1839 | 1839 | default_category = %s |
| 1840 | 1840 | where post_id = %d", |
| 1841 | - array($categories[0], $post_id) |
|
| 1842 | - ) |
|
| 1843 | - ); |
|
| 1841 | + array($categories[0], $post_id) |
|
| 1842 | + ) |
|
| 1843 | + ); |
|
| 1844 | 1844 | |
| 1845 | - $default_category = $categories[0]; |
|
| 1845 | + $default_category = $categories[0]; |
|
| 1846 | 1846 | |
| 1847 | - } |
|
| 1847 | + } |
|
| 1848 | 1848 | |
| 1849 | - if ($default_category == '') |
|
| 1850 | - $default_category = $categories[0]; |
|
| 1849 | + if ($default_category == '') |
|
| 1850 | + $default_category = $categories[0]; |
|
| 1851 | 1851 | |
| 1852 | - geodir_set_postcat_structure($post_id, $taxonomy, $default_category, ''); |
|
| 1852 | + geodir_set_postcat_structure($post_id, $taxonomy, $default_category, ''); |
|
| 1853 | 1853 | |
| 1854 | - } |
|
| 1854 | + } |
|
| 1855 | 1855 | |
| 1856 | - } |
|
| 1856 | + } |
|
| 1857 | 1857 | |
| 1858 | 1858 | |
| 1859 | - } else {
|
|
| 1859 | + } else {
|
|
| 1860 | 1860 | |
| 1861 | - $wpdb->query( |
|
| 1862 | - $wpdb->prepare( |
|
| 1863 | - "INSERT INTO " . $table . " SET |
|
| 1861 | + $wpdb->query( |
|
| 1862 | + $wpdb->prepare( |
|
| 1863 | + "INSERT INTO " . $table . " SET |
|
| 1864 | 1864 | post_id = %d, |
| 1865 | 1865 | " . $taxonomy . " = %s, |
| 1866 | 1866 | marker_json = %s ", |
| 1867 | 1867 | |
| 1868 | - array($post_id, $categories, $post_marker_json) |
|
| 1869 | - ) |
|
| 1870 | - ); |
|
| 1871 | - } |
|
| 1872 | - } |
|
| 1873 | - } |
|
| 1874 | - } |
|
| 1875 | - } |
|
| 1868 | + array($post_id, $categories, $post_marker_json) |
|
| 1869 | + ) |
|
| 1870 | + ); |
|
| 1871 | + } |
|
| 1872 | + } |
|
| 1873 | + } |
|
| 1874 | + } |
|
| 1875 | + } |
|
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | 1878 | if (!function_exists('geodir_get_infowindow_html')) {
|
| 1879 | - /** |
|
| 1880 | - * Set post Map Marker info html. |
|
| 1881 | - * |
|
| 1882 | - * @since 1.0.0 |
|
| 1883 | - * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before". |
|
| 1884 | - * @since 1.6.16 Changes for disable review stars for certain post type. |
|
| 1885 | - * @since 1.6.18 Fix: Map marker not showing custom fields in bubble info. |
|
| 1886 | - * @package GeoDirectory |
|
| 1887 | - * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 1888 | - * @global object $gd_session GeoDirectory Session object. |
|
| 1889 | - * @param object $postinfo_obj The post details object. |
|
| 1890 | - * @param string $post_preview Is this a post preview?. |
|
| 1891 | - * @global object $post WordPress Post object. |
|
| 1892 | - * @return mixed|string|void |
|
| 1893 | - */ |
|
| 1894 | - function geodir_get_infowindow_html($postinfo_obj, $post_preview = '') {
|
|
| 1895 | - global $preview, $post, $gd_session; |
|
| 1896 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 1897 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 1898 | - |
|
| 1899 | - if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
|
|
| 1900 | - $ID = ''; |
|
| 1901 | - $plink = ''; |
|
| 1902 | - |
|
| 1903 | - if (isset($postinfo_obj->pid)) {
|
|
| 1904 | - $ID = $postinfo_obj->pid; |
|
| 1905 | - $plink = get_permalink($ID); |
|
| 1906 | - } |
|
| 1907 | - |
|
| 1908 | - $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title)); |
|
| 1909 | - $lat = $postinfo_obj->post_latitude; |
|
| 1910 | - $lng = $postinfo_obj->post_longitude; |
|
| 1911 | - } else {
|
|
| 1912 | - $ID = $postinfo_obj->post_id; |
|
| 1913 | - $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan |
|
| 1914 | - $title = wp_specialchars_decode($title); // Fixed #post-320722 on 2016-12-08 |
|
| 1915 | - $plink = get_permalink($ID); |
|
| 1916 | - $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true)); |
|
| 1917 | - $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true)); |
|
| 1918 | - } |
|
| 1879 | + /** |
|
| 1880 | + * Set post Map Marker info html. |
|
| 1881 | + * |
|
| 1882 | + * @since 1.0.0 |
|
| 1883 | + * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before". |
|
| 1884 | + * @since 1.6.16 Changes for disable review stars for certain post type. |
|
| 1885 | + * @since 1.6.18 Fix: Map marker not showing custom fields in bubble info. |
|
| 1886 | + * @package GeoDirectory |
|
| 1887 | + * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 1888 | + * @global object $gd_session GeoDirectory Session object. |
|
| 1889 | + * @param object $postinfo_obj The post details object. |
|
| 1890 | + * @param string $post_preview Is this a post preview?. |
|
| 1891 | + * @global object $post WordPress Post object. |
|
| 1892 | + * @return mixed|string|void |
|
| 1893 | + */ |
|
| 1894 | + function geodir_get_infowindow_html($postinfo_obj, $post_preview = '') {
|
|
| 1895 | + global $preview, $post, $gd_session; |
|
| 1896 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 1897 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 1898 | + |
|
| 1899 | + if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
|
|
| 1900 | + $ID = ''; |
|
| 1901 | + $plink = ''; |
|
| 1902 | + |
|
| 1903 | + if (isset($postinfo_obj->pid)) {
|
|
| 1904 | + $ID = $postinfo_obj->pid; |
|
| 1905 | + $plink = get_permalink($ID); |
|
| 1906 | + } |
|
| 1907 | + |
|
| 1908 | + $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title)); |
|
| 1909 | + $lat = $postinfo_obj->post_latitude; |
|
| 1910 | + $lng = $postinfo_obj->post_longitude; |
|
| 1911 | + } else {
|
|
| 1912 | + $ID = $postinfo_obj->post_id; |
|
| 1913 | + $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan |
|
| 1914 | + $title = wp_specialchars_decode($title); // Fixed #post-320722 on 2016-12-08 |
|
| 1915 | + $plink = get_permalink($ID); |
|
| 1916 | + $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true)); |
|
| 1917 | + $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true)); |
|
| 1918 | + } |
|
| 1919 | 1919 | |
| 1920 | - // Some theme overwrites global gd listing $post |
|
| 1921 | - if (!empty($ID) && (!empty($post->ID) && $post->ID != $ID) || empty($post)) {
|
|
| 1922 | - $post = geodir_get_post_info($ID); |
|
| 1923 | - } |
|
| 1920 | + // Some theme overwrites global gd listing $post |
|
| 1921 | + if (!empty($ID) && (!empty($post->ID) && $post->ID != $ID) || empty($post)) {
|
|
| 1922 | + $post = geodir_get_post_info($ID); |
|
| 1923 | + } |
|
| 1924 | 1924 | |
| 1925 | - $post_type = $ID ? get_post_type($ID) : ''; |
|
| 1926 | - |
|
| 1927 | - // filter field as per price package |
|
| 1928 | - global $geodir_addon_list; |
|
| 1929 | - if ($post_type && defined('GEODIRPAYMENT_VERSION')) {
|
|
| 1930 | - $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL; |
|
| 1931 | - $field_name = 'geodir_contact'; |
|
| 1932 | - if (!check_field_visibility($package_id, $field_name, $post_type)) {
|
|
| 1933 | - $contact = ''; |
|
| 1934 | - } |
|
| 1935 | - |
|
| 1936 | - $field_name = 'geodir_timing'; |
|
| 1937 | - if (!check_field_visibility($package_id, $field_name, $post_type)) {
|
|
| 1938 | - $timing = ''; |
|
| 1939 | - } |
|
| 1940 | - } |
|
| 1941 | - |
|
| 1942 | - if ($lat && $lng) {
|
|
| 1943 | - ob_start(); ?> |
|
| 1925 | + $post_type = $ID ? get_post_type($ID) : ''; |
|
| 1926 | + |
|
| 1927 | + // filter field as per price package |
|
| 1928 | + global $geodir_addon_list; |
|
| 1929 | + if ($post_type && defined('GEODIRPAYMENT_VERSION')) {
|
|
| 1930 | + $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL; |
|
| 1931 | + $field_name = 'geodir_contact'; |
|
| 1932 | + if (!check_field_visibility($package_id, $field_name, $post_type)) {
|
|
| 1933 | + $contact = ''; |
|
| 1934 | + } |
|
| 1935 | + |
|
| 1936 | + $field_name = 'geodir_timing'; |
|
| 1937 | + if (!check_field_visibility($package_id, $field_name, $post_type)) {
|
|
| 1938 | + $timing = ''; |
|
| 1939 | + } |
|
| 1940 | + } |
|
| 1941 | + |
|
| 1942 | + if ($lat && $lng) {
|
|
| 1943 | + ob_start(); ?> |
|
| 1944 | 1944 | <div class="gd-bubble" style=""> |
| 1945 | 1945 | <div class="gd-bubble-inside"> |
| 1946 | 1946 | <?php |
| 1947 | - $comment_count = ''; |
|
| 1948 | - $rating_star = ''; |
|
| 1949 | - if ($ID != '' && $post_type != '' && !geodir_cpt_has_rating_disabled($post_type)) {
|
|
| 1950 | - $rating_star = ''; |
|
| 1951 | - $comment_count = geodir_get_review_count_total($ID); |
|
| 1952 | - |
|
| 1953 | - if (!$preview) {
|
|
| 1954 | - $post_avgratings = geodir_get_post_rating($ID); |
|
| 1955 | - |
|
| 1956 | - $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false); |
|
| 1957 | - |
|
| 1958 | - /** |
|
| 1959 | - * Filter to change rating stars |
|
| 1960 | - * |
|
| 1961 | - * You can use this filter to change Rating stars. |
|
| 1962 | - * |
|
| 1963 | - * @since 1.0.0 |
|
| 1964 | - * @package GeoDirectory |
|
| 1965 | - * @param string $rating_star Rating stars. |
|
| 1966 | - * @param float $post_avgratings Average ratings of the post. |
|
| 1967 | - * @param int $ID The post ID. |
|
| 1968 | - */ |
|
| 1969 | - $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
|
|
| 1970 | - } |
|
| 1971 | - } |
|
| 1972 | - ?> |
|
| 1947 | + $comment_count = ''; |
|
| 1948 | + $rating_star = ''; |
|
| 1949 | + if ($ID != '' && $post_type != '' && !geodir_cpt_has_rating_disabled($post_type)) {
|
|
| 1950 | + $rating_star = ''; |
|
| 1951 | + $comment_count = geodir_get_review_count_total($ID); |
|
| 1952 | + |
|
| 1953 | + if (!$preview) {
|
|
| 1954 | + $post_avgratings = geodir_get_post_rating($ID); |
|
| 1955 | + |
|
| 1956 | + $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false); |
|
| 1957 | + |
|
| 1958 | + /** |
|
| 1959 | + * Filter to change rating stars |
|
| 1960 | + * |
|
| 1961 | + * You can use this filter to change Rating stars. |
|
| 1962 | + * |
|
| 1963 | + * @since 1.0.0 |
|
| 1964 | + * @package GeoDirectory |
|
| 1965 | + * @param string $rating_star Rating stars. |
|
| 1966 | + * @param float $post_avgratings Average ratings of the post. |
|
| 1967 | + * @param int $ID The post ID. |
|
| 1968 | + */ |
|
| 1969 | + $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
|
|
| 1970 | + } |
|
| 1971 | + } |
|
| 1972 | + ?> |
|
| 1973 | 1973 | <div class="geodir-bubble_desc"> |
| 1974 | 1974 | <h4> |
| 1975 | 1975 | <a href="<?php if ($plink != '') {
|
| 1976 | - echo $plink; |
|
| 1977 | - } else {
|
|
| 1978 | - echo 'javascript:void(0);'; |
|
| 1979 | - } ?>"><?php echo $title; ?></a> |
|
| 1976 | + echo $plink; |
|
| 1977 | + } else {
|
|
| 1978 | + echo 'javascript:void(0);'; |
|
| 1979 | + } ?>"><?php echo $title; ?></a> |
|
| 1980 | 1980 | </h4> |
| 1981 | 1981 | <?php |
| 1982 | - if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
|
|
| 1983 | - $post_images = array(); |
|
| 1984 | - if (!empty($postinfo_obj->post_images)) {
|
|
| 1985 | - $post_images = explode(",", $postinfo_obj->post_images);
|
|
| 1986 | - } |
|
| 1987 | - |
|
| 1988 | - if (!empty($post_images)) {
|
|
| 1989 | - ?> |
|
| 1982 | + if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
|
|
| 1983 | + $post_images = array(); |
|
| 1984 | + if (!empty($postinfo_obj->post_images)) {
|
|
| 1985 | + $post_images = explode(",", $postinfo_obj->post_images);
|
|
| 1986 | + } |
|
| 1987 | + |
|
| 1988 | + if (!empty($post_images)) {
|
|
| 1989 | + ?> |
|
| 1990 | 1990 | <div class="geodir-bubble_image"><a href="<?php if ($plink != '') {
|
| 1991 | - echo $plink; |
|
| 1992 | - } else {
|
|
| 1993 | - echo 'javascript:void(0);'; |
|
| 1994 | - } ?>"><img alt="bubble image" style="max-height:50px;" |
|
| 1991 | + echo $plink; |
|
| 1992 | + } else {
|
|
| 1993 | + echo 'javascript:void(0);'; |
|
| 1994 | + } ?>"><img alt="bubble image" style="max-height:50px;" |
|
| 1995 | 1995 | src="<?php echo $post_images[0]; ?>"/></a></div> |
| 1996 | 1996 | <?php |
| 1997 | - }else{
|
|
| 1998 | - echo '<div class="geodir-bubble_image"></div>'; |
|
| 1999 | - } |
|
| 2000 | - } else {
|
|
| 2001 | - if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
|
|
| 2002 | - ?> |
|
| 1997 | + }else{
|
|
| 1998 | + echo '<div class="geodir-bubble_image"></div>'; |
|
| 1999 | + } |
|
| 2000 | + } else {
|
|
| 2001 | + if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
|
|
| 2002 | + ?> |
|
| 2003 | 2003 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
| 2004 | 2004 | <?php |
| 2005 | - }else{
|
|
| 2006 | - echo '<div class="geodir-bubble_image"></div>'; |
|
| 2007 | - } |
|
| 2008 | - } |
|
| 2009 | - ?> |
|
| 2005 | + }else{
|
|
| 2006 | + echo '<div class="geodir-bubble_image"></div>'; |
|
| 2007 | + } |
|
| 2008 | + } |
|
| 2009 | + ?> |
|
| 2010 | 2010 | <div class="geodir-bubble-meta-side"> |
| 2011 | 2011 | <?php |
| 2012 | - /** |
|
| 2013 | - * Fires before the meta info in the map info window. |
|
| 2014 | - * |
|
| 2015 | - * This can be used to add more info to the map info window before the normal meta info. |
|
| 2016 | - * |
|
| 2017 | - * @since 1.5.4 |
|
| 2018 | - * @param int $ID The post id. |
|
| 2019 | - * @param object $postinfo_obj The posts info as an object. |
|
| 2020 | - * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * |
|
| 2021 | - */ |
|
| 2022 | - do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
|
|
| 2023 | - |
|
| 2024 | - echo geodir_show_listing_info('mapbubble');
|
|
| 2025 | - |
|
| 2026 | - /** |
|
| 2027 | - * Fires after the meta info in the map info window. |
|
| 2028 | - * |
|
| 2029 | - * This can be used to add more info to the map info window after the normal meta info. |
|
| 2030 | - * |
|
| 2031 | - * @since 1.4.2 |
|
| 2032 | - * @param object $postinfo_obj The posts info as an object. |
|
| 2033 | - * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * |
|
| 2034 | - */ |
|
| 2035 | - do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
|
|
| 2036 | - ?> |
|
| 2012 | + /** |
|
| 2013 | + * Fires before the meta info in the map info window. |
|
| 2014 | + * |
|
| 2015 | + * This can be used to add more info to the map info window before the normal meta info. |
|
| 2016 | + * |
|
| 2017 | + * @since 1.5.4 |
|
| 2018 | + * @param int $ID The post id. |
|
| 2019 | + * @param object $postinfo_obj The posts info as an object. |
|
| 2020 | + * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * |
|
| 2021 | + */ |
|
| 2022 | + do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
|
|
| 2023 | + |
|
| 2024 | + echo geodir_show_listing_info('mapbubble');
|
|
| 2025 | + |
|
| 2026 | + /** |
|
| 2027 | + * Fires after the meta info in the map info window. |
|
| 2028 | + * |
|
| 2029 | + * This can be used to add more info to the map info window after the normal meta info. |
|
| 2030 | + * |
|
| 2031 | + * @since 1.4.2 |
|
| 2032 | + * @param object $postinfo_obj The posts info as an object. |
|
| 2033 | + * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * |
|
| 2034 | + */ |
|
| 2035 | + do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
|
|
| 2036 | + ?> |
|
| 2037 | 2037 | </div> |
| 2038 | 2038 | <?php |
| 2039 | - if ($ID) {
|
|
| 2040 | - $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
|
|
| 2041 | - ?> |
|
| 2039 | + if ($ID) {
|
|
| 2040 | + $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
|
|
| 2041 | + ?> |
|
| 2042 | 2042 | <div class="geodir-bubble-meta-fade"></div> |
| 2043 | 2043 | <div class="geodir-bubble-meta-bottom"> |
| 2044 | 2044 | <?php if ($rating_star != '') { ?>
|
@@ -2054,69 +2054,69 @@ discard block |
||
| 2054 | 2054 | </div> |
| 2055 | 2055 | </div> |
| 2056 | 2056 | <?php |
| 2057 | - $html = ob_get_clean(); |
|
| 2058 | - /** |
|
| 2059 | - * Filter to change infowindow html |
|
| 2060 | - * |
|
| 2061 | - * You can use this filter to change infowindow html. |
|
| 2062 | - * |
|
| 2063 | - * @since 1.0.0 |
|
| 2064 | - * @package GeoDirectory |
|
| 2065 | - * @param string $html Infowindow html. |
|
| 2066 | - * @param object $postinfo_obj The Post object. |
|
| 2067 | - * @param bool|string $post_preview Is this a post preview? |
|
| 2068 | - */ |
|
| 2069 | - $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
|
|
| 2070 | - return $html; |
|
| 2071 | - } |
|
| 2072 | - } |
|
| 2057 | + $html = ob_get_clean(); |
|
| 2058 | + /** |
|
| 2059 | + * Filter to change infowindow html |
|
| 2060 | + * |
|
| 2061 | + * You can use this filter to change infowindow html. |
|
| 2062 | + * |
|
| 2063 | + * @since 1.0.0 |
|
| 2064 | + * @package GeoDirectory |
|
| 2065 | + * @param string $html Infowindow html. |
|
| 2066 | + * @param object $postinfo_obj The Post object. |
|
| 2067 | + * @param bool|string $post_preview Is this a post preview? |
|
| 2068 | + */ |
|
| 2069 | + $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
|
|
| 2070 | + return $html; |
|
| 2071 | + } |
|
| 2072 | + } |
|
| 2073 | 2073 | } |
| 2074 | 2074 | |
| 2075 | 2075 | |
| 2076 | 2076 | if (!function_exists('geodir_new_post_default_status')) {
|
| 2077 | - /** |
|
| 2078 | - * Default post status for new posts. |
|
| 2079 | - * |
|
| 2080 | - * @since 1.0.0 |
|
| 2081 | - * @package GeoDirectory |
|
| 2082 | - * @return string Returns the default post status for new posts. Ex: draft, publish etc. |
|
| 2083 | - */ |
|
| 2084 | - function geodir_new_post_default_status() |
|
| 2085 | - {
|
|
| 2086 | - if (get_option('geodir_new_post_default_status'))
|
|
| 2087 | - return get_option('geodir_new_post_default_status');
|
|
| 2088 | - else |
|
| 2089 | - return 'publish'; |
|
| 2090 | - |
|
| 2091 | - } |
|
| 2077 | + /** |
|
| 2078 | + * Default post status for new posts. |
|
| 2079 | + * |
|
| 2080 | + * @since 1.0.0 |
|
| 2081 | + * @package GeoDirectory |
|
| 2082 | + * @return string Returns the default post status for new posts. Ex: draft, publish etc. |
|
| 2083 | + */ |
|
| 2084 | + function geodir_new_post_default_status() |
|
| 2085 | + {
|
|
| 2086 | + if (get_option('geodir_new_post_default_status'))
|
|
| 2087 | + return get_option('geodir_new_post_default_status');
|
|
| 2088 | + else |
|
| 2089 | + return 'publish'; |
|
| 2090 | + |
|
| 2091 | + } |
|
| 2092 | 2092 | } |
| 2093 | 2093 | |
| 2094 | 2094 | if (!function_exists('geodir_change_post_status')) {
|
| 2095 | - /** |
|
| 2096 | - * Change post status of a post. |
|
| 2097 | - * |
|
| 2098 | - * @global object $wpdb WordPress Database object. |
|
| 2099 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2100 | - * @param int|string $post_id The post ID. |
|
| 2101 | - * @param string $status New post status. Ex: draft, publish etc. |
|
| 2102 | - */ |
|
| 2103 | - function geodir_change_post_status($post_id = '', $status = '') |
|
| 2104 | - {
|
|
| 2105 | - global $wpdb, $plugin_prefix; |
|
| 2106 | - |
|
| 2107 | - $post_type = get_post_type($post_id); |
|
| 2108 | - |
|
| 2109 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2110 | - |
|
| 2111 | - $wpdb->query( |
|
| 2112 | - $wpdb->prepare( |
|
| 2113 | - "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d", |
|
| 2114 | - array($status, $post_id) |
|
| 2115 | - ) |
|
| 2116 | - ); |
|
| 2117 | - |
|
| 2118 | - |
|
| 2119 | - } |
|
| 2095 | + /** |
|
| 2096 | + * Change post status of a post. |
|
| 2097 | + * |
|
| 2098 | + * @global object $wpdb WordPress Database object. |
|
| 2099 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2100 | + * @param int|string $post_id The post ID. |
|
| 2101 | + * @param string $status New post status. Ex: draft, publish etc. |
|
| 2102 | + */ |
|
| 2103 | + function geodir_change_post_status($post_id = '', $status = '') |
|
| 2104 | + {
|
|
| 2105 | + global $wpdb, $plugin_prefix; |
|
| 2106 | + |
|
| 2107 | + $post_type = get_post_type($post_id); |
|
| 2108 | + |
|
| 2109 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2110 | + |
|
| 2111 | + $wpdb->query( |
|
| 2112 | + $wpdb->prepare( |
|
| 2113 | + "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d", |
|
| 2114 | + array($status, $post_id) |
|
| 2115 | + ) |
|
| 2116 | + ); |
|
| 2117 | + |
|
| 2118 | + |
|
| 2119 | + } |
|
| 2120 | 2120 | } |
| 2121 | 2121 | |
| 2122 | 2122 | /** |
@@ -2130,13 +2130,13 @@ discard block |
||
| 2130 | 2130 | */ |
| 2131 | 2131 | function geodir_set_post_status($pid, $status) |
| 2132 | 2132 | {
|
| 2133 | - if ($pid) {
|
|
| 2134 | - global $wpdb; |
|
| 2135 | - $my_post = array(); |
|
| 2136 | - $my_post['post_status'] = $status; |
|
| 2137 | - $my_post['ID'] = $pid; |
|
| 2138 | - $last_postid = wp_update_post($my_post); |
|
| 2139 | - } |
|
| 2133 | + if ($pid) {
|
|
| 2134 | + global $wpdb; |
|
| 2135 | + $my_post = array(); |
|
| 2136 | + $my_post['post_status'] = $status; |
|
| 2137 | + $my_post['ID'] = $pid; |
|
| 2138 | + $last_postid = wp_update_post($my_post); |
|
| 2139 | + } |
|
| 2140 | 2140 | } |
| 2141 | 2141 | |
| 2142 | 2142 | |
@@ -2152,384 +2152,384 @@ discard block |
||
| 2152 | 2152 | */ |
| 2153 | 2153 | function geodir_update_poststatus($new_status, $old_status, $post) |
| 2154 | 2154 | {
|
| 2155 | - global $wpdb; |
|
| 2155 | + global $wpdb; |
|
| 2156 | 2156 | |
| 2157 | - $geodir_posttypes = geodir_get_posttypes(); |
|
| 2157 | + $geodir_posttypes = geodir_get_posttypes(); |
|
| 2158 | 2158 | |
| 2159 | - if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
|
|
| 2159 | + if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
|
|
| 2160 | 2160 | |
| 2161 | - geodir_change_post_status($post->ID, $new_status); |
|
| 2162 | - } |
|
| 2161 | + geodir_change_post_status($post->ID, $new_status); |
|
| 2162 | + } |
|
| 2163 | 2163 | } |
| 2164 | 2164 | |
| 2165 | 2165 | |
| 2166 | 2166 | if (!function_exists('geodir_update_listing_info')) {
|
| 2167 | - /** |
|
| 2168 | - * Update post info. |
|
| 2169 | - * |
|
| 2170 | - * @since 1.0.0 |
|
| 2171 | - * @package GeoDirectory |
|
| 2172 | - * @global object $wpdb WordPress Database object. |
|
| 2173 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2174 | - * @param int $updatingpost The updating post ID. |
|
| 2175 | - * @param int $temppost The temporary post ID. |
|
| 2176 | - * @todo fix post_id variable |
|
| 2177 | - */ |
|
| 2178 | - function geodir_update_listing_info($updatingpost, $temppost) |
|
| 2179 | - {
|
|
| 2180 | - |
|
| 2181 | - global $wpdb, $plugin_prefix; |
|
| 2182 | - |
|
| 2183 | - $post_type = get_post_type($post_id); |
|
| 2184 | - |
|
| 2185 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2186 | - |
|
| 2187 | - $wpdb->query( |
|
| 2188 | - $wpdb->prepare( |
|
| 2189 | - "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2190 | - array($updatingpost, $temppost) |
|
| 2191 | - ) |
|
| 2192 | - ); |
|
| 2193 | - |
|
| 2194 | - $wpdb->query( |
|
| 2195 | - $wpdb->prepare( |
|
| 2196 | - "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2197 | - array($updatingpost, $temppost) |
|
| 2198 | - ) |
|
| 2199 | - ); |
|
| 2200 | - |
|
| 2201 | - /* Update Attachments*/ |
|
| 2202 | - |
|
| 2203 | - $wpdb->query( |
|
| 2204 | - $wpdb->prepare( |
|
| 2205 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2206 | - array($updatingpost, $temppost) |
|
| 2207 | - ) |
|
| 2208 | - ); |
|
| 2209 | - |
|
| 2210 | - } |
|
| 2167 | + /** |
|
| 2168 | + * Update post info. |
|
| 2169 | + * |
|
| 2170 | + * @since 1.0.0 |
|
| 2171 | + * @package GeoDirectory |
|
| 2172 | + * @global object $wpdb WordPress Database object. |
|
| 2173 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2174 | + * @param int $updatingpost The updating post ID. |
|
| 2175 | + * @param int $temppost The temporary post ID. |
|
| 2176 | + * @todo fix post_id variable |
|
| 2177 | + */ |
|
| 2178 | + function geodir_update_listing_info($updatingpost, $temppost) |
|
| 2179 | + {
|
|
| 2180 | + |
|
| 2181 | + global $wpdb, $plugin_prefix; |
|
| 2182 | + |
|
| 2183 | + $post_type = get_post_type($post_id); |
|
| 2184 | + |
|
| 2185 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2186 | + |
|
| 2187 | + $wpdb->query( |
|
| 2188 | + $wpdb->prepare( |
|
| 2189 | + "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2190 | + array($updatingpost, $temppost) |
|
| 2191 | + ) |
|
| 2192 | + ); |
|
| 2193 | + |
|
| 2194 | + $wpdb->query( |
|
| 2195 | + $wpdb->prepare( |
|
| 2196 | + "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2197 | + array($updatingpost, $temppost) |
|
| 2198 | + ) |
|
| 2199 | + ); |
|
| 2200 | + |
|
| 2201 | + /* Update Attachments*/ |
|
| 2202 | + |
|
| 2203 | + $wpdb->query( |
|
| 2204 | + $wpdb->prepare( |
|
| 2205 | + "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2206 | + array($updatingpost, $temppost) |
|
| 2207 | + ) |
|
| 2208 | + ); |
|
| 2209 | + |
|
| 2210 | + } |
|
| 2211 | 2211 | } |
| 2212 | 2212 | |
| 2213 | 2213 | |
| 2214 | 2214 | if (!function_exists('geodir_delete_listing_info')) {
|
| 2215 | - /** |
|
| 2216 | - * Delete Listing info from details table for the given post id. |
|
| 2217 | - * |
|
| 2218 | - * @since 1.0.0 |
|
| 2219 | - * @package GeoDirectory |
|
| 2220 | - * @global object $wpdb WordPress Database object. |
|
| 2221 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2222 | - * @param int $deleted_postid The post ID. |
|
| 2223 | - * @param bool $force Optional. Do you want to force delete it? Default: false. |
|
| 2224 | - * @return bool|void |
|
| 2225 | - */ |
|
| 2226 | - function geodir_delete_listing_info($deleted_postid, $force = false) |
|
| 2227 | - {
|
|
| 2228 | - global $wpdb, $plugin_prefix; |
|
| 2229 | - |
|
| 2230 | - // check for multisite deletions |
|
| 2231 | - if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
|
|
| 2232 | - } else {
|
|
| 2233 | - return; |
|
| 2234 | - } |
|
| 2235 | - |
|
| 2236 | - $post_type = get_post_type($deleted_postid); |
|
| 2237 | - |
|
| 2238 | - $all_postypes = geodir_get_posttypes(); |
|
| 2239 | - |
|
| 2240 | - if (!in_array($post_type, $all_postypes)) |
|
| 2241 | - return false; |
|
| 2242 | - |
|
| 2243 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2244 | - |
|
| 2245 | - /* Delete custom post meta*/ |
|
| 2246 | - $wpdb->query( |
|
| 2247 | - $wpdb->prepare( |
|
| 2248 | - "DELETE FROM " . $table . " WHERE `post_id` = %d", |
|
| 2249 | - array($deleted_postid) |
|
| 2250 | - ) |
|
| 2251 | - ); |
|
| 2252 | - |
|
| 2253 | - /* Delete post map icons*/ |
|
| 2254 | - |
|
| 2255 | - $wpdb->query( |
|
| 2256 | - $wpdb->prepare( |
|
| 2257 | - "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d", |
|
| 2258 | - array($deleted_postid) |
|
| 2259 | - ) |
|
| 2260 | - ); |
|
| 2261 | - |
|
| 2262 | - /* Delete Attachments*/ |
|
| 2263 | - $postcurr_images = geodir_get_images($deleted_postid); |
|
| 2264 | - |
|
| 2265 | - $wpdb->query( |
|
| 2266 | - $wpdb->prepare( |
|
| 2267 | - "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d", |
|
| 2268 | - array($deleted_postid) |
|
| 2269 | - ) |
|
| 2270 | - ); |
|
| 2271 | - geodir_remove_attachments($postcurr_images); |
|
| 2272 | - |
|
| 2273 | - } |
|
| 2215 | + /** |
|
| 2216 | + * Delete Listing info from details table for the given post id. |
|
| 2217 | + * |
|
| 2218 | + * @since 1.0.0 |
|
| 2219 | + * @package GeoDirectory |
|
| 2220 | + * @global object $wpdb WordPress Database object. |
|
| 2221 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2222 | + * @param int $deleted_postid The post ID. |
|
| 2223 | + * @param bool $force Optional. Do you want to force delete it? Default: false. |
|
| 2224 | + * @return bool|void |
|
| 2225 | + */ |
|
| 2226 | + function geodir_delete_listing_info($deleted_postid, $force = false) |
|
| 2227 | + {
|
|
| 2228 | + global $wpdb, $plugin_prefix; |
|
| 2229 | + |
|
| 2230 | + // check for multisite deletions |
|
| 2231 | + if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
|
|
| 2232 | + } else {
|
|
| 2233 | + return; |
|
| 2234 | + } |
|
| 2235 | + |
|
| 2236 | + $post_type = get_post_type($deleted_postid); |
|
| 2237 | + |
|
| 2238 | + $all_postypes = geodir_get_posttypes(); |
|
| 2239 | + |
|
| 2240 | + if (!in_array($post_type, $all_postypes)) |
|
| 2241 | + return false; |
|
| 2242 | + |
|
| 2243 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2244 | + |
|
| 2245 | + /* Delete custom post meta*/ |
|
| 2246 | + $wpdb->query( |
|
| 2247 | + $wpdb->prepare( |
|
| 2248 | + "DELETE FROM " . $table . " WHERE `post_id` = %d", |
|
| 2249 | + array($deleted_postid) |
|
| 2250 | + ) |
|
| 2251 | + ); |
|
| 2252 | + |
|
| 2253 | + /* Delete post map icons*/ |
|
| 2254 | + |
|
| 2255 | + $wpdb->query( |
|
| 2256 | + $wpdb->prepare( |
|
| 2257 | + "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d", |
|
| 2258 | + array($deleted_postid) |
|
| 2259 | + ) |
|
| 2260 | + ); |
|
| 2261 | + |
|
| 2262 | + /* Delete Attachments*/ |
|
| 2263 | + $postcurr_images = geodir_get_images($deleted_postid); |
|
| 2264 | + |
|
| 2265 | + $wpdb->query( |
|
| 2266 | + $wpdb->prepare( |
|
| 2267 | + "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d", |
|
| 2268 | + array($deleted_postid) |
|
| 2269 | + ) |
|
| 2270 | + ); |
|
| 2271 | + geodir_remove_attachments($postcurr_images); |
|
| 2272 | + |
|
| 2273 | + } |
|
| 2274 | 2274 | } |
| 2275 | 2275 | |
| 2276 | 2276 | |
| 2277 | 2277 | if (!function_exists('geodir_add_to_favorite')) {
|
| 2278 | - /** |
|
| 2279 | - * This function would add listing to favorite listing. |
|
| 2280 | - * |
|
| 2281 | - * @since 1.0.0 |
|
| 2282 | - * @package GeoDirectory |
|
| 2283 | - * @global object $current_user Current user object. |
|
| 2284 | - * @param int $post_id The post ID. |
|
| 2285 | - */ |
|
| 2286 | - function geodir_add_to_favorite($post_id) |
|
| 2287 | - {
|
|
| 2288 | - |
|
| 2289 | - global $current_user; |
|
| 2290 | - |
|
| 2291 | - /** |
|
| 2292 | - * Filter to modify "Unfavorite" text |
|
| 2293 | - * |
|
| 2294 | - * You can use this filter to rename "Unfavorite" text to something else. |
|
| 2295 | - * |
|
| 2296 | - * @since 1.0.0 |
|
| 2297 | - * @package GeoDirectory |
|
| 2298 | - */ |
|
| 2299 | - $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
|
|
| 2300 | - |
|
| 2301 | - /** |
|
| 2302 | - * Filter to modify "Remove from Favorites" text |
|
| 2303 | - * |
|
| 2304 | - * You can use this filter to rename "Remove from Favorites" text to something else. |
|
| 2305 | - * |
|
| 2306 | - * @since 1.0.0 |
|
| 2307 | - * @package GeoDirectory |
|
| 2308 | - */ |
|
| 2309 | - $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
|
|
| 2310 | - |
|
| 2311 | - /** |
|
| 2312 | - * Filter to modify "fa fa-heart" icon |
|
| 2313 | - * |
|
| 2314 | - * You can use this filter to change "fa fa-heart" icon to something else. |
|
| 2315 | - * |
|
| 2316 | - * @since 1.0.0 |
|
| 2317 | - * @package GeoDirectory |
|
| 2318 | - */ |
|
| 2319 | - $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
|
|
| 2320 | - |
|
| 2321 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2322 | - $user_meta_data = !empty($user_meta_data) && is_array($user_meta_data) ? $user_meta_data : array(); |
|
| 2323 | - |
|
| 2324 | - if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
|
|
| 2325 | - $user_meta_data[] = $post_id; |
|
| 2326 | - } |
|
| 2327 | - |
|
| 2328 | - update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data); |
|
| 2329 | - |
|
| 2330 | - /** |
|
| 2331 | - * Called before adding the post from favourites. |
|
| 2332 | - * |
|
| 2333 | - * @since 1.0.0 |
|
| 2334 | - * @package GeoDirectory |
|
| 2335 | - * @param int $post_id The post ID. |
|
| 2336 | - */ |
|
| 2337 | - do_action('geodir_before_add_from_favorite', $post_id);
|
|
| 2278 | + /** |
|
| 2279 | + * This function would add listing to favorite listing. |
|
| 2280 | + * |
|
| 2281 | + * @since 1.0.0 |
|
| 2282 | + * @package GeoDirectory |
|
| 2283 | + * @global object $current_user Current user object. |
|
| 2284 | + * @param int $post_id The post ID. |
|
| 2285 | + */ |
|
| 2286 | + function geodir_add_to_favorite($post_id) |
|
| 2287 | + {
|
|
| 2288 | + |
|
| 2289 | + global $current_user; |
|
| 2290 | + |
|
| 2291 | + /** |
|
| 2292 | + * Filter to modify "Unfavorite" text |
|
| 2293 | + * |
|
| 2294 | + * You can use this filter to rename "Unfavorite" text to something else. |
|
| 2295 | + * |
|
| 2296 | + * @since 1.0.0 |
|
| 2297 | + * @package GeoDirectory |
|
| 2298 | + */ |
|
| 2299 | + $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
|
|
| 2300 | + |
|
| 2301 | + /** |
|
| 2302 | + * Filter to modify "Remove from Favorites" text |
|
| 2303 | + * |
|
| 2304 | + * You can use this filter to rename "Remove from Favorites" text to something else. |
|
| 2305 | + * |
|
| 2306 | + * @since 1.0.0 |
|
| 2307 | + * @package GeoDirectory |
|
| 2308 | + */ |
|
| 2309 | + $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
|
|
| 2310 | + |
|
| 2311 | + /** |
|
| 2312 | + * Filter to modify "fa fa-heart" icon |
|
| 2313 | + * |
|
| 2314 | + * You can use this filter to change "fa fa-heart" icon to something else. |
|
| 2315 | + * |
|
| 2316 | + * @since 1.0.0 |
|
| 2317 | + * @package GeoDirectory |
|
| 2318 | + */ |
|
| 2319 | + $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
|
|
| 2320 | + |
|
| 2321 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2322 | + $user_meta_data = !empty($user_meta_data) && is_array($user_meta_data) ? $user_meta_data : array(); |
|
| 2323 | + |
|
| 2324 | + if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
|
|
| 2325 | + $user_meta_data[] = $post_id; |
|
| 2326 | + } |
|
| 2327 | + |
|
| 2328 | + update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data); |
|
| 2329 | + |
|
| 2330 | + /** |
|
| 2331 | + * Called before adding the post from favourites. |
|
| 2332 | + * |
|
| 2333 | + * @since 1.0.0 |
|
| 2334 | + * @package GeoDirectory |
|
| 2335 | + * @param int $post_id The post ID. |
|
| 2336 | + */ |
|
| 2337 | + do_action('geodir_before_add_from_favorite', $post_id);
|
|
| 2338 | + |
|
| 2339 | + echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>'; |
|
| 2340 | + |
|
| 2341 | + /** |
|
| 2342 | + * Called after adding the post from favourites. |
|
| 2343 | + * |
|
| 2344 | + * @since 1.0.0 |
|
| 2345 | + * @package GeoDirectory |
|
| 2346 | + * @param int $post_id The post ID. |
|
| 2347 | + */ |
|
| 2348 | + do_action('geodir_after_add_from_favorite', $post_id);
|
|
| 2338 | 2349 | |
| 2339 | - echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>'; |
|
| 2340 | - |
|
| 2341 | - /** |
|
| 2342 | - * Called after adding the post from favourites. |
|
| 2343 | - * |
|
| 2344 | - * @since 1.0.0 |
|
| 2345 | - * @package GeoDirectory |
|
| 2346 | - * @param int $post_id The post ID. |
|
| 2347 | - */ |
|
| 2348 | - do_action('geodir_after_add_from_favorite', $post_id);
|
|
| 2349 | - |
|
| 2350 | - } |
|
| 2350 | + } |
|
| 2351 | 2351 | } |
| 2352 | 2352 | |
| 2353 | 2353 | if (!function_exists('geodir_remove_from_favorite')) {
|
| 2354 | - /** |
|
| 2355 | - * This function would remove the favourited property earlier. |
|
| 2356 | - * |
|
| 2357 | - * @since 1.0.0 |
|
| 2358 | - * @package GeoDirectory |
|
| 2359 | - * @global object $current_user Current user object. |
|
| 2360 | - * @param int $post_id The post ID. |
|
| 2361 | - */ |
|
| 2362 | - function geodir_remove_from_favorite($post_id) |
|
| 2363 | - {
|
|
| 2364 | - global $current_user; |
|
| 2365 | - |
|
| 2366 | - /** |
|
| 2367 | - * Filter to modify "Add to Favorites" text |
|
| 2368 | - * |
|
| 2369 | - * You can use this filter to rename "Add to Favorites" text to something else. |
|
| 2370 | - * |
|
| 2371 | - * @since 1.0.0 |
|
| 2372 | - * @package GeoDirectory |
|
| 2373 | - */ |
|
| 2374 | - $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
|
|
| 2375 | - |
|
| 2376 | - /** |
|
| 2377 | - * Filter to modify "Favourite" text |
|
| 2378 | - * |
|
| 2379 | - * You can use this filter to rename "Favourite" text to something else. |
|
| 2380 | - * |
|
| 2381 | - * @since 1.0.0 |
|
| 2382 | - * @package GeoDirectory |
|
| 2383 | - */ |
|
| 2384 | - $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
|
|
| 2385 | - |
|
| 2386 | - /** |
|
| 2387 | - * Filter to modify "fa fa-heart" icon |
|
| 2388 | - * |
|
| 2389 | - * You can use this filter to change "fa fa-heart" icon to something else. |
|
| 2390 | - * |
|
| 2391 | - * @since 1.0.0 |
|
| 2392 | - * @package GeoDirectory |
|
| 2393 | - */ |
|
| 2394 | - $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
|
|
| 2395 | - |
|
| 2396 | - $user_meta_data = array(); |
|
| 2397 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2398 | - |
|
| 2399 | - if (!empty($user_meta_data)) {
|
|
| 2354 | + /** |
|
| 2355 | + * This function would remove the favourited property earlier. |
|
| 2356 | + * |
|
| 2357 | + * @since 1.0.0 |
|
| 2358 | + * @package GeoDirectory |
|
| 2359 | + * @global object $current_user Current user object. |
|
| 2360 | + * @param int $post_id The post ID. |
|
| 2361 | + */ |
|
| 2362 | + function geodir_remove_from_favorite($post_id) |
|
| 2363 | + {
|
|
| 2364 | + global $current_user; |
|
| 2365 | + |
|
| 2366 | + /** |
|
| 2367 | + * Filter to modify "Add to Favorites" text |
|
| 2368 | + * |
|
| 2369 | + * You can use this filter to rename "Add to Favorites" text to something else. |
|
| 2370 | + * |
|
| 2371 | + * @since 1.0.0 |
|
| 2372 | + * @package GeoDirectory |
|
| 2373 | + */ |
|
| 2374 | + $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
|
|
| 2375 | + |
|
| 2376 | + /** |
|
| 2377 | + * Filter to modify "Favourite" text |
|
| 2378 | + * |
|
| 2379 | + * You can use this filter to rename "Favourite" text to something else. |
|
| 2380 | + * |
|
| 2381 | + * @since 1.0.0 |
|
| 2382 | + * @package GeoDirectory |
|
| 2383 | + */ |
|
| 2384 | + $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
|
|
| 2385 | + |
|
| 2386 | + /** |
|
| 2387 | + * Filter to modify "fa fa-heart" icon |
|
| 2388 | + * |
|
| 2389 | + * You can use this filter to change "fa fa-heart" icon to something else. |
|
| 2390 | + * |
|
| 2391 | + * @since 1.0.0 |
|
| 2392 | + * @package GeoDirectory |
|
| 2393 | + */ |
|
| 2394 | + $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
|
|
| 2395 | + |
|
| 2396 | + $user_meta_data = array(); |
|
| 2397 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2398 | + |
|
| 2399 | + if (!empty($user_meta_data)) {
|
|
| 2400 | + |
|
| 2401 | + if (($key = array_search($post_id, $user_meta_data)) !== false) {
|
|
| 2402 | + unset($user_meta_data[$key]); |
|
| 2403 | + } |
|
| 2400 | 2404 | |
| 2401 | - if (($key = array_search($post_id, $user_meta_data)) !== false) {
|
|
| 2402 | - unset($user_meta_data[$key]); |
|
| 2403 | - } |
|
| 2405 | + } |
|
| 2404 | 2406 | |
| 2405 | - } |
|
| 2407 | + update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data); |
|
| 2406 | 2408 | |
| 2407 | - update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data); |
|
| 2409 | + /** |
|
| 2410 | + * Called before removing the post from favourites. |
|
| 2411 | + * |
|
| 2412 | + * @since 1.0.0 |
|
| 2413 | + * @package GeoDirectory |
|
| 2414 | + * @param int $post_id The post ID. |
|
| 2415 | + */ |
|
| 2416 | + do_action('geodir_before_remove_from_favorite', $post_id);
|
|
| 2408 | 2417 | |
| 2409 | - /** |
|
| 2410 | - * Called before removing the post from favourites. |
|
| 2411 | - * |
|
| 2412 | - * @since 1.0.0 |
|
| 2413 | - * @package GeoDirectory |
|
| 2414 | - * @param int $post_id The post ID. |
|
| 2415 | - */ |
|
| 2416 | - do_action('geodir_before_remove_from_favorite', $post_id);
|
|
| 2418 | + echo '<a href="javascript:void(0);" title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>'; |
|
| 2417 | 2419 | |
| 2418 | - echo '<a href="javascript:void(0);" title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>'; |
|
| 2420 | + /** |
|
| 2421 | + * Called after removing the post from favourites. |
|
| 2422 | + * |
|
| 2423 | + * @since 1.0.0 |
|
| 2424 | + * @package GeoDirectory |
|
| 2425 | + * @param int $post_id The post ID. |
|
| 2426 | + */ |
|
| 2427 | + do_action('geodir_after_remove_from_favorite', $post_id);
|
|
| 2419 | 2428 | |
| 2420 | - /** |
|
| 2421 | - * Called after removing the post from favourites. |
|
| 2422 | - * |
|
| 2423 | - * @since 1.0.0 |
|
| 2424 | - * @package GeoDirectory |
|
| 2425 | - * @param int $post_id The post ID. |
|
| 2426 | - */ |
|
| 2427 | - do_action('geodir_after_remove_from_favorite', $post_id);
|
|
| 2428 | - |
|
| 2429 | - } |
|
| 2429 | + } |
|
| 2430 | 2430 | } |
| 2431 | 2431 | |
| 2432 | 2432 | if (!function_exists('geodir_favourite_html')) {
|
| 2433 | - /** |
|
| 2434 | - * This function would display the html content for add to favorite or remove from favorite. |
|
| 2435 | - * |
|
| 2436 | - * @since 1.0.0 |
|
| 2437 | - * @package GeoDirectory |
|
| 2438 | - * @global object $current_user Current user object. |
|
| 2439 | - * @global object $post The current post object. |
|
| 2440 | - * @param int $user_id The user ID. |
|
| 2441 | - * @param int $post_id The post ID. |
|
| 2442 | - */ |
|
| 2443 | - function geodir_favourite_html($user_id, $post_id) |
|
| 2444 | - {
|
|
| 2445 | - |
|
| 2446 | - global $current_user, $post; |
|
| 2447 | - |
|
| 2448 | - /** |
|
| 2449 | - * Filter to modify "Add to Favorites" text |
|
| 2450 | - * |
|
| 2451 | - * You can use this filter to rename "Add to Favorites" text to something else. |
|
| 2452 | - * |
|
| 2453 | - * @since 1.0.0 |
|
| 2454 | - * @package GeoDirectory |
|
| 2455 | - */ |
|
| 2456 | - $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
|
|
| 2457 | - |
|
| 2458 | - /** |
|
| 2459 | - * Filter to modify "Favourite" text |
|
| 2460 | - * |
|
| 2461 | - * You can use this filter to rename "Favourite" text to something else. |
|
| 2462 | - * |
|
| 2463 | - * @since 1.0.0 |
|
| 2464 | - * @package GeoDirectory |
|
| 2465 | - */ |
|
| 2466 | - $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
|
|
| 2467 | - |
|
| 2468 | - /** |
|
| 2469 | - * Filter to modify "Unfavorite" text |
|
| 2470 | - * |
|
| 2471 | - * You can use this filter to rename "Unfavorite" text to something else. |
|
| 2472 | - * |
|
| 2473 | - * @since 1.0.0 |
|
| 2474 | - * @package GeoDirectory |
|
| 2475 | - */ |
|
| 2476 | - $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
|
|
| 2477 | - |
|
| 2478 | - /** |
|
| 2479 | - * Filter to modify "Remove from Favorites" text |
|
| 2480 | - * |
|
| 2481 | - * You can use this filter to rename "Remove from Favorites" text to something else. |
|
| 2482 | - * |
|
| 2483 | - * @since 1.0.0 |
|
| 2484 | - * @package GeoDirectory |
|
| 2485 | - */ |
|
| 2486 | - $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
|
|
| 2487 | - |
|
| 2488 | - /** |
|
| 2489 | - * Filter to modify "fa fa-heart" icon |
|
| 2490 | - * |
|
| 2491 | - * You can use this filter to change "fa fa-heart" icon to something else. |
|
| 2492 | - * |
|
| 2493 | - * @since 1.0.0 |
|
| 2494 | - * @package GeoDirectory |
|
| 2495 | - */ |
|
| 2496 | - $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
|
|
| 2497 | - |
|
| 2498 | - /** |
|
| 2499 | - * Filter to modify "fa fa-heart" icon for "remove from favorites" link |
|
| 2500 | - * |
|
| 2501 | - * You can use this filter to change "fa fa-heart" icon to something else. |
|
| 2502 | - * |
|
| 2503 | - * @since 1.0.0 |
|
| 2504 | - * @package GeoDirectory |
|
| 2505 | - */ |
|
| 2506 | - $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
|
|
| 2507 | - |
|
| 2508 | - $user_meta_data = ''; |
|
| 2509 | - if (isset($current_user->data->ID)) |
|
| 2510 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2511 | - |
|
| 2512 | - if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
|
|
| 2513 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
|
| 2433 | + /** |
|
| 2434 | + * This function would display the html content for add to favorite or remove from favorite. |
|
| 2435 | + * |
|
| 2436 | + * @since 1.0.0 |
|
| 2437 | + * @package GeoDirectory |
|
| 2438 | + * @global object $current_user Current user object. |
|
| 2439 | + * @global object $post The current post object. |
|
| 2440 | + * @param int $user_id The user ID. |
|
| 2441 | + * @param int $post_id The post ID. |
|
| 2442 | + */ |
|
| 2443 | + function geodir_favourite_html($user_id, $post_id) |
|
| 2444 | + {
|
|
| 2445 | + |
|
| 2446 | + global $current_user, $post; |
|
| 2447 | + |
|
| 2448 | + /** |
|
| 2449 | + * Filter to modify "Add to Favorites" text |
|
| 2450 | + * |
|
| 2451 | + * You can use this filter to rename "Add to Favorites" text to something else. |
|
| 2452 | + * |
|
| 2453 | + * @since 1.0.0 |
|
| 2454 | + * @package GeoDirectory |
|
| 2455 | + */ |
|
| 2456 | + $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
|
|
| 2457 | + |
|
| 2458 | + /** |
|
| 2459 | + * Filter to modify "Favourite" text |
|
| 2460 | + * |
|
| 2461 | + * You can use this filter to rename "Favourite" text to something else. |
|
| 2462 | + * |
|
| 2463 | + * @since 1.0.0 |
|
| 2464 | + * @package GeoDirectory |
|
| 2465 | + */ |
|
| 2466 | + $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
|
|
| 2467 | + |
|
| 2468 | + /** |
|
| 2469 | + * Filter to modify "Unfavorite" text |
|
| 2470 | + * |
|
| 2471 | + * You can use this filter to rename "Unfavorite" text to something else. |
|
| 2472 | + * |
|
| 2473 | + * @since 1.0.0 |
|
| 2474 | + * @package GeoDirectory |
|
| 2475 | + */ |
|
| 2476 | + $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
|
|
| 2477 | + |
|
| 2478 | + /** |
|
| 2479 | + * Filter to modify "Remove from Favorites" text |
|
| 2480 | + * |
|
| 2481 | + * You can use this filter to rename "Remove from Favorites" text to something else. |
|
| 2482 | + * |
|
| 2483 | + * @since 1.0.0 |
|
| 2484 | + * @package GeoDirectory |
|
| 2485 | + */ |
|
| 2486 | + $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
|
|
| 2487 | + |
|
| 2488 | + /** |
|
| 2489 | + * Filter to modify "fa fa-heart" icon |
|
| 2490 | + * |
|
| 2491 | + * You can use this filter to change "fa fa-heart" icon to something else. |
|
| 2492 | + * |
|
| 2493 | + * @since 1.0.0 |
|
| 2494 | + * @package GeoDirectory |
|
| 2495 | + */ |
|
| 2496 | + $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
|
|
| 2497 | + |
|
| 2498 | + /** |
|
| 2499 | + * Filter to modify "fa fa-heart" icon for "remove from favorites" link |
|
| 2500 | + * |
|
| 2501 | + * You can use this filter to change "fa fa-heart" icon to something else. |
|
| 2502 | + * |
|
| 2503 | + * @since 1.0.0 |
|
| 2504 | + * @package GeoDirectory |
|
| 2505 | + */ |
|
| 2506 | + $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
|
|
| 2507 | + |
|
| 2508 | + $user_meta_data = ''; |
|
| 2509 | + if (isset($current_user->data->ID)) |
|
| 2510 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2511 | + |
|
| 2512 | + if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
|
|
| 2513 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
|
| 2514 | 2514 | class="geodir-removetofav-icon" href="javascript:void(0);" |
| 2515 | 2515 | onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');" |
| 2516 | 2516 | title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?> |
| 2517 | 2517 | </a> </span><?php |
| 2518 | 2518 | |
| 2519 | - } else {
|
|
| 2519 | + } else {
|
|
| 2520 | 2520 | |
| 2521 | - if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
|
|
| 2522 | - $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
|
| 2523 | - } else |
|
| 2524 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
|
|
| 2521 | + if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
|
|
| 2522 | + $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
|
| 2523 | + } else |
|
| 2524 | + $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
|
|
| 2525 | 2525 | |
| 2526 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
|
| 2526 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
|
| 2527 | 2527 | href="javascript:void(0);" |
| 2528 | 2528 | onclick="<?php echo $script_text;?>" |
| 2529 | 2529 | title="<?php echo $add_favourite_text;?>"><i |
| 2530 | 2530 | class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span> |
| 2531 | 2531 | <?php } |
| 2532 | - } |
|
| 2532 | + } |
|
| 2533 | 2533 | } |
| 2534 | 2534 | |
| 2535 | 2535 | |
@@ -2546,54 +2546,54 @@ discard block |
||
| 2546 | 2546 | function geodir_get_cat_postcount($term = array()) |
| 2547 | 2547 | {
|
| 2548 | 2548 | |
| 2549 | - if (!empty($term)) {
|
|
| 2549 | + if (!empty($term)) {
|
|
| 2550 | 2550 | |
| 2551 | - global $wpdb, $plugin_prefix; |
|
| 2551 | + global $wpdb, $plugin_prefix; |
|
| 2552 | 2552 | |
| 2553 | - $where = ''; |
|
| 2554 | - $join = ''; |
|
| 2555 | - if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
|
|
| 2556 | - $taxonomy_obj = get_taxonomy($term->taxonomy); |
|
| 2553 | + $where = ''; |
|
| 2554 | + $join = ''; |
|
| 2555 | + if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
|
|
| 2556 | + $taxonomy_obj = get_taxonomy($term->taxonomy); |
|
| 2557 | 2557 | |
| 2558 | - $post_type = $taxonomy_obj->object_type[0]; |
|
| 2558 | + $post_type = $taxonomy_obj->object_type[0]; |
|
| 2559 | 2559 | |
| 2560 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2560 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2561 | 2561 | |
| 2562 | - /** |
|
| 2563 | - * Filter to modify the 'join' query |
|
| 2564 | - * |
|
| 2565 | - * @since 1.0.0 |
|
| 2566 | - * @package GeoDirectory |
|
| 2567 | - * @param object|array $term category / term object that need to be processed. |
|
| 2568 | - * @param string $join The join query. |
|
| 2569 | - */ |
|
| 2570 | - $join = apply_filters('geodir_cat_post_count_join', $join, $term);
|
|
| 2562 | + /** |
|
| 2563 | + * Filter to modify the 'join' query |
|
| 2564 | + * |
|
| 2565 | + * @since 1.0.0 |
|
| 2566 | + * @package GeoDirectory |
|
| 2567 | + * @param object|array $term category / term object that need to be processed. |
|
| 2568 | + * @param string $join The join query. |
|
| 2569 | + */ |
|
| 2570 | + $join = apply_filters('geodir_cat_post_count_join', $join, $term);
|
|
| 2571 | 2571 | |
| 2572 | - /** |
|
| 2573 | - * Filter to modify the 'where' query |
|
| 2574 | - * |
|
| 2575 | - * @since 1.0.0 |
|
| 2576 | - * @package GeoDirectory |
|
| 2577 | - * @param object|array $term category / term object that need to be processed. |
|
| 2578 | - * @param string $where The where query. |
|
| 2579 | - */ |
|
| 2580 | - $where = apply_filters('geodir_cat_post_count_where', $where, $term);
|
|
| 2572 | + /** |
|
| 2573 | + * Filter to modify the 'where' query |
|
| 2574 | + * |
|
| 2575 | + * @since 1.0.0 |
|
| 2576 | + * @package GeoDirectory |
|
| 2577 | + * @param object|array $term category / term object that need to be processed. |
|
| 2578 | + * @param string $where The where query. |
|
| 2579 | + */ |
|
| 2580 | + $where = apply_filters('geodir_cat_post_count_where', $where, $term);
|
|
| 2581 | 2581 | |
| 2582 | - $count_query = "SELECT count(post_id) FROM |
|
| 2582 | + $count_query = "SELECT count(post_id) FROM |
|
| 2583 | 2583 | " . $table . " as pd " . $join . " |
| 2584 | 2584 | WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
|
| 2585 | 2585 | |
| 2586 | - $cat_post_count = $wpdb->get_var($count_query); |
|
| 2587 | - if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
|
| 2588 | - $cat_post_count = 0; |
|
| 2586 | + $cat_post_count = $wpdb->get_var($count_query); |
|
| 2587 | + if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
|
| 2588 | + $cat_post_count = 0; |
|
| 2589 | 2589 | |
| 2590 | - return $cat_post_count; |
|
| 2590 | + return $cat_post_count; |
|
| 2591 | 2591 | |
| 2592 | - } else |
|
| 2592 | + } else |
|
| 2593 | 2593 | |
| 2594 | - return $term->count; |
|
| 2595 | - } |
|
| 2596 | - return false; |
|
| 2594 | + return $term->count; |
|
| 2595 | + } |
|
| 2596 | + return false; |
|
| 2597 | 2597 | |
| 2598 | 2598 | } |
| 2599 | 2599 | |
@@ -2606,17 +2606,17 @@ discard block |
||
| 2606 | 2606 | */ |
| 2607 | 2607 | function geodir_allow_post_type_frontend() |
| 2608 | 2608 | {
|
| 2609 | - $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 2609 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 2610 | 2610 | |
| 2611 | - if (!is_admin() && isset($_REQUEST['listing_type']) |
|
| 2612 | - && !empty($geodir_allow_posttype_frontend) |
|
| 2613 | - && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend) |
|
| 2614 | - ) {
|
|
| 2611 | + if (!is_admin() && isset($_REQUEST['listing_type']) |
|
| 2612 | + && !empty($geodir_allow_posttype_frontend) |
|
| 2613 | + && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend) |
|
| 2614 | + ) {
|
|
| 2615 | 2615 | |
| 2616 | - wp_redirect(home_url()); |
|
| 2617 | - exit; |
|
| 2616 | + wp_redirect(home_url()); |
|
| 2617 | + exit; |
|
| 2618 | 2618 | |
| 2619 | - } |
|
| 2619 | + } |
|
| 2620 | 2620 | |
| 2621 | 2621 | } |
| 2622 | 2622 | |
@@ -2633,20 +2633,20 @@ discard block |
||
| 2633 | 2633 | */ |
| 2634 | 2634 | function geodir_excerpt_length($length) |
| 2635 | 2635 | {
|
| 2636 | - global $wp_query, $geodir_is_widget_listing; |
|
| 2636 | + global $wp_query, $geodir_is_widget_listing; |
|
| 2637 | 2637 | if ($geodir_is_widget_listing) {
|
| 2638 | 2638 | return $length; |
| 2639 | 2639 | } |
| 2640 | 2640 | |
| 2641 | - if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
|
|
| 2642 | - $length = get_option('geodir_desc_word_limit');
|
|
| 2643 | - elseif (get_query_var('excerpt_length'))
|
|
| 2644 | - $length = get_query_var('excerpt_length');
|
|
| 2641 | + if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
|
|
| 2642 | + $length = get_option('geodir_desc_word_limit');
|
|
| 2643 | + elseif (get_query_var('excerpt_length'))
|
|
| 2644 | + $length = get_query_var('excerpt_length');
|
|
| 2645 | 2645 | |
| 2646 | - if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
|
|
| 2647 | - $length = get_option('geodir_author_desc_word_limit');
|
|
| 2646 | + if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
|
|
| 2647 | + $length = get_option('geodir_author_desc_word_limit');
|
|
| 2648 | 2648 | |
| 2649 | - return $length; |
|
| 2649 | + return $length; |
|
| 2650 | 2650 | } |
| 2651 | 2651 | |
| 2652 | 2652 | /** |
@@ -2661,21 +2661,21 @@ discard block |
||
| 2661 | 2661 | */ |
| 2662 | 2662 | function geodir_excerpt_more($more) |
| 2663 | 2663 | {
|
| 2664 | - global $post; |
|
| 2665 | - $all_postypes = geodir_get_posttypes(); |
|
| 2666 | - if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
|
|
| 2667 | - $out = ' <a class="excerpt-read-more" href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; |
|
| 2668 | - /** |
|
| 2669 | - * Filter excerpt read more text. |
|
| 2670 | - * |
|
| 2671 | - * @since 1.0.0 |
|
| 2672 | - */ |
|
| 2673 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
| 2674 | - $out .= '</a>'; |
|
| 2675 | - return $out; |
|
| 2676 | - } |
|
| 2664 | + global $post; |
|
| 2665 | + $all_postypes = geodir_get_posttypes(); |
|
| 2666 | + if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
|
|
| 2667 | + $out = ' <a class="excerpt-read-more" href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; |
|
| 2668 | + /** |
|
| 2669 | + * Filter excerpt read more text. |
|
| 2670 | + * |
|
| 2671 | + * @since 1.0.0 |
|
| 2672 | + */ |
|
| 2673 | + $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
| 2674 | + $out .= '</a>'; |
|
| 2675 | + return $out; |
|
| 2676 | + } |
|
| 2677 | 2677 | |
| 2678 | - return $more; |
|
| 2678 | + return $more; |
|
| 2679 | 2679 | } |
| 2680 | 2680 | |
| 2681 | 2681 | |
@@ -2692,63 +2692,63 @@ discard block |
||
| 2692 | 2692 | */ |
| 2693 | 2693 | function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy) |
| 2694 | 2694 | {
|
| 2695 | - global $plugin_prefix, $wpdb; |
|
| 2695 | + global $plugin_prefix, $wpdb; |
|
| 2696 | 2696 | |
| 2697 | - $gd_taxonomies = geodir_get_taxonomies(); |
|
| 2697 | + $gd_taxonomies = geodir_get_taxonomies(); |
|
| 2698 | 2698 | |
| 2699 | - if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
|
|
| 2699 | + if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
|
|
| 2700 | 2700 | |
| 2701 | - $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy); |
|
| 2702 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 2701 | + $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy); |
|
| 2702 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 2703 | 2703 | |
| 2704 | - $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']); |
|
| 2705 | - $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png'; |
|
| 2704 | + $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']); |
|
| 2705 | + $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png'; |
|
| 2706 | 2706 | |
| 2707 | - $posts = $wpdb->get_results( |
|
| 2708 | - $wpdb->prepare( |
|
| 2709 | - "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
| 2710 | - array($term_id, $taxonomy) |
|
| 2711 | - ) |
|
| 2712 | - ); |
|
| 2707 | + $posts = $wpdb->get_results( |
|
| 2708 | + $wpdb->prepare( |
|
| 2709 | + "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
| 2710 | + array($term_id, $taxonomy) |
|
| 2711 | + ) |
|
| 2712 | + ); |
|
| 2713 | 2713 | |
| 2714 | - if (!empty($posts)): |
|
| 2715 | - foreach ($posts as $post_obj) {
|
|
| 2714 | + if (!empty($posts)): |
|
| 2715 | + foreach ($posts as $post_obj) {
|
|
| 2716 | 2716 | |
| 2717 | - $lat = $post_obj->post_latitude; |
|
| 2718 | - $lng = $post_obj->post_longitude; |
|
| 2717 | + $lat = $post_obj->post_latitude; |
|
| 2718 | + $lng = $post_obj->post_longitude; |
|
| 2719 | 2719 | |
| 2720 | - $json = '{';
|
|
| 2721 | - $json .= '"id":"' . $post_obj->post_id . '",'; |
|
| 2722 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
| 2723 | - $json .= '"long_pos": "' . $lng . '",'; |
|
| 2724 | - $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",'; |
|
| 2725 | - $json .= '"icon":"' . $term_icon . '",'; |
|
| 2726 | - $json .= '"group":"catgroup' . $term_id . '"'; |
|
| 2727 | - $json .= '}'; |
|
| 2720 | + $json = '{';
|
|
| 2721 | + $json .= '"id":"' . $post_obj->post_id . '",'; |
|
| 2722 | + $json .= '"lat_pos": "' . $lat . '",'; |
|
| 2723 | + $json .= '"long_pos": "' . $lng . '",'; |
|
| 2724 | + $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",'; |
|
| 2725 | + $json .= '"icon":"' . $term_icon . '",'; |
|
| 2726 | + $json .= '"group":"catgroup' . $term_id . '"'; |
|
| 2727 | + $json .= '}'; |
|
| 2728 | 2728 | |
| 2729 | - if ($post_obj->default_category == $term_id) {
|
|
| 2729 | + if ($post_obj->default_category == $term_id) {
|
|
| 2730 | 2730 | |
| 2731 | - $wpdb->query( |
|
| 2732 | - $wpdb->prepare( |
|
| 2733 | - "UPDATE " . $table . " SET marker_json = %s where post_id = %d", |
|
| 2734 | - array($json, $post_obj->post_id) |
|
| 2735 | - ) |
|
| 2736 | - ); |
|
| 2737 | - } |
|
| 2731 | + $wpdb->query( |
|
| 2732 | + $wpdb->prepare( |
|
| 2733 | + "UPDATE " . $table . " SET marker_json = %s where post_id = %d", |
|
| 2734 | + array($json, $post_obj->post_id) |
|
| 2735 | + ) |
|
| 2736 | + ); |
|
| 2737 | + } |
|
| 2738 | 2738 | |
| 2739 | - $wpdb->query( |
|
| 2740 | - $wpdb->prepare( |
|
| 2741 | - "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
| 2742 | - array($json, $post_obj->post_id, $term_id) |
|
| 2743 | - ) |
|
| 2744 | - ); |
|
| 2739 | + $wpdb->query( |
|
| 2740 | + $wpdb->prepare( |
|
| 2741 | + "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
| 2742 | + array($json, $post_obj->post_id, $term_id) |
|
| 2743 | + ) |
|
| 2744 | + ); |
|
| 2745 | 2745 | |
| 2746 | - } |
|
| 2746 | + } |
|
| 2747 | 2747 | |
| 2748 | 2748 | |
| 2749 | - endif; |
|
| 2749 | + endif; |
|
| 2750 | 2750 | |
| 2751 | - } |
|
| 2751 | + } |
|
| 2752 | 2752 | |
| 2753 | 2753 | } |
| 2754 | 2754 | |
@@ -2762,14 +2762,14 @@ discard block |
||
| 2762 | 2762 | */ |
| 2763 | 2763 | function geodir_get_listing_author($listing_id = '') |
| 2764 | 2764 | {
|
| 2765 | - if ($listing_id == '') {
|
|
| 2766 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2767 | - $listing_id = $_REQUEST['pid']; |
|
| 2768 | - } |
|
| 2769 | - } |
|
| 2770 | - $listing = get_post(strip_tags($listing_id)); |
|
| 2771 | - $listing_author_id = $listing->post_author; |
|
| 2772 | - return $listing_author_id; |
|
| 2765 | + if ($listing_id == '') {
|
|
| 2766 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2767 | + $listing_id = $_REQUEST['pid']; |
|
| 2768 | + } |
|
| 2769 | + } |
|
| 2770 | + $listing = get_post(strip_tags($listing_id)); |
|
| 2771 | + $listing_author_id = $listing->post_author; |
|
| 2772 | + return $listing_author_id; |
|
| 2773 | 2773 | } |
| 2774 | 2774 | |
| 2775 | 2775 | |
@@ -2784,11 +2784,11 @@ discard block |
||
| 2784 | 2784 | */ |
| 2785 | 2785 | function geodir_lisiting_belong_to_user($listing_id, $user_id) |
| 2786 | 2786 | {
|
| 2787 | - $listing_author_id = geodir_get_listing_author($listing_id); |
|
| 2788 | - if ($listing_author_id == $user_id) |
|
| 2789 | - return true; |
|
| 2790 | - else |
|
| 2791 | - return false; |
|
| 2787 | + $listing_author_id = geodir_get_listing_author($listing_id); |
|
| 2788 | + if ($listing_author_id == $user_id) |
|
| 2789 | + return true; |
|
| 2790 | + else |
|
| 2791 | + return false; |
|
| 2792 | 2792 | |
| 2793 | 2793 | } |
| 2794 | 2794 | |
@@ -2804,17 +2804,17 @@ discard block |
||
| 2804 | 2804 | */ |
| 2805 | 2805 | function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true) |
| 2806 | 2806 | {
|
| 2807 | - global $current_user; |
|
| 2808 | - if ($exclude_admin) {
|
|
| 2809 | - foreach ($current_user->caps as $key => $caps) {
|
|
| 2810 | - if (geodir_strtolower($key) == 'administrator') {
|
|
| 2811 | - return true; |
|
| 2812 | - break; |
|
| 2813 | - } |
|
| 2814 | - } |
|
| 2815 | - } |
|
| 2816 | - |
|
| 2817 | - return geodir_lisiting_belong_to_user($listing_id, $current_user->ID); |
|
| 2807 | + global $current_user; |
|
| 2808 | + if ($exclude_admin) {
|
|
| 2809 | + foreach ($current_user->caps as $key => $caps) {
|
|
| 2810 | + if (geodir_strtolower($key) == 'administrator') {
|
|
| 2811 | + return true; |
|
| 2812 | + break; |
|
| 2813 | + } |
|
| 2814 | + } |
|
| 2815 | + } |
|
| 2816 | + |
|
| 2817 | + return geodir_lisiting_belong_to_user($listing_id, $current_user->ID); |
|
| 2818 | 2818 | } |
| 2819 | 2819 | |
| 2820 | 2820 | |
@@ -2830,17 +2830,17 @@ discard block |
||
| 2830 | 2830 | function geodir_only_supportable_attachments_remove($file) |
| 2831 | 2831 | {
|
| 2832 | 2832 | |
| 2833 | - global $wpdb; |
|
| 2833 | + global $wpdb; |
|
| 2834 | 2834 | |
| 2835 | - $matches = array(); |
|
| 2835 | + $matches = array(); |
|
| 2836 | 2836 | |
| 2837 | - $pattern = '/-\d+x\d+\./'; |
|
| 2838 | - preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE); |
|
| 2837 | + $pattern = '/-\d+x\d+\./'; |
|
| 2838 | + preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE); |
|
| 2839 | 2839 | |
| 2840 | - if (empty($matches)) |
|
| 2841 | - return ''; |
|
| 2842 | - else |
|
| 2843 | - return $file; |
|
| 2840 | + if (empty($matches)) |
|
| 2841 | + return ''; |
|
| 2842 | + else |
|
| 2843 | + return $file; |
|
| 2844 | 2844 | |
| 2845 | 2845 | } |
| 2846 | 2846 | |
@@ -2857,78 +2857,78 @@ discard block |
||
| 2857 | 2857 | function geodir_set_wp_featured_image($post_id) |
| 2858 | 2858 | {
|
| 2859 | 2859 | |
| 2860 | - global $wpdb, $plugin_prefix; |
|
| 2861 | - $uploads = wp_upload_dir(); |
|
| 2860 | + global $wpdb, $plugin_prefix; |
|
| 2861 | + $uploads = wp_upload_dir(); |
|
| 2862 | 2862 | // print_r($uploads ) ; |
| 2863 | - $post_first_image = $wpdb->get_results( |
|
| 2864 | - $wpdb->prepare( |
|
| 2865 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
| 2866 | - ) |
|
| 2867 | - ); |
|
| 2863 | + $post_first_image = $wpdb->get_results( |
|
| 2864 | + $wpdb->prepare( |
|
| 2865 | + "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
| 2866 | + ) |
|
| 2867 | + ); |
|
| 2868 | 2868 | |
| 2869 | - $old_attachment_name = ''; |
|
| 2870 | - $post_thumbnail_id = ''; |
|
| 2871 | - if (has_post_thumbnail($post_id)) {
|
|
| 2869 | + $old_attachment_name = ''; |
|
| 2870 | + $post_thumbnail_id = ''; |
|
| 2871 | + if (has_post_thumbnail($post_id)) {
|
|
| 2872 | 2872 | |
| 2873 | - if (has_post_thumbnail($post_id)) {
|
|
| 2873 | + if (has_post_thumbnail($post_id)) {
|
|
| 2874 | 2874 | |
| 2875 | - $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 2875 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 2876 | 2876 | |
| 2877 | - $old_attachment_name = basename(get_attached_file($post_thumbnail_id)); |
|
| 2877 | + $old_attachment_name = basename(get_attached_file($post_thumbnail_id)); |
|
| 2878 | 2878 | |
| 2879 | - } |
|
| 2880 | - } |
|
| 2881 | - |
|
| 2882 | - if (!empty($post_first_image)) {
|
|
| 2879 | + } |
|
| 2880 | + } |
|
| 2883 | 2881 | |
| 2884 | - $post_type = get_post_type($post_id); |
|
| 2882 | + if (!empty($post_first_image)) {
|
|
| 2885 | 2883 | |
| 2886 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
| 2884 | + $post_type = get_post_type($post_id); |
|
| 2887 | 2885 | |
| 2888 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
|
|
| 2886 | + $table_name = $plugin_prefix . $post_type . '_detail'; |
|
| 2889 | 2887 | |
| 2890 | - $new_attachment_name = basename($post_first_image[0]->file); |
|
| 2888 | + $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
|
|
| 2891 | 2889 | |
| 2892 | - if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
|
|
| 2890 | + $new_attachment_name = basename($post_first_image[0]->file); |
|
| 2893 | 2891 | |
| 2894 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
|
|
| 2892 | + if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
|
|
| 2895 | 2893 | |
| 2896 | - add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
|
|
| 2894 | + if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
|
|
| 2897 | 2895 | |
| 2898 | - wp_delete_attachment($post_thumbnail_id); |
|
| 2896 | + add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
|
|
| 2899 | 2897 | |
| 2900 | - } |
|
| 2901 | - $filename = $uploads['basedir'] . $post_first_image[0]->file; |
|
| 2898 | + wp_delete_attachment($post_thumbnail_id); |
|
| 2902 | 2899 | |
| 2903 | - $attachment = array( |
|
| 2904 | - 'post_mime_type' => $post_first_image[0]->mime_type, |
|
| 2905 | - 'guid' => $uploads['baseurl'] . $post_first_image[0]->file, |
|
| 2906 | - 'post_parent' => $post_id, |
|
| 2907 | - 'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
|
|
| 2908 | - 'post_content' => '' |
|
| 2909 | - ); |
|
| 2900 | + } |
|
| 2901 | + $filename = $uploads['basedir'] . $post_first_image[0]->file; |
|
| 2902 | + |
|
| 2903 | + $attachment = array( |
|
| 2904 | + 'post_mime_type' => $post_first_image[0]->mime_type, |
|
| 2905 | + 'guid' => $uploads['baseurl'] . $post_first_image[0]->file, |
|
| 2906 | + 'post_parent' => $post_id, |
|
| 2907 | + 'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
|
|
| 2908 | + 'post_content' => '' |
|
| 2909 | + ); |
|
| 2910 | 2910 | |
| 2911 | 2911 | |
| 2912 | - $id = wp_insert_attachment($attachment, $filename, $post_id); |
|
| 2912 | + $id = wp_insert_attachment($attachment, $filename, $post_id); |
|
| 2913 | 2913 | |
| 2914 | - if (!is_wp_error($id)) {
|
|
| 2914 | + if (!is_wp_error($id)) {
|
|
| 2915 | 2915 | |
| 2916 | - set_post_thumbnail($post_id, $id); |
|
| 2916 | + set_post_thumbnail($post_id, $id); |
|
| 2917 | 2917 | |
| 2918 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 2919 | - wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename)); |
|
| 2918 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 2919 | + wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename)); |
|
| 2920 | 2920 | |
| 2921 | - } |
|
| 2921 | + } |
|
| 2922 | 2922 | |
| 2923 | - } |
|
| 2923 | + } |
|
| 2924 | 2924 | |
| 2925 | - } else {
|
|
| 2926 | - //set_post_thumbnail($post_id,-1); |
|
| 2925 | + } else {
|
|
| 2926 | + //set_post_thumbnail($post_id,-1); |
|
| 2927 | 2927 | |
| 2928 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) |
|
| 2929 | - wp_delete_attachment($post_thumbnail_id); |
|
| 2928 | + if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) |
|
| 2929 | + wp_delete_attachment($post_thumbnail_id); |
|
| 2930 | 2930 | |
| 2931 | - } |
|
| 2931 | + } |
|
| 2932 | 2932 | } |
| 2933 | 2933 | |
| 2934 | 2934 | |
@@ -2943,53 +2943,53 @@ discard block |
||
| 2943 | 2943 | */ |
| 2944 | 2944 | function gd_copy_original_translation() |
| 2945 | 2945 | {
|
| 2946 | - if (geodir_is_wpml()) {
|
|
| 2947 | - global $wpdb, $table_prefix, $plugin_prefix; |
|
| 2948 | - $post_id = absint($_POST['post_id']); |
|
| 2949 | - $upload_dir = wp_upload_dir(); |
|
| 2950 | - $post_type = get_post_type($_POST['post_id']); |
|
| 2951 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2952 | - |
|
| 2953 | - $post_arr = $wpdb->get_results($wpdb->prepare( |
|
| 2954 | - "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
| 2955 | - array($post_id) |
|
| 2956 | - ) |
|
| 2957 | - , ARRAY_A); |
|
| 2958 | - |
|
| 2959 | - $arrImages = $wpdb->get_results( |
|
| 2960 | - $wpdb->prepare( |
|
| 2961 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
| 2962 | - array('%image%', $post_id)
|
|
| 2963 | - ) |
|
| 2964 | - ); |
|
| 2965 | - if ($arrImages) {
|
|
| 2966 | - $image_arr = array(); |
|
| 2967 | - foreach ($arrImages as $img) {
|
|
| 2968 | - $image_arr[] = $upload_dir['baseurl'] . $img->file; |
|
| 2969 | - } |
|
| 2970 | - $comma_separated = implode(",", $image_arr);
|
|
| 2971 | - $post_arr[0]['post_images'] = $comma_separated; |
|
| 2972 | - } |
|
| 2973 | - |
|
| 2974 | - |
|
| 2975 | - $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category']; |
|
| 2976 | - $cat_arr = array_filter(explode(",", $cats));
|
|
| 2977 | - $trans_cat = array(); |
|
| 2978 | - foreach ($cat_arr as $cat) {
|
|
| 2979 | - $trans_cat[] = geodir_wpml_object_id($cat, $post_arr[0]['post_type'] . 'category', false); |
|
| 2980 | - } |
|
| 2981 | - |
|
| 2982 | - |
|
| 2983 | - $post_arr[0]['categories'] = array_filter($trans_cat); |
|
| 2946 | + if (geodir_is_wpml()) {
|
|
| 2947 | + global $wpdb, $table_prefix, $plugin_prefix; |
|
| 2948 | + $post_id = absint($_POST['post_id']); |
|
| 2949 | + $upload_dir = wp_upload_dir(); |
|
| 2950 | + $post_type = get_post_type($_POST['post_id']); |
|
| 2951 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2952 | + |
|
| 2953 | + $post_arr = $wpdb->get_results($wpdb->prepare( |
|
| 2954 | + "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
| 2955 | + array($post_id) |
|
| 2956 | + ) |
|
| 2957 | + , ARRAY_A); |
|
| 2958 | + |
|
| 2959 | + $arrImages = $wpdb->get_results( |
|
| 2960 | + $wpdb->prepare( |
|
| 2961 | + "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
| 2962 | + array('%image%', $post_id)
|
|
| 2963 | + ) |
|
| 2964 | + ); |
|
| 2965 | + if ($arrImages) {
|
|
| 2966 | + $image_arr = array(); |
|
| 2967 | + foreach ($arrImages as $img) {
|
|
| 2968 | + $image_arr[] = $upload_dir['baseurl'] . $img->file; |
|
| 2969 | + } |
|
| 2970 | + $comma_separated = implode(",", $image_arr);
|
|
| 2971 | + $post_arr[0]['post_images'] = $comma_separated; |
|
| 2972 | + } |
|
| 2973 | + |
|
| 2974 | + |
|
| 2975 | + $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category']; |
|
| 2976 | + $cat_arr = array_filter(explode(",", $cats));
|
|
| 2977 | + $trans_cat = array(); |
|
| 2978 | + foreach ($cat_arr as $cat) {
|
|
| 2979 | + $trans_cat[] = geodir_wpml_object_id($cat, $post_arr[0]['post_type'] . 'category', false); |
|
| 2980 | + } |
|
| 2981 | + |
|
| 2982 | + |
|
| 2983 | + $post_arr[0]['categories'] = array_filter($trans_cat); |
|
| 2984 | 2984 | //print_r($image_arr); |
| 2985 | - //print_r($arrImages); |
|
| 2986 | - //echo $_REQUEST['lang']; |
|
| 2985 | + //print_r($arrImages); |
|
| 2986 | + //echo $_REQUEST['lang']; |
|
| 2987 | 2987 | //print_r($post_arr); |
| 2988 | 2988 | //print_r($trans_cat); |
| 2989 | - echo json_encode($post_arr[0]); |
|
| 2989 | + echo json_encode($post_arr[0]); |
|
| 2990 | 2990 | |
| 2991 | - } |
|
| 2992 | - die(); |
|
| 2991 | + } |
|
| 2992 | + die(); |
|
| 2993 | 2993 | } |
| 2994 | 2994 | |
| 2995 | 2995 | |
@@ -3009,54 +3009,54 @@ discard block |
||
| 3009 | 3009 | function geodir_get_custom_fields_type($listing_type = '') |
| 3010 | 3010 | {
|
| 3011 | 3011 | |
| 3012 | - global $wpdb; |
|
| 3012 | + global $wpdb; |
|
| 3013 | 3013 | |
| 3014 | - if ($listing_type == '') |
|
| 3015 | - $listing_type = 'gd_place'; |
|
| 3014 | + if ($listing_type == '') |
|
| 3015 | + $listing_type = 'gd_place'; |
|
| 3016 | 3016 | |
| 3017 | - $fields_info = array(); |
|
| 3017 | + $fields_info = array(); |
|
| 3018 | 3018 | |
| 3019 | - $get_data = $wpdb->get_results( |
|
| 3020 | - $wpdb->prepare( |
|
| 3021 | - "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'", |
|
| 3022 | - array($listing_type) |
|
| 3023 | - ) |
|
| 3024 | - ); |
|
| 3019 | + $get_data = $wpdb->get_results( |
|
| 3020 | + $wpdb->prepare( |
|
| 3021 | + "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'", |
|
| 3022 | + array($listing_type) |
|
| 3023 | + ) |
|
| 3024 | + ); |
|
| 3025 | 3025 | |
| 3026 | - if (!empty($get_data)) {
|
|
| 3026 | + if (!empty($get_data)) {
|
|
| 3027 | 3027 | |
| 3028 | - foreach ($get_data as $data) {
|
|
| 3028 | + foreach ($get_data as $data) {
|
|
| 3029 | 3029 | |
| 3030 | - if ($data->field_type == 'address') {
|
|
| 3030 | + if ($data->field_type == 'address') {
|
|
| 3031 | 3031 | |
| 3032 | - $extra_fields = unserialize($data->extra_fields); |
|
| 3032 | + $extra_fields = unserialize($data->extra_fields); |
|
| 3033 | 3033 | |
| 3034 | - $prefix = $data->htmlvar_name . '_'; |
|
| 3034 | + $prefix = $data->htmlvar_name . '_'; |
|
| 3035 | 3035 | |
| 3036 | - $fields_info[$prefix . 'address'] = $data->field_type; |
|
| 3036 | + $fields_info[$prefix . 'address'] = $data->field_type; |
|
| 3037 | 3037 | |
| 3038 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
|
| 3039 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3038 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
|
| 3039 | + $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3040 | 3040 | |
| 3041 | - } else {
|
|
| 3041 | + } else {
|
|
| 3042 | 3042 | |
| 3043 | - $fields_info[$data->htmlvar_name] = $data->field_type; |
|
| 3043 | + $fields_info[$data->htmlvar_name] = $data->field_type; |
|
| 3044 | 3044 | |
| 3045 | - } |
|
| 3045 | + } |
|
| 3046 | 3046 | |
| 3047 | - } |
|
| 3047 | + } |
|
| 3048 | 3048 | |
| 3049 | - } |
|
| 3049 | + } |
|
| 3050 | 3050 | |
| 3051 | - /** |
|
| 3052 | - * Filter to modify custom fields info using listing post type. |
|
| 3053 | - * |
|
| 3054 | - * @since 1.0.0 |
|
| 3055 | - * @package GeoDirectory |
|
| 3056 | - * @return array $fields_info Custom fields info. |
|
| 3057 | - * @param string $listing_type The listing post type. |
|
| 3058 | - */ |
|
| 3059 | - return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
|
|
| 3051 | + /** |
|
| 3052 | + * Filter to modify custom fields info using listing post type. |
|
| 3053 | + * |
|
| 3054 | + * @since 1.0.0 |
|
| 3055 | + * @package GeoDirectory |
|
| 3056 | + * @return array $fields_info Custom fields info. |
|
| 3057 | + * @param string $listing_type The listing post type. |
|
| 3058 | + */ |
|
| 3059 | + return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
|
|
| 3060 | 3060 | } |
| 3061 | 3061 | |
| 3062 | 3062 | |
@@ -3071,58 +3071,58 @@ discard block |
||
| 3071 | 3071 | */ |
| 3072 | 3072 | function geodir_function_post_updated($post_ID, $post_after, $post_before) |
| 3073 | 3073 | {
|
| 3074 | - $post_type = get_post_type($post_ID); |
|
| 3074 | + $post_type = get_post_type($post_ID); |
|
| 3075 | 3075 | |
| 3076 | - if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
|
|
| 3077 | - // send notification to client when post moves from draft to publish |
|
| 3078 | - if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
|
|
| 3079 | - $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL; |
|
| 3080 | - $post_author_data = get_userdata($post_author_id); |
|
| 3076 | + if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
|
|
| 3077 | + // send notification to client when post moves from draft to publish |
|
| 3078 | + if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
|
|
| 3079 | + $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL; |
|
| 3080 | + $post_author_data = get_userdata($post_author_id); |
|
| 3081 | 3081 | |
| 3082 | - $to_name = geodir_get_client_name($post_author_id); |
|
| 3082 | + $to_name = geodir_get_client_name($post_author_id); |
|
| 3083 | 3083 | |
| 3084 | - $from_email = geodir_get_site_email_id(); |
|
| 3085 | - $from_name = get_site_emailName(); |
|
| 3086 | - $to_email = $post_author_data->user_email; |
|
| 3084 | + $from_email = geodir_get_site_email_id(); |
|
| 3085 | + $from_name = get_site_emailName(); |
|
| 3086 | + $to_email = $post_author_data->user_email; |
|
| 3087 | 3087 | |
| 3088 | - if (!is_email($to_email) && !empty($post_author_data->user_email)) {
|
|
| 3089 | - $to_email = $post_author_data->user_email; |
|
| 3090 | - } |
|
| 3088 | + if (!is_email($to_email) && !empty($post_author_data->user_email)) {
|
|
| 3089 | + $to_email = $post_author_data->user_email; |
|
| 3090 | + } |
|
| 3091 | 3091 | |
| 3092 | - $message_type = 'listing_published'; |
|
| 3092 | + $message_type = 'listing_published'; |
|
| 3093 | 3093 | |
| 3094 | - if (get_option('geodir_post_published_email_subject') == '') {
|
|
| 3095 | - update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
|
|
| 3096 | - } |
|
| 3094 | + if (get_option('geodir_post_published_email_subject') == '') {
|
|
| 3095 | + update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
|
|
| 3096 | + } |
|
| 3097 | 3097 | |
| 3098 | - if (get_option('geodir_post_published_email_content') == '') {
|
|
| 3099 | - update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
|
|
| 3100 | - } |
|
| 3098 | + if (get_option('geodir_post_published_email_content') == '') {
|
|
| 3099 | + update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
|
|
| 3100 | + } |
|
| 3101 | 3101 | |
| 3102 | - /** |
|
| 3103 | - * Called before sending the email when listing gets published. |
|
| 3104 | - * |
|
| 3105 | - * @since 1.0.0 |
|
| 3106 | - * @package GeoDirectory |
|
| 3107 | - * @param object $post_after The post object after update. |
|
| 3108 | - * @param object $post_before The post object before update. |
|
| 3109 | - */ |
|
| 3110 | - do_action('geodir_before_listing_published_email', $post_after, $post_before);
|
|
| 3111 | - if (is_email($to_email)) {
|
|
| 3112 | - geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID); |
|
| 3113 | - } |
|
| 3102 | + /** |
|
| 3103 | + * Called before sending the email when listing gets published. |
|
| 3104 | + * |
|
| 3105 | + * @since 1.0.0 |
|
| 3106 | + * @package GeoDirectory |
|
| 3107 | + * @param object $post_after The post object after update. |
|
| 3108 | + * @param object $post_before The post object before update. |
|
| 3109 | + */ |
|
| 3110 | + do_action('geodir_before_listing_published_email', $post_after, $post_before);
|
|
| 3111 | + if (is_email($to_email)) {
|
|
| 3112 | + geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID); |
|
| 3113 | + } |
|
| 3114 | 3114 | |
| 3115 | - /** |
|
| 3116 | - * Called after sending the email when listing gets published. |
|
| 3117 | - * |
|
| 3118 | - * @since 1.0.0 |
|
| 3119 | - * @package GeoDirectory |
|
| 3120 | - * @param object $post_after The post object after update. |
|
| 3121 | - * @param object $post_before The post object before update. |
|
| 3122 | - */ |
|
| 3123 | - do_action('geodir_after_listing_published_email', $post_after, $post_before);
|
|
| 3124 | - } |
|
| 3125 | - } |
|
| 3115 | + /** |
|
| 3116 | + * Called after sending the email when listing gets published. |
|
| 3117 | + * |
|
| 3118 | + * @since 1.0.0 |
|
| 3119 | + * @package GeoDirectory |
|
| 3120 | + * @param object $post_after The post object after update. |
|
| 3121 | + * @param object $post_before The post object before update. |
|
| 3122 | + */ |
|
| 3123 | + do_action('geodir_after_listing_published_email', $post_after, $post_before);
|
|
| 3124 | + } |
|
| 3125 | + } |
|
| 3126 | 3126 | } |
| 3127 | 3127 | |
| 3128 | 3128 | add_action('wp_head', 'geodir_fb_like_thumbnail');
|
@@ -3137,46 +3137,46 @@ discard block |
||
| 3137 | 3137 | */ |
| 3138 | 3138 | function geodir_fb_like_thumbnail(){
|
| 3139 | 3139 | |
| 3140 | - $facebook_image = ''; |
|
| 3141 | - |
|
| 3142 | - if(is_single()){// single post
|
|
| 3143 | - global $post; |
|
| 3144 | - if(isset($post->featured_image) && $post->featured_image){
|
|
| 3145 | - $upload_dir = wp_upload_dir(); |
|
| 3146 | - $facebook_image = $upload_dir['baseurl'].$post->featured_image; |
|
| 3147 | - |
|
| 3148 | - } |
|
| 3149 | - }elseif(geodir_is_page('location')){// location page
|
|
| 3150 | - if (function_exists('geodir_get_location_seo')) {
|
|
| 3151 | - $seo = geodir_get_location_seo(); |
|
| 3152 | - if (isset($seo->seo_image) && $seo->seo_image) {
|
|
| 3153 | - $image = wp_get_attachment_image_src($seo->seo_image, 'full'); |
|
| 3154 | - $facebook_image = isset($image[0]) ? $image[0] : ''; |
|
| 3155 | - } |
|
| 3156 | - } |
|
| 3140 | + $facebook_image = ''; |
|
| 3141 | + |
|
| 3142 | + if(is_single()){// single post
|
|
| 3143 | + global $post; |
|
| 3144 | + if(isset($post->featured_image) && $post->featured_image){
|
|
| 3145 | + $upload_dir = wp_upload_dir(); |
|
| 3146 | + $facebook_image = $upload_dir['baseurl'].$post->featured_image; |
|
| 3147 | + |
|
| 3148 | + } |
|
| 3149 | + }elseif(geodir_is_page('location')){// location page
|
|
| 3150 | + if (function_exists('geodir_get_location_seo')) {
|
|
| 3151 | + $seo = geodir_get_location_seo(); |
|
| 3152 | + if (isset($seo->seo_image) && $seo->seo_image) {
|
|
| 3153 | + $image = wp_get_attachment_image_src($seo->seo_image, 'full'); |
|
| 3154 | + $facebook_image = isset($image[0]) ? $image[0] : ''; |
|
| 3155 | + } |
|
| 3156 | + } |
|
| 3157 | 3157 | |
| 3158 | - if(!$facebook_image){
|
|
| 3159 | - global $post; |
|
| 3158 | + if(!$facebook_image){
|
|
| 3159 | + global $post; |
|
| 3160 | 3160 | |
| 3161 | - if (has_post_thumbnail( $post->ID ) ){
|
|
| 3162 | - $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); |
|
| 3163 | - $facebook_image = isset($image[0]) ? $image[0] : ''; |
|
| 3164 | - } |
|
| 3165 | - } |
|
| 3166 | - } |
|
| 3161 | + if (has_post_thumbnail( $post->ID ) ){
|
|
| 3162 | + $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); |
|
| 3163 | + $facebook_image = isset($image[0]) ? $image[0] : ''; |
|
| 3164 | + } |
|
| 3165 | + } |
|
| 3166 | + } |
|
| 3167 | 3167 | |
| 3168 | 3168 | |
| 3169 | - /** |
|
| 3170 | - * Filter the facebook share image. |
|
| 3171 | - * |
|
| 3172 | - * @since 1.6.22 |
|
| 3173 | - * @param string $facebook_image The image URL or blank. |
|
| 3174 | - */ |
|
| 3175 | - $facebook_image = apply_filters('geodir_fb_share_image',$facebook_image);
|
|
| 3169 | + /** |
|
| 3170 | + * Filter the facebook share image. |
|
| 3171 | + * |
|
| 3172 | + * @since 1.6.22 |
|
| 3173 | + * @param string $facebook_image The image URL or blank. |
|
| 3174 | + */ |
|
| 3175 | + $facebook_image = apply_filters('geodir_fb_share_image',$facebook_image);
|
|
| 3176 | 3176 | |
| 3177 | - if($facebook_image){
|
|
| 3178 | - echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$facebook_image\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n"; |
|
| 3179 | - } |
|
| 3177 | + if($facebook_image){
|
|
| 3178 | + echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$facebook_image\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n"; |
|
| 3179 | + } |
|
| 3180 | 3180 | |
| 3181 | 3181 | |
| 3182 | 3182 | } |
@@ -3190,11 +3190,11 @@ discard block |
||
| 3190 | 3190 | * @since 1.6.22 |
| 3191 | 3191 | */ |
| 3192 | 3192 | function geodir_delete_map_cache(){
|
| 3193 | - $files = glob(realpath(dirname(__FILE__))."/map-functions/map-cache/*.json"); // get all file names |
|
| 3194 | - foreach($files as $file){ // iterate files
|
|
| 3195 | - if(is_file($file)) |
|
| 3196 | - unlink($file); // delete file |
|
| 3197 | - } |
|
| 3193 | + $files = glob(realpath(dirname(__FILE__))."/map-functions/map-cache/*.json"); // get all file names |
|
| 3194 | + foreach($files as $file){ // iterate files
|
|
| 3195 | + if(is_file($file)) |
|
| 3196 | + unlink($file); // delete file |
|
| 3197 | + } |
|
| 3198 | 3198 | } |
| 3199 | 3199 | |
| 3200 | 3200 | |
@@ -3207,22 +3207,22 @@ discard block |
||
| 3207 | 3207 | */ |
| 3208 | 3208 | function geodir_clear_map_cache_on_save($post_id, $post) {
|
| 3209 | 3209 | |
| 3210 | - if(!get_option('geodir_enable_map_cache')){
|
|
| 3211 | - return; |
|
| 3212 | - } |
|
| 3210 | + if(!get_option('geodir_enable_map_cache')){
|
|
| 3211 | + return; |
|
| 3212 | + } |
|
| 3213 | 3213 | |
| 3214 | - if ( isset( $post->post_type ) && ( $post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post' ) ) {
|
|
| 3215 | - return; |
|
| 3216 | - } |
|
| 3214 | + if ( isset( $post->post_type ) && ( $post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post' ) ) {
|
|
| 3215 | + return; |
|
| 3216 | + } |
|
| 3217 | 3217 | |
| 3218 | - $geodir_posttypes = geodir_get_posttypes(); |
|
| 3218 | + $geodir_posttypes = geodir_get_posttypes(); |
|
| 3219 | 3219 | |
| 3220 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
|
| 3221 | - return; |
|
| 3222 | - } |
|
| 3220 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
|
| 3221 | + return; |
|
| 3222 | + } |
|
| 3223 | 3223 | |
| 3224 | - if ( ! wp_is_post_revision( $post_id ) && isset( $post->post_type ) && in_array( $post->post_type, $geodir_posttypes ) ) {
|
|
| 3225 | - geodir_delete_map_cache(); |
|
| 3226 | - } |
|
| 3224 | + if ( ! wp_is_post_revision( $post_id ) && isset( $post->post_type ) && in_array( $post->post_type, $geodir_posttypes ) ) {
|
|
| 3225 | + geodir_delete_map_cache(); |
|
| 3226 | + } |
|
| 3227 | 3227 | |
| 3228 | 3228 | } |
| 3229 | 3229 | \ No newline at end of file |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | if (!isset($default_cat) || empty($default_cat)) {
|
| 28 | 28 | $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : ''; |
| 29 | - }else{
|
|
| 30 | - if(!is_int($default_cat)){
|
|
| 29 | + } else {
|
|
| 30 | + if (!is_int($default_cat)) {
|
|
| 31 | 31 | $category = get_term_by('name', $default_cat, $taxonomy);
|
| 32 | - if(isset($category->term_id)){
|
|
| 33 | - $default_cat = $category->term_id; |
|
| 32 | + if (isset($category->term_id)) {
|
|
| 33 | + $default_cat = $category->term_id; |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | if ($default_pos === false) {
|
| 60 | 60 | |
| 61 | - $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str); |
|
| 61 | + $change_cat_str = str_replace($default_cat.',y:', $default_cat.',y,d:', $change_cat_str); |
|
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $gd_post = $post; |
| 147 | 147 | if (!empty($gd_post) && is_array($gd_post)) {
|
| 148 | - $gd_post = (object)$post; |
|
| 148 | + $gd_post = (object) $post; |
|
| 149 | 149 | |
| 150 | 150 | // Fix WPML duplicate. |
| 151 | 151 | if (geodir_is_wpml() && !empty($request_info['action']) && $request_info['action'] == 'editpost' && !empty($request_info['icl_trid']) && !isset($post['post_date'])) {
|
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $send_post_submit_mail = false; |
| 240 | 240 | |
| 241 | 241 | // unhook this function so it doesn't loop infinitely |
| 242 | - remove_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 242 | + remove_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 243 | 243 | |
| 244 | 244 | if (isset($request_info['pid']) && $request_info['pid'] != '') {
|
| 245 | 245 | $post['ID'] = $request_info['pid']; |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // re-hook this function |
| 266 | - add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 266 | + add_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 267 | 267 | |
| 268 | 268 | $post_tags = ''; |
| 269 | 269 | if (!isset($request_info['post_tags'])) {
|
| 270 | 270 | |
| 271 | 271 | $post_type = $request_info['listing_type']; |
| 272 | - $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
|
|
| 272 | + $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type.'_tags', array('fields' => 'names')));
|
|
| 273 | 273 | |
| 274 | 274 | } |
| 275 | 275 | |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | $payment_info = array(); |
| 288 | 288 | $package_info = array(); |
| 289 | 289 | |
| 290 | - $package_info = (array)geodir_post_package_info($package_info, $post); |
|
| 290 | + $package_info = (array) geodir_post_package_info($package_info, $post); |
|
| 291 | 291 | |
| 292 | 292 | $post_package_id = geodir_get_post_meta($last_post_id, 'package_id'); |
| 293 | 293 | |
| 294 | 294 | if (!empty($package_info) && !$post_package_id) {
|
| 295 | 295 | if (isset($package_info['days']) && $package_info['days'] != 0) {
|
| 296 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
|
|
| 296 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['days']." days"));
|
|
| 297 | 297 | } else {
|
| 298 | 298 | $payment_info['expire_date'] = 'Never'; |
| 299 | 299 | } |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | $extrafields = $val['extra_fields']; |
| 315 | 315 | |
| 316 | 316 | if (trim($type) == 'address') {
|
| 317 | - $prefix = $name . '_'; |
|
| 318 | - $address = $prefix . 'address'; |
|
| 317 | + $prefix = $name.'_'; |
|
| 318 | + $address = $prefix.'address'; |
|
| 319 | 319 | |
| 320 | 320 | if (isset($request_info[$address]) && $request_info[$address] != '') {
|
| 321 | 321 | $gd_post_info[$address] = wp_slash($request_info[$address]); |
@@ -325,59 +325,59 @@ discard block |
||
| 325 | 325 | $extrafields = unserialize($extrafields); |
| 326 | 326 | |
| 327 | 327 | |
| 328 | - if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
|
|
| 328 | + if (!isset($request_info[$prefix.'city']) || $request_info[$prefix.'city'] == '') {
|
|
| 329 | 329 | |
| 330 | 330 | $location_result = geodir_get_default_location(); |
| 331 | 331 | |
| 332 | - $gd_post_info[$prefix . 'city'] = $location_result->city; |
|
| 333 | - $gd_post_info[$prefix . 'region'] = $location_result->region; |
|
| 334 | - $gd_post_info[$prefix . 'country'] = $location_result->country; |
|
| 332 | + $gd_post_info[$prefix.'city'] = $location_result->city; |
|
| 333 | + $gd_post_info[$prefix.'region'] = $location_result->region; |
|
| 334 | + $gd_post_info[$prefix.'country'] = $location_result->country; |
|
| 335 | 335 | |
| 336 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 336 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location |
|
| 337 | 337 | |
| 338 | 338 | } else {
|
| 339 | 339 | |
| 340 | - $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city']; |
|
| 341 | - $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region']; |
|
| 342 | - $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country']; |
|
| 340 | + $gd_post_info[$prefix.'city'] = $request_info[$prefix.'city']; |
|
| 341 | + $gd_post_info[$prefix.'region'] = $request_info[$prefix.'region']; |
|
| 342 | + $gd_post_info[$prefix.'country'] = $request_info[$prefix.'country']; |
|
| 343 | 343 | |
| 344 | 344 | //----------set post locations when import dummy data------- |
| 345 | 345 | $location_result = geodir_get_default_location(); |
| 346 | 346 | |
| 347 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location |
|
| 347 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location |
|
| 348 | 348 | //----------------------------------------------------------------- |
| 349 | 349 | |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | |
| 353 | - if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
|
|
| 354 | - $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip']; |
|
| 353 | + if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix.'zip'])) {
|
|
| 354 | + $gd_post_info[$prefix.'zip'] = $request_info[$prefix.'zip']; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | |
| 358 | 358 | if (isset($extrafields['show_map']) && $extrafields['show_map']) {
|
| 359 | 359 | |
| 360 | - if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
|
|
| 361 | - $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude']; |
|
| 360 | + if (isset($request_info[$prefix.'latitude']) && $request_info[$prefix.'latitude'] != '') {
|
|
| 361 | + $gd_post_info[$prefix.'latitude'] = $request_info[$prefix.'latitude']; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
|
|
| 365 | - $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude']; |
|
| 364 | + if (isset($request_info[$prefix.'longitude']) && $request_info[$prefix.'longitude'] != '') {
|
|
| 365 | + $gd_post_info[$prefix.'longitude'] = $request_info[$prefix.'longitude']; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
|
|
| 369 | - $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview']; |
|
| 368 | + if (isset($request_info[$prefix.'mapview']) && $request_info[$prefix.'mapview'] != '') {
|
|
| 369 | + $gd_post_info[$prefix.'mapview'] = $request_info[$prefix.'mapview']; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
|
|
| 373 | - $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom']; |
|
| 372 | + if (isset($request_info[$prefix.'mapzoom']) && $request_info[$prefix.'mapzoom'] != '') {
|
|
| 373 | + $gd_post_info[$prefix.'mapzoom'] = $request_info[$prefix.'mapzoom']; |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | // show lat lng |
| 379 | - if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
|
|
| 380 | - $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng']; |
|
| 379 | + if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix.'latlng'])) {
|
|
| 380 | + $gd_post_info[$prefix.'latlng'] = $request_info[$prefix.'latlng']; |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
@@ -403,16 +403,16 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | // check if we need to change the format or not |
| 405 | 405 | $date_format_len = strlen(str_replace(' ', '', $date_format));
|
| 406 | - if($date_format_len>5){// if greater then 5 then it's the old style format.
|
|
| 406 | + if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
|
|
| 407 | 407 | |
| 408 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
|
|
| 409 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
|
| 408 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
|
|
| 409 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
|
|
| 410 | 410 | |
| 411 | 411 | $date_format = str_replace($search, $replace, $date_format); |
| 412 | 412 | |
| 413 | 413 | $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
|
| 414 | 414 | |
| 415 | - }else{
|
|
| 415 | + } else {
|
|
| 416 | 416 | $post_htmlvar_value = $request_info[$name]; |
| 417 | 417 | } |
| 418 | 418 | |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | if (isset($request_info[$name])) {
|
| 427 | 427 | $gd_post_info[$name] = $request_info[$name]; |
| 428 | 428 | } else {
|
| 429 | - if (isset($request_info['gd_field_' . $name])) {
|
|
| 429 | + if (isset($request_info['gd_field_'.$name])) {
|
|
| 430 | 430 | $gd_post_info[$name] = ''; /* fix de-select for multiselect */ |
| 431 | 431 | } |
| 432 | 432 | } |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | if (is_array($post_tags)) {
|
| 489 | - $taxonomy = $request_info['listing_type'] . '_tags'; |
|
| 489 | + $taxonomy = $request_info['listing_type'].'_tags'; |
|
| 490 | 490 | wp_set_object_terms($last_post_id, $post_tags, $taxonomy); |
| 491 | 491 | } |
| 492 | 492 | |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $tmpimgArr = trim($request_info['post_images'], ","); |
| 499 | 499 | $tmpimgArr = explode(",", $tmpimgArr);
|
| 500 | 500 | geodir_save_post_images($last_post_id, $tmpimgArr, $dummy); |
| 501 | - } else{
|
|
| 501 | + } else {
|
|
| 502 | 502 | geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy); |
| 503 | 503 | } |
| 504 | 504 | |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | if (!in_array($post_type, $all_postypes)) |
| 580 | 580 | return false; |
| 581 | 581 | |
| 582 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 582 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 583 | 583 | |
| 584 | 584 | /** |
| 585 | 585 | * Apply Filter to change Post info |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | * @since 1.0.0 |
| 590 | 590 | * @package GeoDirectory |
| 591 | 591 | */ |
| 592 | - $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
|
|
| 592 | + $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM ".$wpdb->posts." p,".$table." pd
|
|
| 593 | 593 | WHERE p.ID = pd.post_id |
| 594 | 594 | AND pd.post_id = %d", $post_id)); |
| 595 | 595 | |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | |
| 653 | 653 | $post_type = get_post_type($post_id); |
| 654 | 654 | |
| 655 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 655 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 656 | 656 | |
| 657 | 657 | /** |
| 658 | 658 | * Filter to change Post info |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | $columns = $wpdb->get_col("show columns from $table");
|
| 675 | 675 | foreach ($postmeta as $mkey => $mval) {
|
| 676 | - if(in_array($mkey,$columns)) {
|
|
| 676 | + if (in_array($mkey, $columns)) {
|
|
| 677 | 677 | if (is_array($mval)) {
|
| 678 | 678 | $mval = implode(",", $mval);
|
| 679 | 679 | } |
@@ -702,12 +702,12 @@ discard block |
||
| 702 | 702 | */ |
| 703 | 703 | do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
|
| 704 | 704 | |
| 705 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 705 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 706 | 706 | |
| 707 | 707 | $query_string_array[] = $post_id; |
| 708 | 708 | $wpdb->query( |
| 709 | 709 | $wpdb->prepare( |
| 710 | - "UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d", |
|
| 710 | + "UPDATE ".$table." SET ".$query_string_escaped." where post_id =%d", |
|
| 711 | 711 | $query_string_array |
| 712 | 712 | ) |
| 713 | 713 | ); |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | array_unshift($query_string_array, $post_id); |
| 719 | 719 | $wpdb->query( |
| 720 | 720 | $wpdb->prepare( |
| 721 | - "INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped, |
|
| 721 | + "INSERT INTO ".$table." SET post_id = %d,".$query_string_escaped, |
|
| 722 | 722 | $query_string_array |
| 723 | 723 | ) |
| 724 | 724 | ); |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | $post_type = get_post_type($post_id); |
| 766 | 766 | |
| 767 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 767 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 768 | 768 | |
| 769 | 769 | if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
|
| 770 | 770 | |
@@ -772,11 +772,11 @@ discard block |
||
| 772 | 772 | $meta_value = implode(",", $meta_value);
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 775 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 776 | 776 | |
| 777 | 777 | $wpdb->query( |
| 778 | 778 | $wpdb->prepare( |
| 779 | - "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d", |
|
| 779 | + "UPDATE ".$table." SET ".$postmeta." = '".$meta_value."' where post_id =%d", |
|
| 780 | 780 | array($post_id) |
| 781 | 781 | ) |
| 782 | 782 | ); |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | |
| 786 | 786 | $wpdb->query( |
| 787 | 787 | $wpdb->prepare( |
| 788 | - "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'", |
|
| 788 | + "INSERT INTO ".$table." SET post_id = %d, ".$postmeta." = '".$meta_value."'", |
|
| 789 | 789 | array($post_id) |
| 790 | 790 | ) |
| 791 | 791 | ); |
@@ -818,14 +818,14 @@ discard block |
||
| 818 | 818 | |
| 819 | 819 | $post_type = get_post_type($post_id); |
| 820 | 820 | |
| 821 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 821 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 822 | 822 | |
| 823 | 823 | if (is_array($postmeta) && !empty($postmeta) && $post_id) {
|
| 824 | 824 | $post_meta_set_query = ''; |
| 825 | 825 | |
| 826 | 826 | foreach ($postmeta as $mkey) {
|
| 827 | 827 | if ($mval != '') |
| 828 | - $post_meta_set_query .= $mkey . " = '', "; |
|
| 828 | + $post_meta_set_query .= $mkey." = '', "; |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | $post_meta_set_query = trim($post_meta_set_query, ", "); |
@@ -834,11 +834,11 @@ discard block |
||
| 834 | 834 | return false; |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 837 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
|
|
| 838 | 838 | |
| 839 | 839 | $wpdb->query( |
| 840 | 840 | $wpdb->prepare( |
| 841 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d", |
|
| 841 | + "UPDATE ".$table." SET ".$post_meta_set_query." where post_id = %d", |
|
| 842 | 842 | array($post_id) |
| 843 | 843 | ) |
| 844 | 844 | ); |
@@ -847,11 +847,11 @@ discard block |
||
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | } elseif ($postmeta != '' && $post_id) {
|
| 850 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
|
|
| 850 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
|
|
| 851 | 851 | |
| 852 | 852 | $wpdb->query( |
| 853 | 853 | $wpdb->prepare( |
| 854 | - "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d", |
|
| 854 | + "UPDATE ".$table." SET ".$postmeta."= '' where post_id = %d", |
|
| 855 | 855 | array($post_id) |
| 856 | 856 | ) |
| 857 | 857 | ); |
@@ -893,10 +893,10 @@ discard block |
||
| 893 | 893 | if (!in_array($post_type, $all_postypes)) |
| 894 | 894 | return false; |
| 895 | 895 | |
| 896 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 896 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 897 | 897 | |
| 898 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
|
|
| 899 | - $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
|
|
| 898 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$meta_key."'") != '') {
|
|
| 899 | + $meta_value = $wpdb->get_var($wpdb->prepare("SELECT ".$meta_key." from ".$table." where post_id = %d", array($post_id)));
|
|
| 900 | 900 | |
| 901 | 901 | if ($meta_value && $meta_value !== '') {
|
| 902 | 902 | $meta_value = maybe_serialize($meta_value); |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | * @param string $meta_key The meta key to retrieve. |
| 916 | 916 | * @param bool $single Optional. Whether to return a single value. Default false. |
| 917 | 917 | */ |
| 918 | - return apply_filters( 'geodir_get_post_meta', $meta_value, $post_id, $meta_key, $single ); |
|
| 918 | + return apply_filters('geodir_get_post_meta', $meta_value, $post_id, $meta_key, $single);
|
|
| 919 | 919 | } |
| 920 | 920 | } |
| 921 | 921 | |
@@ -941,13 +941,13 @@ discard block |
||
| 941 | 941 | |
| 942 | 942 | $post_type = get_post_type($post_id); |
| 943 | 943 | |
| 944 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 944 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 945 | 945 | |
| 946 | 946 | $post_images = geodir_get_images($post_id); |
| 947 | 947 | |
| 948 | 948 | $wpdb->query( |
| 949 | 949 | $wpdb->prepare( |
| 950 | - "UPDATE " . $table . " SET featured_image = '' where post_id =%d", |
|
| 950 | + "UPDATE ".$table." SET featured_image = '' where post_id =%d", |
|
| 951 | 951 | array($post_id) |
| 952 | 952 | ) |
| 953 | 953 | ); |
@@ -977,12 +977,12 @@ discard block |
||
| 977 | 977 | $file_path = ''; |
| 978 | 978 | /* --------- start ------- */ |
| 979 | 979 | |
| 980 | - $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
|
|
| 980 | + $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
|
|
| 981 | 981 | |
| 982 | 982 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
| 983 | 983 | |
| 984 | 984 | |
| 985 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
|
|
| 985 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM ".GEODIR_ATTACHMENT_TABLE." WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
|
|
| 986 | 986 | |
| 987 | 987 | /* --------- end ------- */ |
| 988 | 988 | $curr_img_url = $post_image[$m]; |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | // If the uploaded file is the right format |
| 1027 | 1027 | if (in_array($uploaded_file_type, $allowed_file_types)) {
|
| 1028 | 1028 | if (!function_exists('wp_handle_upload')) {
|
| 1029 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1029 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | 1032 | if (!is_dir($geodir_uploadpath)) {
|
@@ -1034,41 +1034,41 @@ discard block |
||
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | $external_img = false; |
| 1037 | - if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) {
|
|
| 1037 | + if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
|
|
| 1038 | 1038 | } else {
|
| 1039 | 1039 | $external_img = true; |
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | if ($dummy || $external_img) {
|
| 1043 | 1043 | $uploaded_file = array(); |
| 1044 | - $uploaded = (array)fetch_remote_file($curr_img_url); |
|
| 1044 | + $uploaded = (array) fetch_remote_file($curr_img_url); |
|
| 1045 | 1045 | |
| 1046 | 1046 | if (isset($uploaded['error']) && empty($uploaded['error'])) {
|
| 1047 | 1047 | $new_name = basename($uploaded['file']); |
| 1048 | 1048 | $uploaded_file = $uploaded; |
| 1049 | - }else{
|
|
| 1050 | - print_r($uploaded);exit; |
|
| 1049 | + } else {
|
|
| 1050 | + print_r($uploaded); exit; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | $external_img = false; |
| 1053 | 1053 | } else {
|
| 1054 | - $new_name = $post_id . '_' . $file_name; |
|
| 1054 | + $new_name = $post_id.'_'.$file_name; |
|
| 1055 | 1055 | |
| 1056 | 1056 | if ($curr_img_dir == $sub_dir) {
|
| 1057 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1058 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1057 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1058 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1059 | 1059 | } else {
|
| 1060 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1061 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1060 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1061 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | $uploaded_file = ''; |
| 1065 | 1065 | |
| 1066 | 1066 | if (file_exists($img_path)) {
|
| 1067 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1067 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1068 | 1068 | $file_path = ''; |
| 1069 | - } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
|
|
| 1069 | + } else if (file_exists($uploads['basedir'].$curr_img_dir.$filename)) {
|
|
| 1070 | 1070 | $uploaded_file = true; |
| 1071 | - $file_path = $curr_img_dir . '/' . $filename; |
|
| 1071 | + $file_path = $curr_img_dir.'/'.$filename; |
|
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
@@ -1077,14 +1077,14 @@ discard block |
||
| 1077 | 1077 | |
| 1078 | 1078 | if (!empty($uploaded_file)) {
|
| 1079 | 1079 | if (!isset($file_path) || !$file_path) {
|
| 1080 | - $file_path = $sub_dir . '/' . $new_name; |
|
| 1080 | + $file_path = $sub_dir.'/'.$new_name; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
|
|
| 1083 | + $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'].$file_path);
|
|
| 1084 | 1084 | |
| 1085 | 1085 | if ($menu_order == 1) {
|
| 1086 | 1086 | |
| 1087 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
|
|
| 1087 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
|
|
| 1088 | 1088 | |
| 1089 | 1089 | } |
| 1090 | 1090 | |
@@ -1102,12 +1102,12 @@ discard block |
||
| 1102 | 1102 | |
| 1103 | 1103 | foreach ($attachment as $key => $val) {
|
| 1104 | 1104 | if ($val != '') |
| 1105 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1105 | + $attachment_set .= $key." = '".$val."', "; |
|
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | $attachment_set = trim($attachment_set, ", "); |
| 1109 | 1109 | |
| 1110 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 1110 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 1111 | 1111 | |
| 1112 | 1112 | $valid_file_ids[] = $wpdb->insert_id; |
| 1113 | 1113 | } |
@@ -1118,17 +1118,17 @@ discard block |
||
| 1118 | 1118 | } else {
|
| 1119 | 1119 | $valid_file_ids[] = $find_image; |
| 1120 | 1120 | |
| 1121 | - $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
|
|
| 1121 | + $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
|
|
| 1122 | 1122 | |
| 1123 | 1123 | $wpdb->query( |
| 1124 | 1124 | $wpdb->prepare( |
| 1125 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d", |
|
| 1125 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d where file =%s AND post_id =%d", |
|
| 1126 | 1126 | array($menu_order, $split_img_path[1], $post_id) |
| 1127 | 1127 | ) |
| 1128 | 1128 | ); |
| 1129 | 1129 | |
| 1130 | 1130 | if ($menu_order == 1) |
| 1131 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1131 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1132 | 1132 | |
| 1133 | 1133 | } |
| 1134 | 1134 | |
@@ -1152,9 +1152,9 @@ discard block |
||
| 1152 | 1152 | |
| 1153 | 1153 | foreach ($post_images as $img) {
|
| 1154 | 1154 | |
| 1155 | - if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
|
|
| 1155 | + if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
|
|
| 1156 | 1156 | |
| 1157 | - $invalid_files[] = (object)array('src' => $img->src);
|
|
| 1157 | + $invalid_files[] = (object) array('src' => $img->src);
|
|
| 1158 | 1158 | |
| 1159 | 1159 | } |
| 1160 | 1160 | |
@@ -1162,12 +1162,12 @@ discard block |
||
| 1162 | 1162 | |
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | - $invalid_files = (object)$invalid_files; |
|
| 1165 | + $invalid_files = (object) $invalid_files; |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | $remove_files[] = $post_id; |
| 1169 | 1169 | |
| 1170 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
|
|
| 1170 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ".$valid_files_condition." post_id = %d", $remove_files));
|
|
| 1171 | 1171 | |
| 1172 | 1172 | if (!empty($invalid_files)) |
| 1173 | 1173 | geodir_remove_attachments($invalid_files); |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | rmdir($dirPath); |
| 1208 | 1208 | } */ |
| 1209 | 1209 | |
| 1210 | - $dirname = $uploads_dir . '/temp_' . $current_user->ID; |
|
| 1210 | + $dirname = $uploads_dir.'/temp_'.$current_user->ID; |
|
| 1211 | 1211 | geodir_delete_directory($dirname); |
| 1212 | 1212 | } |
| 1213 | 1213 | |
@@ -1229,10 +1229,10 @@ discard block |
||
| 1229 | 1229 | return false; |
| 1230 | 1230 | while ($file = readdir($dir_handle)) {
|
| 1231 | 1231 | if ($file != "." && $file != "..") {
|
| 1232 | - if (!is_dir($dirname . "/" . $file)) |
|
| 1233 | - unlink($dirname . "/" . $file); |
|
| 1232 | + if (!is_dir($dirname."/".$file)) |
|
| 1233 | + unlink($dirname."/".$file); |
|
| 1234 | 1234 | else |
| 1235 | - geodir_delete_directory($dirname . '/' . $file); |
|
| 1235 | + geodir_delete_directory($dirname.'/'.$file); |
|
| 1236 | 1236 | } |
| 1237 | 1237 | } |
| 1238 | 1238 | closedir($dir_handle); |
@@ -1261,8 +1261,8 @@ discard block |
||
| 1261 | 1261 | foreach ($postcurr_images as $postimg) {
|
| 1262 | 1262 | $image_name_arr = explode('/', $postimg->src);
|
| 1263 | 1263 | $filename = end($image_name_arr); |
| 1264 | - if (file_exists($uploads_dir . '/' . $filename)) |
|
| 1265 | - unlink($uploads_dir . '/' . $filename); |
|
| 1264 | + if (file_exists($uploads_dir.'/'.$filename)) |
|
| 1265 | + unlink($uploads_dir.'/'.$filename); |
|
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | 1268 | } // endif |
@@ -1303,28 +1303,28 @@ discard block |
||
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | 1305 | if (!in_array($post_type, geodir_get_posttypes())) {
|
| 1306 | - return false;// if not a GD CPT return; |
|
| 1306 | + return false; // if not a GD CPT return; |
|
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | |
| 1310 | - $list_img_size = get_option('geodir_listing_img_size','default');
|
|
| 1310 | + $list_img_size = get_option('geodir_listing_img_size', 'default');
|
|
| 1311 | 1311 | |
| 1312 | - if( $size=='list-thumb' && $list_img_size != 'default' ){
|
|
| 1313 | - $fimg = get_the_post_thumbnail_url($post_id,$list_img_size); |
|
| 1314 | - if($fimg){
|
|
| 1312 | + if ($size == 'list-thumb' && $list_img_size != 'default') {
|
|
| 1313 | + $fimg = get_the_post_thumbnail_url($post_id, $list_img_size); |
|
| 1314 | + if ($fimg) {
|
|
| 1315 | 1315 | $uploads = wp_upload_dir(); |
| 1316 | 1316 | $uploads_baseurl = $uploads['baseurl']; |
| 1317 | - $file = str_replace($uploads_baseurl,'',$fimg); |
|
| 1317 | + $file = str_replace($uploads_baseurl, '', $fimg); |
|
| 1318 | 1318 | } |
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1321 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1322 | 1322 | |
| 1323 | 1323 | if (!$file) {
|
| 1324 | 1324 | if (isset($post->featured_image)) {
|
| 1325 | 1325 | $file = $post->featured_image; |
| 1326 | 1326 | } else {
|
| 1327 | - $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
|
|
| 1327 | + $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM ".$table." WHERE post_id = %d", array($post_id)));
|
|
| 1328 | 1328 | } |
| 1329 | 1329 | } |
| 1330 | 1330 | |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | |
| 1344 | 1344 | $file_name = $file_info['basename']; |
| 1345 | 1345 | |
| 1346 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1346 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
| 1347 | 1347 | /* |
| 1348 | 1348 | * Allows the filter of image src for such things as CDN change. |
| 1349 | 1349 | * |
@@ -1353,8 +1353,8 @@ discard block |
||
| 1353 | 1353 | * @param string $uploads_url The server upload directory url. |
| 1354 | 1354 | * @param string $uploads_baseurl The uploads dir base url. |
| 1355 | 1355 | */ |
| 1356 | - $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1357 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1356 | + $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
|
|
| 1357 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1358 | 1358 | $width = 0; |
| 1359 | 1359 | $height = 0; |
| 1360 | 1360 | if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | $file_name = $file_info['basename']; |
| 1398 | 1398 | |
| 1399 | 1399 | $img_arr['src'] = $default_img; |
| 1400 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1400 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1401 | 1401 | |
| 1402 | 1402 | $width = 0; |
| 1403 | 1403 | $height = 0; |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | 1416 | if (!empty($img_arr)) |
| 1417 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1417 | + return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1418 | 1418 | else |
| 1419 | 1419 | return false; |
| 1420 | 1420 | } |
@@ -1477,7 +1477,7 @@ discard block |
||
| 1477 | 1477 | |
| 1478 | 1478 | $arrImages = $wpdb->get_results( |
| 1479 | 1479 | $wpdb->prepare( |
| 1480 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ", |
|
| 1480 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d".$not_featured." ORDER BY menu_order ASC, ID DESC $limit_q ", |
|
| 1481 | 1481 | array('%image%', $post_id)
|
| 1482 | 1482 | ) |
| 1483 | 1483 | ); |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | |
| 1504 | 1504 | $file_name = $file_info['basename']; |
| 1505 | 1505 | |
| 1506 | - $uploads_url = $uploads_baseurl . $sub_dir; |
|
| 1506 | + $uploads_url = $uploads_baseurl.$sub_dir; |
|
| 1507 | 1507 | /* |
| 1508 | 1508 | * Allows the filter of image src for such things as CDN change. |
| 1509 | 1509 | * |
@@ -1513,8 +1513,8 @@ discard block |
||
| 1513 | 1513 | * @param string $uploads_url The server upload directory url. |
| 1514 | 1514 | * @param string $uploads_baseurl The uploads dir base url. |
| 1515 | 1515 | */ |
| 1516 | - $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
|
|
| 1517 | - $img_arr['path'] = $uploads_path . '/' . $file_name; |
|
| 1516 | + $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
|
|
| 1517 | + $img_arr['path'] = $uploads_path.'/'.$file_name; |
|
| 1518 | 1518 | $width = 0; |
| 1519 | 1519 | $height = 0; |
| 1520 | 1520 | if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
|
@@ -1531,7 +1531,7 @@ discard block |
||
| 1531 | 1531 | $img_arr['content'] = $attechment->content; // add the description to the array |
| 1532 | 1532 | $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1. |
| 1533 | 1533 | |
| 1534 | - $return_arr[] = (object)$img_arr; |
|
| 1534 | + $return_arr[] = (object) $img_arr; |
|
| 1535 | 1535 | |
| 1536 | 1536 | $counter++; |
| 1537 | 1537 | } |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | * @since 1.6.20 |
| 1543 | 1543 | * @param array $return_arr The array of image objects. |
| 1544 | 1544 | */ |
| 1545 | - return apply_filters('geodir_get_images_arr',$return_arr);
|
|
| 1545 | + return apply_filters('geodir_get_images_arr', $return_arr);
|
|
| 1546 | 1546 | } else if ($no_images) {
|
| 1547 | 1547 | $default_img = ''; |
| 1548 | 1548 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | $img_arr['title'] = $file_info['filename']; // add the title to the array |
| 1582 | 1582 | $img_arr['content'] = $file_info['filename']; // add the description to the array |
| 1583 | 1583 | |
| 1584 | - $return_arr[] = (object)$img_arr; |
|
| 1584 | + $return_arr[] = (object) $img_arr; |
|
| 1585 | 1585 | |
| 1586 | 1586 | /** |
| 1587 | 1587 | * Filter the images array so things can be changed. |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | * @since 1.6.20 |
| 1590 | 1590 | * @param array $return_arr The array of image objects. |
| 1591 | 1591 | */ |
| 1592 | - return apply_filters('geodir_get_images_arr',$return_arr);
|
|
| 1592 | + return apply_filters('geodir_get_images_arr', $return_arr);
|
|
| 1593 | 1593 | } else |
| 1594 | 1594 | return false; |
| 1595 | 1595 | } |
@@ -1614,8 +1614,8 @@ discard block |
||
| 1614 | 1614 | |
| 1615 | 1615 | $html = ''; |
| 1616 | 1616 | if (!empty($request)) {
|
| 1617 | - if (!is_object($request)){
|
|
| 1618 | - $request = (object)$request; |
|
| 1617 | + if (!is_object($request)) {
|
|
| 1618 | + $request = (object) $request; |
|
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | if (isset($request->src) && !isset($request->path)) {
|
@@ -1629,7 +1629,7 @@ discard block |
||
| 1629 | 1629 | $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
|
| 1630 | 1630 | $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
|
| 1631 | 1631 | if (strpos($img_no_http, $upload_no_http) !== false) {
|
| 1632 | - $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path); |
|
| 1632 | + $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | |
| 1635 | 1635 | $width = 0; |
@@ -1646,7 +1646,7 @@ discard block |
||
| 1646 | 1646 | $image->height = $height; |
| 1647 | 1647 | $image->title = isset($request->title) ? $request->title : ''; |
| 1648 | 1648 | |
| 1649 | - $max_size = (object)geodir_get_imagesize($size); |
|
| 1649 | + $max_size = (object) geodir_get_imagesize($size); |
|
| 1650 | 1650 | |
| 1651 | 1651 | if (!is_wp_error($max_size)) {
|
| 1652 | 1652 | if ($image->width) {
|
@@ -1658,13 +1658,13 @@ discard block |
||
| 1658 | 1658 | $width_per = 100; |
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | - if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
|
|
| 1662 | - $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>'; |
|
| 1661 | + if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
|
|
| 1662 | + $html = '<div class="geodir_thumbnail"><img style="max-height:'.$max_size->h.'px;" alt="place image" src="'.$image->src.'" /></div>'; |
|
| 1663 | 1663 | } else {
|
| 1664 | - if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
|
|
| 1665 | - $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');" title="'.$image->title.'" aria-label="'.$image->title.'" ></div>'; |
|
| 1666 | - }else{
|
|
| 1667 | - $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" title="'.$image->title.'" aria-label="'.$image->title.'"></div>';
|
|
| 1664 | + if ($size == 'widget-thumb' || !get_option('geodir_lazy_load', 1)) {
|
|
| 1665 | + $html = '<div class="geodir_thumbnail" style="background-image:url(\''.$image->src.'\');" title="'.$image->title.'" aria-label="'.$image->title.'" ></div>'; |
|
| 1666 | + } else {
|
|
| 1667 | + $html = '<div data-src="'.str_replace(' ', '%20', $image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" title="'.$image->title.'" aria-label="'.$image->title.'"></div>';
|
|
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | 1670 | } |
@@ -1699,15 +1699,15 @@ discard block |
||
| 1699 | 1699 | |
| 1700 | 1700 | $post_type = get_post_type($post_id); |
| 1701 | 1701 | |
| 1702 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1702 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1703 | 1703 | |
| 1704 | 1704 | if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
|
| 1705 | 1705 | |
| 1706 | - if ($taxonomy == $post_type . '_tags') {
|
|
| 1706 | + if ($taxonomy == $post_type.'_tags') {
|
|
| 1707 | 1707 | if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
|
| 1708 | 1708 | geodir_save_post_meta($post_id, 'post_tags', $terms); |
| 1709 | 1709 | } |
| 1710 | - } elseif ($taxonomy == $post_type . 'category') {
|
|
| 1710 | + } elseif ($taxonomy == $post_type.'category') {
|
|
| 1711 | 1711 | $srcharr = array('"', '\\');
|
| 1712 | 1712 | $replarr = array(""", '');
|
| 1713 | 1713 | |
@@ -1729,7 +1729,7 @@ discard block |
||
| 1729 | 1729 | |
| 1730 | 1730 | $wpdb->get_var( |
| 1731 | 1731 | $wpdb->prepare( |
| 1732 | - "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
| 1732 | + "DELETE from ".GEODIR_ICON_TABLE." WHERE cat_id NOT IN ($format) AND post_id = %d ", |
|
| 1733 | 1733 | $cat_ids_array_del |
| 1734 | 1734 | ) |
| 1735 | 1735 | ); |
@@ -1737,7 +1737,7 @@ discard block |
||
| 1737 | 1737 | |
| 1738 | 1738 | $post_term = $wpdb->get_col( |
| 1739 | 1739 | $wpdb->prepare( |
| 1740 | - "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
| 1740 | + "SELECT term_id FROM ".$wpdb->term_taxonomy." WHERE term_taxonomy_id IN($format) GROUP BY term_id", |
|
| 1741 | 1741 | $cat_ids_array |
| 1742 | 1742 | ) |
| 1743 | 1743 | ); |
@@ -1759,16 +1759,16 @@ discard block |
||
| 1759 | 1759 | $lat = geodir_get_post_meta($post_id, 'post_latitude', true); |
| 1760 | 1760 | $lng = geodir_get_post_meta($post_id, 'post_longitude', true); |
| 1761 | 1761 | |
| 1762 | - $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
|
|
| 1763 | - $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true); |
|
| 1762 | + $timing = ' - '.date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
|
|
| 1763 | + $timing .= ' - '.geodir_get_post_meta($post_id, 'st_time', true); |
|
| 1764 | 1764 | |
| 1765 | 1765 | $json = '{';
|
| 1766 | - $json .= '"id":"' . $post_id . '",'; |
|
| 1767 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
| 1768 | - $json .= '"long_pos": "' . $lng . '",'; |
|
| 1769 | - $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",'; |
|
| 1770 | - $json .= '"icon":"' . $term_icon . '",'; |
|
| 1771 | - $json .= '"group":"catgroup' . $cat_id . '"'; |
|
| 1766 | + $json .= '"id":"'.$post_id.'",'; |
|
| 1767 | + $json .= '"lat_pos": "'.$lat.'",'; |
|
| 1768 | + $json .= '"long_pos": "'.$lng.'",'; |
|
| 1769 | + $json .= '"marker_id":"'.$post_id.'_'.$cat_id.'",'; |
|
| 1770 | + $json .= '"icon":"'.$term_icon.'",'; |
|
| 1771 | + $json .= '"group":"catgroup'.$cat_id.'"'; |
|
| 1772 | 1772 | $json .= '}'; |
| 1773 | 1773 | |
| 1774 | 1774 | |
@@ -1776,9 +1776,9 @@ discard block |
||
| 1776 | 1776 | $post_marker_json = $json; |
| 1777 | 1777 | |
| 1778 | 1778 | |
| 1779 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
|
|
| 1779 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".GEODIR_ICON_TABLE." WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
|
|
| 1780 | 1780 | |
| 1781 | - $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
|
|
| 1781 | + $json_query = $wpdb->prepare("UPDATE ".GEODIR_ICON_TABLE." SET
|
|
| 1782 | 1782 | post_title = %s, |
| 1783 | 1783 | json = %s |
| 1784 | 1784 | WHERE post_id = %d AND cat_id = %d ", |
@@ -1786,7 +1786,7 @@ discard block |
||
| 1786 | 1786 | |
| 1787 | 1787 | } else {
|
| 1788 | 1788 | |
| 1789 | - $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
|
|
| 1789 | + $json_query = $wpdb->prepare("INSERT INTO ".GEODIR_ICON_TABLE." SET
|
|
| 1790 | 1790 | post_id = %d, |
| 1791 | 1791 | post_title = %s, |
| 1792 | 1792 | cat_id = %d, |
@@ -1804,17 +1804,17 @@ discard block |
||
| 1804 | 1804 | if (!empty($post_term) && is_array($post_term)) {
|
| 1805 | 1805 | $categories = implode(',', $post_term);
|
| 1806 | 1806 | |
| 1807 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
| 1807 | + if ($categories != '' && $categories != 0) $categories = ','.$categories.','; |
|
| 1808 | 1808 | |
| 1809 | 1809 | if (empty($post_marker_json)) |
| 1810 | 1810 | $post_marker_json = isset($json) ? $json : ''; |
| 1811 | 1811 | |
| 1812 | - if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
|
| 1812 | + if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
|
|
| 1813 | 1813 | |
| 1814 | 1814 | $wpdb->query( |
| 1815 | 1815 | $wpdb->prepare( |
| 1816 | - "UPDATE " . $table . " SET |
|
| 1817 | - " . $taxonomy . " = %s, |
|
| 1816 | + "UPDATE ".$table." SET |
|
| 1817 | + " . $taxonomy." = %s, |
|
| 1818 | 1818 | marker_json = %s |
| 1819 | 1819 | where post_id = %d", |
| 1820 | 1820 | array($categories, $post_marker_json, $post_id) |
@@ -1835,7 +1835,7 @@ discard block |
||
| 1835 | 1835 | |
| 1836 | 1836 | $wpdb->query( |
| 1837 | 1837 | $wpdb->prepare( |
| 1838 | - "UPDATE " . $table . " SET |
|
| 1838 | + "UPDATE ".$table." SET |
|
| 1839 | 1839 | default_category = %s |
| 1840 | 1840 | where post_id = %d", |
| 1841 | 1841 | array($categories[0], $post_id) |
@@ -1860,9 +1860,9 @@ discard block |
||
| 1860 | 1860 | |
| 1861 | 1861 | $wpdb->query( |
| 1862 | 1862 | $wpdb->prepare( |
| 1863 | - "INSERT INTO " . $table . " SET |
|
| 1863 | + "INSERT INTO ".$table." SET |
|
| 1864 | 1864 | post_id = %d, |
| 1865 | - " . $taxonomy . " = %s, |
|
| 1865 | + " . $taxonomy." = %s, |
|
| 1866 | 1866 | marker_json = %s ", |
| 1867 | 1867 | |
| 1868 | 1868 | array($post_id, $categories, $post_marker_json) |
@@ -1994,7 +1994,7 @@ discard block |
||
| 1994 | 1994 | } ?>"><img alt="bubble image" style="max-height:50px;" |
| 1995 | 1995 | src="<?php echo $post_images[0]; ?>"/></a></div> |
| 1996 | 1996 | <?php |
| 1997 | - }else{
|
|
| 1997 | + } else {
|
|
| 1998 | 1998 | echo '<div class="geodir-bubble_image"></div>'; |
| 1999 | 1999 | } |
| 2000 | 2000 | } else {
|
@@ -2002,7 +2002,7 @@ discard block |
||
| 2002 | 2002 | ?> |
| 2003 | 2003 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
| 2004 | 2004 | <?php |
| 2005 | - }else{
|
|
| 2005 | + } else {
|
|
| 2006 | 2006 | echo '<div class="geodir-bubble_image"></div>'; |
| 2007 | 2007 | } |
| 2008 | 2008 | } |
@@ -2032,7 +2032,7 @@ discard block |
||
| 2032 | 2032 | * @param object $postinfo_obj The posts info as an object. |
| 2033 | 2033 | * @param bool|string $post_preview True if currently in post preview page. Empty string if not. * |
| 2034 | 2034 | */ |
| 2035 | - do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
|
|
| 2035 | + do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
|
|
| 2036 | 2036 | ?> |
| 2037 | 2037 | </div> |
| 2038 | 2038 | <?php |
@@ -2042,9 +2042,9 @@ discard block |
||
| 2042 | 2042 | <div class="geodir-bubble-meta-fade"></div> |
| 2043 | 2043 | <div class="geodir-bubble-meta-bottom"> |
| 2044 | 2044 | <?php if ($rating_star != '') { ?>
|
| 2045 | - <span class="geodir-bubble-rating"><?php echo $rating_star;?></span> |
|
| 2045 | + <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span> |
|
| 2046 | 2046 | <?php } ?> |
| 2047 | - <span class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span> |
|
| 2047 | + <span class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span> |
|
| 2048 | 2048 | <span class="geodir-bubble-reviews"> |
| 2049 | 2049 | <a href="<?php echo get_comments_link($ID); ?>" class="geodir-pcomments"><i class="fa fa-comments"></i> <?php echo get_comments_number($ID); ?></a> |
| 2050 | 2050 | </span> |
@@ -2106,11 +2106,11 @@ discard block |
||
| 2106 | 2106 | |
| 2107 | 2107 | $post_type = get_post_type($post_id); |
| 2108 | 2108 | |
| 2109 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2109 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2110 | 2110 | |
| 2111 | 2111 | $wpdb->query( |
| 2112 | 2112 | $wpdb->prepare( |
| 2113 | - "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d", |
|
| 2113 | + "UPDATE ".$table." SET post_status=%s WHERE post_id=%d", |
|
| 2114 | 2114 | array($status, $post_id) |
| 2115 | 2115 | ) |
| 2116 | 2116 | ); |
@@ -2182,18 +2182,18 @@ discard block |
||
| 2182 | 2182 | |
| 2183 | 2183 | $post_type = get_post_type($post_id); |
| 2184 | 2184 | |
| 2185 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2185 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2186 | 2186 | |
| 2187 | 2187 | $wpdb->query( |
| 2188 | 2188 | $wpdb->prepare( |
| 2189 | - "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2189 | + "UPDATE ".$table." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2190 | 2190 | array($updatingpost, $temppost) |
| 2191 | 2191 | ) |
| 2192 | 2192 | ); |
| 2193 | 2193 | |
| 2194 | 2194 | $wpdb->query( |
| 2195 | 2195 | $wpdb->prepare( |
| 2196 | - "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2196 | + "UPDATE ".GEODIR_ICON_TABLE." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2197 | 2197 | array($updatingpost, $temppost) |
| 2198 | 2198 | ) |
| 2199 | 2199 | ); |
@@ -2202,7 +2202,7 @@ discard block |
||
| 2202 | 2202 | |
| 2203 | 2203 | $wpdb->query( |
| 2204 | 2204 | $wpdb->prepare( |
| 2205 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2205 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET `post_id` = %d WHERE `post_id` = %d", |
|
| 2206 | 2206 | array($updatingpost, $temppost) |
| 2207 | 2207 | ) |
| 2208 | 2208 | ); |
@@ -2240,12 +2240,12 @@ discard block |
||
| 2240 | 2240 | if (!in_array($post_type, $all_postypes)) |
| 2241 | 2241 | return false; |
| 2242 | 2242 | |
| 2243 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2243 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2244 | 2244 | |
| 2245 | 2245 | /* Delete custom post meta*/ |
| 2246 | 2246 | $wpdb->query( |
| 2247 | 2247 | $wpdb->prepare( |
| 2248 | - "DELETE FROM " . $table . " WHERE `post_id` = %d", |
|
| 2248 | + "DELETE FROM ".$table." WHERE `post_id` = %d", |
|
| 2249 | 2249 | array($deleted_postid) |
| 2250 | 2250 | ) |
| 2251 | 2251 | ); |
@@ -2254,7 +2254,7 @@ discard block |
||
| 2254 | 2254 | |
| 2255 | 2255 | $wpdb->query( |
| 2256 | 2256 | $wpdb->prepare( |
| 2257 | - "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d", |
|
| 2257 | + "DELETE FROM ".GEODIR_ICON_TABLE." WHERE `post_id` = %d", |
|
| 2258 | 2258 | array($deleted_postid) |
| 2259 | 2259 | ) |
| 2260 | 2260 | ); |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | |
| 2265 | 2265 | $wpdb->query( |
| 2266 | 2266 | $wpdb->prepare( |
| 2267 | - "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d", |
|
| 2267 | + "DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE `post_id` = %d", |
|
| 2268 | 2268 | array($deleted_postid) |
| 2269 | 2269 | ) |
| 2270 | 2270 | ); |
@@ -2336,7 +2336,7 @@ discard block |
||
| 2336 | 2336 | */ |
| 2337 | 2337 | do_action('geodir_before_add_from_favorite', $post_id);
|
| 2338 | 2338 | |
| 2339 | - echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>'; |
|
| 2339 | + echo '<a href="javascript:void(0);" title="'.$remove_favourite_text.'" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'remove\');"><i class="'.$favourite_icon.'"></i> '.$unfavourite_text.'</a>'; |
|
| 2340 | 2340 | |
| 2341 | 2341 | /** |
| 2342 | 2342 | * Called after adding the post from favourites. |
@@ -2415,7 +2415,7 @@ discard block |
||
| 2415 | 2415 | */ |
| 2416 | 2416 | do_action('geodir_before_remove_from_favorite', $post_id);
|
| 2417 | 2417 | |
| 2418 | - echo '<a href="javascript:void(0);" title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>'; |
|
| 2418 | + echo '<a href="javascript:void(0);" title="'.$add_favourite_text.'" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'add\');"><i class="'.$favourite_icon.'"></i> '.$favourite_text.'</a>'; |
|
| 2419 | 2419 | |
| 2420 | 2420 | /** |
| 2421 | 2421 | * Called after removing the post from favourites. |
@@ -2510,24 +2510,24 @@ discard block |
||
| 2510 | 2510 | $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
| 2511 | 2511 | |
| 2512 | 2512 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
|
| 2513 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
|
| 2513 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>" ><a |
|
| 2514 | 2514 | class="geodir-removetofav-icon" href="javascript:void(0);" |
| 2515 | - onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');" |
|
| 2516 | - title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?> |
|
| 2515 | + onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');" |
|
| 2516 | + title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?> |
|
| 2517 | 2517 | </a> </span><?php |
| 2518 | 2518 | |
| 2519 | 2519 | } else {
|
| 2520 | 2520 | |
| 2521 | 2521 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
|
| 2522 | - $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
|
| 2522 | + $script_text = 'javascript:window.location.href=\''.geodir_login_url().'\''; |
|
| 2523 | 2523 | } else |
| 2524 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
|
|
| 2524 | + $script_text = 'javascript:addToFavourite('.$post_id.',\'add\')';
|
|
| 2525 | 2525 | |
| 2526 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
|
| 2526 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon" |
|
| 2527 | 2527 | href="javascript:void(0);" |
| 2528 | - onclick="<?php echo $script_text;?>" |
|
| 2529 | - title="<?php echo $add_favourite_text;?>"><i |
|
| 2530 | - class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span> |
|
| 2528 | + onclick="<?php echo $script_text; ?>" |
|
| 2529 | + title="<?php echo $add_favourite_text; ?>"><i |
|
| 2530 | + class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span> |
|
| 2531 | 2531 | <?php } |
| 2532 | 2532 | } |
| 2533 | 2533 | } |
@@ -2557,7 +2557,7 @@ discard block |
||
| 2557 | 2557 | |
| 2558 | 2558 | $post_type = $taxonomy_obj->object_type[0]; |
| 2559 | 2559 | |
| 2560 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2560 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2561 | 2561 | |
| 2562 | 2562 | /** |
| 2563 | 2563 | * Filter to modify the 'join' query |
@@ -2580,8 +2580,8 @@ discard block |
||
| 2580 | 2580 | $where = apply_filters('geodir_cat_post_count_where', $where, $term);
|
| 2581 | 2581 | |
| 2582 | 2582 | $count_query = "SELECT count(post_id) FROM |
| 2583 | - " . $table . " as pd " . $join . " |
|
| 2584 | - WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
|
|
| 2583 | + " . $table." as pd ".$join." |
|
| 2584 | + WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id."',".$term->taxonomy.") ".$where;
|
|
| 2585 | 2585 | |
| 2586 | 2586 | $cat_post_count = $wpdb->get_var($count_query); |
| 2587 | 2587 | if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
@@ -2664,13 +2664,13 @@ discard block |
||
| 2664 | 2664 | global $post; |
| 2665 | 2665 | $all_postypes = geodir_get_posttypes(); |
| 2666 | 2666 | if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
|
| 2667 | - $out = ' <a class="excerpt-read-more" href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '">'; |
|
| 2667 | + $out = ' <a class="excerpt-read-more" href="'.get_permalink($post->ID).'" title="'.get_the_title($post->ID).'">'; |
|
| 2668 | 2668 | /** |
| 2669 | 2669 | * Filter excerpt read more text. |
| 2670 | 2670 | * |
| 2671 | 2671 | * @since 1.0.0 |
| 2672 | 2672 | */ |
| 2673 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
| 2673 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
|
|
| 2674 | 2674 | $out .= '</a>'; |
| 2675 | 2675 | return $out; |
| 2676 | 2676 | } |
@@ -2699,14 +2699,14 @@ discard block |
||
| 2699 | 2699 | if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
|
| 2700 | 2700 | |
| 2701 | 2701 | $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy); |
| 2702 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 2702 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 2703 | 2703 | |
| 2704 | 2704 | $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']); |
| 2705 | - $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png'; |
|
| 2705 | + $term_icon = $path_parts['dirname'].'/cat_icon_'.$term_id.'.png'; |
|
| 2706 | 2706 | |
| 2707 | 2707 | $posts = $wpdb->get_results( |
| 2708 | 2708 | $wpdb->prepare( |
| 2709 | - "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
| 2709 | + "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM ".$table." WHERE FIND_IN_SET(%s,%1\$s ) ", |
|
| 2710 | 2710 | array($term_id, $taxonomy) |
| 2711 | 2711 | ) |
| 2712 | 2712 | ); |
@@ -2718,19 +2718,19 @@ discard block |
||
| 2718 | 2718 | $lng = $post_obj->post_longitude; |
| 2719 | 2719 | |
| 2720 | 2720 | $json = '{';
|
| 2721 | - $json .= '"id":"' . $post_obj->post_id . '",'; |
|
| 2722 | - $json .= '"lat_pos": "' . $lat . '",'; |
|
| 2723 | - $json .= '"long_pos": "' . $lng . '",'; |
|
| 2724 | - $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",'; |
|
| 2725 | - $json .= '"icon":"' . $term_icon . '",'; |
|
| 2726 | - $json .= '"group":"catgroup' . $term_id . '"'; |
|
| 2721 | + $json .= '"id":"'.$post_obj->post_id.'",'; |
|
| 2722 | + $json .= '"lat_pos": "'.$lat.'",'; |
|
| 2723 | + $json .= '"long_pos": "'.$lng.'",'; |
|
| 2724 | + $json .= '"marker_id":"'.$post_obj->post_id.'_'.$term_id.'",'; |
|
| 2725 | + $json .= '"icon":"'.$term_icon.'",'; |
|
| 2726 | + $json .= '"group":"catgroup'.$term_id.'"'; |
|
| 2727 | 2727 | $json .= '}'; |
| 2728 | 2728 | |
| 2729 | 2729 | if ($post_obj->default_category == $term_id) {
|
| 2730 | 2730 | |
| 2731 | 2731 | $wpdb->query( |
| 2732 | 2732 | $wpdb->prepare( |
| 2733 | - "UPDATE " . $table . " SET marker_json = %s where post_id = %d", |
|
| 2733 | + "UPDATE ".$table." SET marker_json = %s where post_id = %d", |
|
| 2734 | 2734 | array($json, $post_obj->post_id) |
| 2735 | 2735 | ) |
| 2736 | 2736 | ); |
@@ -2738,7 +2738,7 @@ discard block |
||
| 2738 | 2738 | |
| 2739 | 2739 | $wpdb->query( |
| 2740 | 2740 | $wpdb->prepare( |
| 2741 | - "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
| 2741 | + "UPDATE ".GEODIR_ICON_TABLE." SET json = %s WHERE post_id = %d AND cat_id = %d", |
|
| 2742 | 2742 | array($json, $post_obj->post_id, $term_id) |
| 2743 | 2743 | ) |
| 2744 | 2744 | ); |
@@ -2862,7 +2862,7 @@ discard block |
||
| 2862 | 2862 | // print_r($uploads ) ; |
| 2863 | 2863 | $post_first_image = $wpdb->get_results( |
| 2864 | 2864 | $wpdb->prepare( |
| 2865 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
| 2865 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d and menu_order = 1 ", array($post_id) |
|
| 2866 | 2866 | ) |
| 2867 | 2867 | ); |
| 2868 | 2868 | |
@@ -2883,9 +2883,9 @@ discard block |
||
| 2883 | 2883 | |
| 2884 | 2884 | $post_type = get_post_type($post_id); |
| 2885 | 2885 | |
| 2886 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
| 2886 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
| 2887 | 2887 | |
| 2888 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
|
|
| 2888 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='".$post_first_image[0]->file."' WHERE post_id =".$post_id);
|
|
| 2889 | 2889 | |
| 2890 | 2890 | $new_attachment_name = basename($post_first_image[0]->file); |
| 2891 | 2891 | |
@@ -2898,11 +2898,11 @@ discard block |
||
| 2898 | 2898 | wp_delete_attachment($post_thumbnail_id); |
| 2899 | 2899 | |
| 2900 | 2900 | } |
| 2901 | - $filename = $uploads['basedir'] . $post_first_image[0]->file; |
|
| 2901 | + $filename = $uploads['basedir'].$post_first_image[0]->file; |
|
| 2902 | 2902 | |
| 2903 | 2903 | $attachment = array( |
| 2904 | 2904 | 'post_mime_type' => $post_first_image[0]->mime_type, |
| 2905 | - 'guid' => $uploads['baseurl'] . $post_first_image[0]->file, |
|
| 2905 | + 'guid' => $uploads['baseurl'].$post_first_image[0]->file, |
|
| 2906 | 2906 | 'post_parent' => $post_id, |
| 2907 | 2907 | 'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
|
| 2908 | 2908 | 'post_content' => '' |
@@ -2915,7 +2915,7 @@ discard block |
||
| 2915 | 2915 | |
| 2916 | 2916 | set_post_thumbnail($post_id, $id); |
| 2917 | 2917 | |
| 2918 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 2918 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
| 2919 | 2919 | wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename)); |
| 2920 | 2920 | |
| 2921 | 2921 | } |
@@ -2948,35 +2948,35 @@ discard block |
||
| 2948 | 2948 | $post_id = absint($_POST['post_id']); |
| 2949 | 2949 | $upload_dir = wp_upload_dir(); |
| 2950 | 2950 | $post_type = get_post_type($_POST['post_id']); |
| 2951 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2951 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2952 | 2952 | |
| 2953 | 2953 | $post_arr = $wpdb->get_results($wpdb->prepare( |
| 2954 | - "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
| 2954 | + "SELECT * FROM $wpdb->posts p JOIN ".$table." gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1", |
|
| 2955 | 2955 | array($post_id) |
| 2956 | 2956 | ) |
| 2957 | 2957 | , ARRAY_A); |
| 2958 | 2958 | |
| 2959 | 2959 | $arrImages = $wpdb->get_results( |
| 2960 | 2960 | $wpdb->prepare( |
| 2961 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
| 2961 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ", |
|
| 2962 | 2962 | array('%image%', $post_id)
|
| 2963 | 2963 | ) |
| 2964 | 2964 | ); |
| 2965 | 2965 | if ($arrImages) {
|
| 2966 | 2966 | $image_arr = array(); |
| 2967 | 2967 | foreach ($arrImages as $img) {
|
| 2968 | - $image_arr[] = $upload_dir['baseurl'] . $img->file; |
|
| 2968 | + $image_arr[] = $upload_dir['baseurl'].$img->file; |
|
| 2969 | 2969 | } |
| 2970 | 2970 | $comma_separated = implode(",", $image_arr);
|
| 2971 | 2971 | $post_arr[0]['post_images'] = $comma_separated; |
| 2972 | 2972 | } |
| 2973 | 2973 | |
| 2974 | 2974 | |
| 2975 | - $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category']; |
|
| 2975 | + $cats = $post_arr[0][$post_arr[0]['post_type'].'category']; |
|
| 2976 | 2976 | $cat_arr = array_filter(explode(",", $cats));
|
| 2977 | 2977 | $trans_cat = array(); |
| 2978 | 2978 | foreach ($cat_arr as $cat) {
|
| 2979 | - $trans_cat[] = geodir_wpml_object_id($cat, $post_arr[0]['post_type'] . 'category', false); |
|
| 2979 | + $trans_cat[] = geodir_wpml_object_id($cat, $post_arr[0]['post_type'].'category', false); |
|
| 2980 | 2980 | } |
| 2981 | 2981 | |
| 2982 | 2982 | |
@@ -3018,7 +3018,7 @@ discard block |
||
| 3018 | 3018 | |
| 3019 | 3019 | $get_data = $wpdb->get_results( |
| 3020 | 3020 | $wpdb->prepare( |
| 3021 | - "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'", |
|
| 3021 | + "SELECT htmlvar_name, field_type, extra_fields FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1'", |
|
| 3022 | 3022 | array($listing_type) |
| 3023 | 3023 | ) |
| 3024 | 3024 | ); |
@@ -3031,12 +3031,12 @@ discard block |
||
| 3031 | 3031 | |
| 3032 | 3032 | $extra_fields = unserialize($data->extra_fields); |
| 3033 | 3033 | |
| 3034 | - $prefix = $data->htmlvar_name . '_'; |
|
| 3034 | + $prefix = $data->htmlvar_name.'_'; |
|
| 3035 | 3035 | |
| 3036 | - $fields_info[$prefix . 'address'] = $data->field_type; |
|
| 3036 | + $fields_info[$prefix.'address'] = $data->field_type; |
|
| 3037 | 3037 | |
| 3038 | 3038 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
| 3039 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3039 | + $fields_info[$prefix.'zip'] = $data->field_type; |
|
| 3040 | 3040 | |
| 3041 | 3041 | } else {
|
| 3042 | 3042 | |
@@ -3135,18 +3135,18 @@ discard block |
||
| 3135 | 3135 | * @since 1.6.22 Added image from location page. |
| 3136 | 3136 | * @package GeoDirectory |
| 3137 | 3137 | */ |
| 3138 | -function geodir_fb_like_thumbnail(){
|
|
| 3138 | +function geodir_fb_like_thumbnail() {
|
|
| 3139 | 3139 | |
| 3140 | 3140 | $facebook_image = ''; |
| 3141 | 3141 | |
| 3142 | - if(is_single()){// single post
|
|
| 3142 | + if (is_single()) {// single post
|
|
| 3143 | 3143 | global $post; |
| 3144 | - if(isset($post->featured_image) && $post->featured_image){
|
|
| 3144 | + if (isset($post->featured_image) && $post->featured_image) {
|
|
| 3145 | 3145 | $upload_dir = wp_upload_dir(); |
| 3146 | 3146 | $facebook_image = $upload_dir['baseurl'].$post->featured_image; |
| 3147 | 3147 | |
| 3148 | 3148 | } |
| 3149 | - }elseif(geodir_is_page('location')){// location page
|
|
| 3149 | + }elseif (geodir_is_page('location')) {// location page
|
|
| 3150 | 3150 | if (function_exists('geodir_get_location_seo')) {
|
| 3151 | 3151 | $seo = geodir_get_location_seo(); |
| 3152 | 3152 | if (isset($seo->seo_image) && $seo->seo_image) {
|
@@ -3155,11 +3155,11 @@ discard block |
||
| 3155 | 3155 | } |
| 3156 | 3156 | } |
| 3157 | 3157 | |
| 3158 | - if(!$facebook_image){
|
|
| 3158 | + if (!$facebook_image) {
|
|
| 3159 | 3159 | global $post; |
| 3160 | 3160 | |
| 3161 | - if (has_post_thumbnail( $post->ID ) ){
|
|
| 3162 | - $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); |
|
| 3161 | + if (has_post_thumbnail($post->ID)) {
|
|
| 3162 | + $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); |
|
| 3163 | 3163 | $facebook_image = isset($image[0]) ? $image[0] : ''; |
| 3164 | 3164 | } |
| 3165 | 3165 | } |
@@ -3172,16 +3172,16 @@ discard block |
||
| 3172 | 3172 | * @since 1.6.22 |
| 3173 | 3173 | * @param string $facebook_image The image URL or blank. |
| 3174 | 3174 | */ |
| 3175 | - $facebook_image = apply_filters('geodir_fb_share_image',$facebook_image);
|
|
| 3175 | + $facebook_image = apply_filters('geodir_fb_share_image', $facebook_image);
|
|
| 3176 | 3176 | |
| 3177 | - if($facebook_image){
|
|
| 3177 | + if ($facebook_image) {
|
|
| 3178 | 3178 | echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$facebook_image\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n"; |
| 3179 | 3179 | } |
| 3180 | 3180 | |
| 3181 | 3181 | |
| 3182 | 3182 | } |
| 3183 | 3183 | |
| 3184 | -add_action( 'save_post', 'geodir_clear_map_cache_on_save', 10,2 ); |
|
| 3184 | +add_action('save_post', 'geodir_clear_map_cache_on_save', 10, 2);
|
|
| 3185 | 3185 | |
| 3186 | 3186 | |
| 3187 | 3187 | /** |
@@ -3189,10 +3189,10 @@ discard block |
||
| 3189 | 3189 | * |
| 3190 | 3190 | * @since 1.6.22 |
| 3191 | 3191 | */ |
| 3192 | -function geodir_delete_map_cache(){
|
|
| 3192 | +function geodir_delete_map_cache() {
|
|
| 3193 | 3193 | $files = glob(realpath(dirname(__FILE__))."/map-functions/map-cache/*.json"); // get all file names |
| 3194 | - foreach($files as $file){ // iterate files
|
|
| 3195 | - if(is_file($file)) |
|
| 3194 | + foreach ($files as $file) { // iterate files
|
|
| 3195 | + if (is_file($file)) |
|
| 3196 | 3196 | unlink($file); // delete file |
| 3197 | 3197 | } |
| 3198 | 3198 | } |
@@ -3207,21 +3207,21 @@ discard block |
||
| 3207 | 3207 | */ |
| 3208 | 3208 | function geodir_clear_map_cache_on_save($post_id, $post) {
|
| 3209 | 3209 | |
| 3210 | - if(!get_option('geodir_enable_map_cache')){
|
|
| 3210 | + if (!get_option('geodir_enable_map_cache')) {
|
|
| 3211 | 3211 | return; |
| 3212 | 3212 | } |
| 3213 | 3213 | |
| 3214 | - if ( isset( $post->post_type ) && ( $post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post' ) ) {
|
|
| 3214 | + if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
|
|
| 3215 | 3215 | return; |
| 3216 | 3216 | } |
| 3217 | 3217 | |
| 3218 | 3218 | $geodir_posttypes = geodir_get_posttypes(); |
| 3219 | 3219 | |
| 3220 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
|
| 3220 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
|
|
| 3221 | 3221 | return; |
| 3222 | 3222 | } |
| 3223 | 3223 | |
| 3224 | - if ( ! wp_is_post_revision( $post_id ) && isset( $post->post_type ) && in_array( $post->post_type, $geodir_posttypes ) ) {
|
|
| 3224 | + if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
|
|
| 3225 | 3225 | geodir_delete_map_cache(); |
| 3226 | 3226 | } |
| 3227 | 3227 | |
@@ -21,12 +21,13 @@ discard block |
||
| 21 | 21 | {
|
| 22 | 22 | |
| 23 | 23 | $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy); |
| 24 | - if (!empty($post_cat_ids)) |
|
| 25 | - $post_cat_array = explode(",", trim($post_cat_ids, ","));
|
|
| 24 | + if (!empty($post_cat_ids)) { |
|
| 25 | + $post_cat_array = explode(",", trim($post_cat_ids, ",")); |
|
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | if (!isset($default_cat) || empty($default_cat)) {
|
| 28 | 29 | $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : ''; |
| 29 | - }else{
|
|
| 30 | + } else{
|
|
| 30 | 31 | if(!is_int($default_cat)){
|
| 31 | 32 | $category = get_term_by('name', $default_cat, $taxonomy);
|
| 32 | 33 | if(isset($category->term_id)){
|
@@ -384,8 +385,9 @@ discard block |
||
| 384 | 385 | } elseif (trim($type) == 'file') {
|
| 385 | 386 | if (isset($request_info[$name])) {
|
| 386 | 387 | $request_files = array(); |
| 387 | - if ($request_info[$name] != '') |
|
| 388 | - $request_files = explode(",", $request_info[$name]);
|
|
| 388 | + if ($request_info[$name] != '') { |
|
| 389 | + $request_files = explode(",", $request_info[$name]); |
|
| 390 | + } |
|
| 389 | 391 | |
| 390 | 392 | $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL; |
| 391 | 393 | geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields); |
@@ -412,7 +414,7 @@ discard block |
||
| 412 | 414 | |
| 413 | 415 | $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
|
| 414 | 416 | |
| 415 | - }else{
|
|
| 417 | + } else{
|
|
| 416 | 418 | $post_htmlvar_value = $request_info[$name]; |
| 417 | 419 | } |
| 418 | 420 | |
@@ -452,15 +454,17 @@ discard block |
||
| 452 | 454 | |
| 453 | 455 | foreach ($request_info['post_category'] as $taxonomy => $cat) {
|
| 454 | 456 | |
| 455 | - if ($dummy) |
|
| 456 | - $post_category = $cat; |
|
| 457 | - else {
|
|
| 457 | + if ($dummy) { |
|
| 458 | + $post_category = $cat; |
|
| 459 | + } else {
|
|
| 458 | 460 | |
| 459 | - if (!is_array($cat) && strstr($cat, ',')) |
|
| 460 | - $cat = explode(',', $cat);
|
|
| 461 | + if (!is_array($cat) && strstr($cat, ',')) { |
|
| 462 | + $cat = explode(',', $cat); |
|
| 463 | + } |
|
| 461 | 464 | |
| 462 | - if (!empty($cat) && is_array($cat)) |
|
| 463 | - $post_category = array_map('intval', $cat);
|
|
| 465 | + if (!empty($cat) && is_array($cat)) { |
|
| 466 | + $post_category = array_map('intval', $cat); |
|
| 467 | + } |
|
| 464 | 468 | } |
| 465 | 469 | |
| 466 | 470 | wp_set_object_terms($last_post_id, $post_category, $taxonomy); |
@@ -478,11 +482,13 @@ discard block |
||
| 478 | 482 | if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
|
| 479 | 483 | $post_tags = explode(",", $request_info['post_tags']);
|
| 480 | 484 | } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
|
| 481 | - if ($dummy) |
|
| 482 | - $post_tags = $request_info['post_tags']; |
|
| 485 | + if ($dummy) { |
|
| 486 | + $post_tags = $request_info['post_tags']; |
|
| 487 | + } |
|
| 483 | 488 | } else {
|
| 484 | - if ($dummy) |
|
| 485 | - $post_tags = array($request_info['post_title']); |
|
| 489 | + if ($dummy) { |
|
| 490 | + $post_tags = array($request_info['post_title']); |
|
| 491 | + } |
|
| 486 | 492 | } |
| 487 | 493 | |
| 488 | 494 | if (is_array($post_tags)) {
|
@@ -569,15 +575,17 @@ discard block |
||
| 569 | 575 | |
| 570 | 576 | global $wpdb, $plugin_prefix, $post, $post_info; |
| 571 | 577 | |
| 572 | - if ($post_id == '' && !empty($post)) |
|
| 573 | - $post_id = $post->ID; |
|
| 578 | + if ($post_id == '' && !empty($post)) { |
|
| 579 | + $post_id = $post->ID; |
|
| 580 | + } |
|
| 574 | 581 | |
| 575 | 582 | $post_type = get_post_type($post_id); |
| 576 | 583 | |
| 577 | 584 | $all_postypes = geodir_get_posttypes(); |
| 578 | 585 | |
| 579 | - if (!in_array($post_type, $all_postypes)) |
|
| 580 | - return false; |
|
| 586 | + if (!in_array($post_type, $all_postypes)) { |
|
| 587 | + return false; |
|
| 588 | + } |
|
| 581 | 589 | |
| 582 | 590 | $table = $plugin_prefix . $post_type . '_detail'; |
| 583 | 591 | |
@@ -737,8 +745,9 @@ discard block |
||
| 737 | 745 | do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
|
| 738 | 746 | |
| 739 | 747 | return true; |
| 740 | - } else |
|
| 741 | - return false; |
|
| 748 | + } else { |
|
| 749 | + return false; |
|
| 750 | + } |
|
| 742 | 751 | |
| 743 | 752 | } |
| 744 | 753 | } |
@@ -792,8 +801,9 @@ discard block |
||
| 792 | 801 | } |
| 793 | 802 | |
| 794 | 803 | |
| 795 | - } else |
|
| 796 | - return false; |
|
| 804 | + } else { |
|
| 805 | + return false; |
|
| 806 | + } |
|
| 797 | 807 | } |
| 798 | 808 | } |
| 799 | 809 | |
@@ -824,8 +834,9 @@ discard block |
||
| 824 | 834 | $post_meta_set_query = ''; |
| 825 | 835 | |
| 826 | 836 | foreach ($postmeta as $mkey) {
|
| 827 | - if ($mval != '') |
|
| 828 | - $post_meta_set_query .= $mkey . " = '', "; |
|
| 837 | + if ($mval != '') { |
|
| 838 | + $post_meta_set_query .= $mkey . " = '', "; |
|
| 839 | + } |
|
| 829 | 840 | } |
| 830 | 841 | |
| 831 | 842 | $post_meta_set_query = trim($post_meta_set_query, ", "); |
@@ -859,8 +870,9 @@ discard block |
||
| 859 | 870 | return true; |
| 860 | 871 | } |
| 861 | 872 | |
| 862 | - } else |
|
| 863 | - return false; |
|
| 873 | + } else { |
|
| 874 | + return false; |
|
| 875 | + } |
|
| 864 | 876 | } |
| 865 | 877 | } |
| 866 | 878 | |
@@ -890,8 +902,9 @@ discard block |
||
| 890 | 902 | |
| 891 | 903 | $post_type = get_post_type($post_id); |
| 892 | 904 | |
| 893 | - if (!in_array($post_type, $all_postypes)) |
|
| 894 | - return false; |
|
| 905 | + if (!in_array($post_type, $all_postypes)) { |
|
| 906 | + return false; |
|
| 907 | + } |
|
| 895 | 908 | |
| 896 | 909 | $table = $plugin_prefix . $post_type . '_detail'; |
| 897 | 910 | |
@@ -1046,7 +1059,7 @@ discard block |
||
| 1046 | 1059 | if (isset($uploaded['error']) && empty($uploaded['error'])) {
|
| 1047 | 1060 | $new_name = basename($uploaded['file']); |
| 1048 | 1061 | $uploaded_file = $uploaded; |
| 1049 | - }else{
|
|
| 1062 | + } else{
|
|
| 1050 | 1063 | print_r($uploaded);exit; |
| 1051 | 1064 | } |
| 1052 | 1065 | $external_img = false; |
@@ -1071,8 +1084,9 @@ discard block |
||
| 1071 | 1084 | $file_path = $curr_img_dir . '/' . $filename; |
| 1072 | 1085 | } |
| 1073 | 1086 | |
| 1074 | - if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) |
|
| 1075 | - unlink($img_path); |
|
| 1087 | + if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) { |
|
| 1088 | + unlink($img_path); |
|
| 1089 | + } |
|
| 1076 | 1090 | } |
| 1077 | 1091 | |
| 1078 | 1092 | if (!empty($uploaded_file)) {
|
@@ -1101,8 +1115,9 @@ discard block |
||
| 1101 | 1115 | $attachment_set = ''; |
| 1102 | 1116 | |
| 1103 | 1117 | foreach ($attachment as $key => $val) {
|
| 1104 | - if ($val != '') |
|
| 1105 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1118 | + if ($val != '') { |
|
| 1119 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1120 | + } |
|
| 1106 | 1121 | } |
| 1107 | 1122 | |
| 1108 | 1123 | $attachment_set = trim($attachment_set, ", "); |
@@ -1127,8 +1142,9 @@ discard block |
||
| 1127 | 1142 | ) |
| 1128 | 1143 | ); |
| 1129 | 1144 | |
| 1130 | - if ($menu_order == 1) |
|
| 1131 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
|
|
| 1145 | + if ($menu_order == 1) { |
|
| 1146 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id))); |
|
| 1147 | + } |
|
| 1132 | 1148 | |
| 1133 | 1149 | } |
| 1134 | 1150 | |
@@ -1169,8 +1185,9 @@ discard block |
||
| 1169 | 1185 | |
| 1170 | 1186 | $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
|
| 1171 | 1187 | |
| 1172 | - if (!empty($invalid_files)) |
|
| 1173 | - geodir_remove_attachments($invalid_files); |
|
| 1188 | + if (!empty($invalid_files)) { |
|
| 1189 | + geodir_remove_attachments($invalid_files); |
|
| 1190 | + } |
|
| 1174 | 1191 | } |
| 1175 | 1192 | |
| 1176 | 1193 | } |
@@ -1223,16 +1240,19 @@ discard block |
||
| 1223 | 1240 | function geodir_delete_directory($dirname) |
| 1224 | 1241 | {
|
| 1225 | 1242 | $dir_handle = ''; |
| 1226 | - if (is_dir($dirname)) |
|
| 1227 | - $dir_handle = opendir($dirname); |
|
| 1228 | - if (!$dir_handle) |
|
| 1229 | - return false; |
|
| 1243 | + if (is_dir($dirname)) { |
|
| 1244 | + $dir_handle = opendir($dirname); |
|
| 1245 | + } |
|
| 1246 | + if (!$dir_handle) { |
|
| 1247 | + return false; |
|
| 1248 | + } |
|
| 1230 | 1249 | while ($file = readdir($dir_handle)) {
|
| 1231 | 1250 | if ($file != "." && $file != "..") {
|
| 1232 | - if (!is_dir($dirname . "/" . $file)) |
|
| 1233 | - unlink($dirname . "/" . $file); |
|
| 1234 | - else |
|
| 1235 | - geodir_delete_directory($dirname . '/' . $file); |
|
| 1251 | + if (!is_dir($dirname . "/" . $file)) { |
|
| 1252 | + unlink($dirname . "/" . $file); |
|
| 1253 | + } else { |
|
| 1254 | + geodir_delete_directory($dirname . '/' . $file); |
|
| 1255 | + } |
|
| 1236 | 1256 | } |
| 1237 | 1257 | } |
| 1238 | 1258 | closedir($dir_handle); |
@@ -1261,8 +1281,9 @@ discard block |
||
| 1261 | 1281 | foreach ($postcurr_images as $postimg) {
|
| 1262 | 1282 | $image_name_arr = explode('/', $postimg->src);
|
| 1263 | 1283 | $filename = end($image_name_arr); |
| 1264 | - if (file_exists($uploads_dir . '/' . $filename)) |
|
| 1265 | - unlink($uploads_dir . '/' . $filename); |
|
| 1284 | + if (file_exists($uploads_dir . '/' . $filename)) { |
|
| 1285 | + unlink($uploads_dir . '/' . $filename); |
|
| 1286 | + } |
|
| 1266 | 1287 | } |
| 1267 | 1288 | |
| 1268 | 1289 | } // endif |
@@ -1379,9 +1400,9 @@ discard block |
||
| 1379 | 1400 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
| 1380 | 1401 | } |
| 1381 | 1402 | |
| 1382 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1383 | - $default_img = $default_catimg['src']; |
|
| 1384 | - elseif ($no_image) {
|
|
| 1403 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
| 1404 | + $default_img = $default_catimg['src']; |
|
| 1405 | + } elseif ($no_image) {
|
|
| 1385 | 1406 | $default_img = get_option('geodir_listing_no_img');
|
| 1386 | 1407 | } |
| 1387 | 1408 | |
@@ -1413,10 +1434,13 @@ discard block |
||
| 1413 | 1434 | } |
| 1414 | 1435 | } |
| 1415 | 1436 | |
| 1416 | - if (!empty($img_arr)) |
|
| 1417 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1418 | - else |
|
| 1419 | - return false; |
|
| 1437 | + if (!empty($img_arr)) { |
|
| 1438 | + return (object)$img_arr; |
|
| 1439 | + } |
|
| 1440 | + //return (object)array( 'src' => $file_url, 'path' => $file_path ); |
|
| 1441 | + else { |
|
| 1442 | + return false; |
|
| 1443 | + } |
|
| 1420 | 1444 | } |
| 1421 | 1445 | } |
| 1422 | 1446 | |
@@ -1443,8 +1467,9 @@ discard block |
||
| 1443 | 1467 | echo $html; |
| 1444 | 1468 | } elseif (!empty($html)) {
|
| 1445 | 1469 | return $html; |
| 1446 | - } else |
|
| 1447 | - return false; |
|
| 1470 | + } else { |
|
| 1471 | + return false; |
|
| 1472 | + } |
|
| 1448 | 1473 | } |
| 1449 | 1474 | } |
| 1450 | 1475 | |
@@ -1472,8 +1497,9 @@ discard block |
||
| 1472 | 1497 | } |
| 1473 | 1498 | $not_featured = ''; |
| 1474 | 1499 | $sub_dir = ''; |
| 1475 | - if (!$add_featured) |
|
| 1476 | - $not_featured = " AND is_featured = 0 "; |
|
| 1500 | + if (!$add_featured) { |
|
| 1501 | + $not_featured = " AND is_featured = 0 "; |
|
| 1502 | + } |
|
| 1477 | 1503 | |
| 1478 | 1504 | $arrImages = $wpdb->get_results( |
| 1479 | 1505 | $wpdb->prepare( |
@@ -1494,8 +1520,9 @@ discard block |
||
| 1494 | 1520 | |
| 1495 | 1521 | $file_info = pathinfo($attechment->file); |
| 1496 | 1522 | |
| 1497 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 1498 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1523 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
| 1524 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 1525 | + } |
|
| 1499 | 1526 | |
| 1500 | 1527 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
| 1501 | 1528 | $uploads_baseurl = $uploads['baseurl']; |
@@ -1547,9 +1574,9 @@ discard block |
||
| 1547 | 1574 | $default_img = ''; |
| 1548 | 1575 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true); |
| 1549 | 1576 | $post_type = get_post_type($post_id); |
| 1550 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) |
|
| 1551 | - $default_img = $default_catimg['src']; |
|
| 1552 | - elseif ($no_images) {
|
|
| 1577 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { |
|
| 1578 | + $default_img = $default_catimg['src']; |
|
| 1579 | + } elseif ($no_images) {
|
|
| 1553 | 1580 | $default_img = get_option('geodir_listing_no_img');
|
| 1554 | 1581 | } |
| 1555 | 1582 | |
@@ -1590,8 +1617,9 @@ discard block |
||
| 1590 | 1617 | * @param array $return_arr The array of image objects. |
| 1591 | 1618 | */ |
| 1592 | 1619 | return apply_filters('geodir_get_images_arr',$return_arr);
|
| 1593 | - } else |
|
| 1594 | - return false; |
|
| 1620 | + } else { |
|
| 1621 | + return false; |
|
| 1622 | + } |
|
| 1595 | 1623 | } |
| 1596 | 1624 | } |
| 1597 | 1625 | } |
@@ -1654,8 +1682,9 @@ discard block |
||
| 1654 | 1682 | $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2); |
| 1655 | 1683 | } else if ($image->width < ($max_size->h)) {
|
| 1656 | 1684 | $width_per = round((($image->width / $max_size->w) * 100), 2); |
| 1657 | - } else |
|
| 1658 | - $width_per = 100; |
|
| 1685 | + } else { |
|
| 1686 | + $width_per = 100; |
|
| 1687 | + } |
|
| 1659 | 1688 | } |
| 1660 | 1689 | |
| 1661 | 1690 | if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
|
@@ -1663,7 +1692,7 @@ discard block |
||
| 1663 | 1692 | } else {
|
| 1664 | 1693 | if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
|
| 1665 | 1694 | $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');" title="'.$image->title.'" aria-label="'.$image->title.'" ></div>'; |
| 1666 | - }else{
|
|
| 1695 | + } else{
|
|
| 1667 | 1696 | $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" title="'.$image->title.'" aria-label="'.$image->title.'"></div>';
|
| 1668 | 1697 | } |
| 1669 | 1698 | |
@@ -1675,8 +1704,9 @@ discard block |
||
| 1675 | 1704 | echo $html; |
| 1676 | 1705 | } elseif (!empty($html)) {
|
| 1677 | 1706 | return $html; |
| 1678 | - } else |
|
| 1679 | - return false; |
|
| 1707 | + } else { |
|
| 1708 | + return false; |
|
| 1709 | + } |
|
| 1680 | 1710 | } |
| 1681 | 1711 | } |
| 1682 | 1712 | |
@@ -1714,8 +1744,9 @@ discard block |
||
| 1714 | 1744 | $post_obj = get_post($post_id); |
| 1715 | 1745 | |
| 1716 | 1746 | $cat_ids = array('0');
|
| 1717 | - if (is_array($tt_ids)) |
|
| 1718 | - $cat_ids = $tt_ids; |
|
| 1747 | + if (is_array($tt_ids)) { |
|
| 1748 | + $cat_ids = $tt_ids; |
|
| 1749 | + } |
|
| 1719 | 1750 | |
| 1720 | 1751 | |
| 1721 | 1752 | if (!empty($cat_ids)) {
|
@@ -1772,8 +1803,9 @@ discard block |
||
| 1772 | 1803 | $json .= '}'; |
| 1773 | 1804 | |
| 1774 | 1805 | |
| 1775 | - if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) |
|
| 1776 | - $post_marker_json = $json; |
|
| 1806 | + if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) { |
|
| 1807 | + $post_marker_json = $json; |
|
| 1808 | + } |
|
| 1777 | 1809 | |
| 1778 | 1810 | |
| 1779 | 1811 | if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
|
@@ -1804,10 +1836,13 @@ discard block |
||
| 1804 | 1836 | if (!empty($post_term) && is_array($post_term)) {
|
| 1805 | 1837 | $categories = implode(',', $post_term);
|
| 1806 | 1838 | |
| 1807 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ','; |
|
| 1839 | + if ($categories != '' && $categories != 0) { |
|
| 1840 | + $categories = ',' . $categories . ','; |
|
| 1841 | + } |
|
| 1808 | 1842 | |
| 1809 | - if (empty($post_marker_json)) |
|
| 1810 | - $post_marker_json = isset($json) ? $json : ''; |
|
| 1843 | + if (empty($post_marker_json)) { |
|
| 1844 | + $post_marker_json = isset($json) ? $json : ''; |
|
| 1845 | + } |
|
| 1811 | 1846 | |
| 1812 | 1847 | if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
|
| 1813 | 1848 | |
@@ -1846,8 +1881,9 @@ discard block |
||
| 1846 | 1881 | |
| 1847 | 1882 | } |
| 1848 | 1883 | |
| 1849 | - if ($default_category == '') |
|
| 1850 | - $default_category = $categories[0]; |
|
| 1884 | + if ($default_category == '') { |
|
| 1885 | + $default_category = $categories[0]; |
|
| 1886 | + } |
|
| 1851 | 1887 | |
| 1852 | 1888 | geodir_set_postcat_structure($post_id, $taxonomy, $default_category, ''); |
| 1853 | 1889 | |
@@ -1994,7 +2030,7 @@ discard block |
||
| 1994 | 2030 | } ?>"><img alt="bubble image" style="max-height:50px;" |
| 1995 | 2031 | src="<?php echo $post_images[0]; ?>"/></a></div> |
| 1996 | 2032 | <?php |
| 1997 | - }else{
|
|
| 2033 | + } else{
|
|
| 1998 | 2034 | echo '<div class="geodir-bubble_image"></div>'; |
| 1999 | 2035 | } |
| 2000 | 2036 | } else {
|
@@ -2002,7 +2038,7 @@ discard block |
||
| 2002 | 2038 | ?> |
| 2003 | 2039 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div> |
| 2004 | 2040 | <?php |
| 2005 | - }else{
|
|
| 2041 | + } else{
|
|
| 2006 | 2042 | echo '<div class="geodir-bubble_image"></div>'; |
| 2007 | 2043 | } |
| 2008 | 2044 | } |
@@ -2083,10 +2119,11 @@ discard block |
||
| 2083 | 2119 | */ |
| 2084 | 2120 | function geodir_new_post_default_status() |
| 2085 | 2121 | {
|
| 2086 | - if (get_option('geodir_new_post_default_status'))
|
|
| 2087 | - return get_option('geodir_new_post_default_status');
|
|
| 2088 | - else |
|
| 2089 | - return 'publish'; |
|
| 2122 | + if (get_option('geodir_new_post_default_status')) { |
|
| 2123 | + return get_option('geodir_new_post_default_status'); |
|
| 2124 | + } else { |
|
| 2125 | + return 'publish'; |
|
| 2126 | + } |
|
| 2090 | 2127 | |
| 2091 | 2128 | } |
| 2092 | 2129 | } |
@@ -2237,8 +2274,9 @@ discard block |
||
| 2237 | 2274 | |
| 2238 | 2275 | $all_postypes = geodir_get_posttypes(); |
| 2239 | 2276 | |
| 2240 | - if (!in_array($post_type, $all_postypes)) |
|
| 2241 | - return false; |
|
| 2277 | + if (!in_array($post_type, $all_postypes)) { |
|
| 2278 | + return false; |
|
| 2279 | + } |
|
| 2242 | 2280 | |
| 2243 | 2281 | $table = $plugin_prefix . $post_type . '_detail'; |
| 2244 | 2282 | |
@@ -2506,8 +2544,9 @@ discard block |
||
| 2506 | 2544 | $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
|
| 2507 | 2545 | |
| 2508 | 2546 | $user_meta_data = ''; |
| 2509 | - if (isset($current_user->data->ID)) |
|
| 2510 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2547 | + if (isset($current_user->data->ID)) { |
|
| 2548 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true); |
|
| 2549 | + } |
|
| 2511 | 2550 | |
| 2512 | 2551 | if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
|
| 2513 | 2552 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a |
@@ -2520,8 +2559,9 @@ discard block |
||
| 2520 | 2559 | |
| 2521 | 2560 | if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
|
| 2522 | 2561 | $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\''; |
| 2523 | - } else |
|
| 2524 | - $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
|
|
| 2562 | + } else { |
|
| 2563 | + $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; |
|
| 2564 | + } |
|
| 2525 | 2565 | |
| 2526 | 2566 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon" |
| 2527 | 2567 | href="javascript:void(0);" |
@@ -2584,14 +2624,16 @@ discard block |
||
| 2584 | 2624 | WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
|
| 2585 | 2625 | |
| 2586 | 2626 | $cat_post_count = $wpdb->get_var($count_query); |
| 2587 | - if (empty($cat_post_count) || is_wp_error($cat_post_count)) |
|
| 2588 | - $cat_post_count = 0; |
|
| 2627 | + if (empty($cat_post_count) || is_wp_error($cat_post_count)) { |
|
| 2628 | + $cat_post_count = 0; |
|
| 2629 | + } |
|
| 2589 | 2630 | |
| 2590 | 2631 | return $cat_post_count; |
| 2591 | 2632 | |
| 2592 | - } else |
|
| 2593 | - |
|
| 2594 | - return $term->count; |
|
| 2633 | + } else { |
|
| 2634 | + |
|
| 2635 | + return $term->count; |
|
| 2636 | + } |
|
| 2595 | 2637 | } |
| 2596 | 2638 | return false; |
| 2597 | 2639 | |
@@ -2638,13 +2680,15 @@ discard block |
||
| 2638 | 2680 | return $length; |
| 2639 | 2681 | } |
| 2640 | 2682 | |
| 2641 | - if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
|
|
| 2642 | - $length = get_option('geodir_desc_word_limit');
|
|
| 2643 | - elseif (get_query_var('excerpt_length'))
|
|
| 2644 | - $length = get_query_var('excerpt_length');
|
|
| 2683 | + if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) { |
|
| 2684 | + $length = get_option('geodir_desc_word_limit'); |
|
| 2685 | + } elseif (get_query_var('excerpt_length')) { |
|
| 2686 | + $length = get_query_var('excerpt_length'); |
|
| 2687 | + } |
|
| 2645 | 2688 | |
| 2646 | - if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
|
|
| 2647 | - $length = get_option('geodir_author_desc_word_limit');
|
|
| 2689 | + if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) { |
|
| 2690 | + $length = get_option('geodir_author_desc_word_limit'); |
|
| 2691 | + } |
|
| 2648 | 2692 | |
| 2649 | 2693 | return $length; |
| 2650 | 2694 | } |
@@ -2785,10 +2829,11 @@ discard block |
||
| 2785 | 2829 | function geodir_lisiting_belong_to_user($listing_id, $user_id) |
| 2786 | 2830 | {
|
| 2787 | 2831 | $listing_author_id = geodir_get_listing_author($listing_id); |
| 2788 | - if ($listing_author_id == $user_id) |
|
| 2789 | - return true; |
|
| 2790 | - else |
|
| 2791 | - return false; |
|
| 2832 | + if ($listing_author_id == $user_id) { |
|
| 2833 | + return true; |
|
| 2834 | + } else { |
|
| 2835 | + return false; |
|
| 2836 | + } |
|
| 2792 | 2837 | |
| 2793 | 2838 | } |
| 2794 | 2839 | |
@@ -2837,10 +2882,11 @@ discard block |
||
| 2837 | 2882 | $pattern = '/-\d+x\d+\./'; |
| 2838 | 2883 | preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE); |
| 2839 | 2884 | |
| 2840 | - if (empty($matches)) |
|
| 2841 | - return ''; |
|
| 2842 | - else |
|
| 2843 | - return $file; |
|
| 2885 | + if (empty($matches)) { |
|
| 2886 | + return ''; |
|
| 2887 | + } else { |
|
| 2888 | + return $file; |
|
| 2889 | + } |
|
| 2844 | 2890 | |
| 2845 | 2891 | } |
| 2846 | 2892 | |
@@ -2925,8 +2971,9 @@ discard block |
||
| 2925 | 2971 | } else {
|
| 2926 | 2972 | //set_post_thumbnail($post_id,-1); |
| 2927 | 2973 | |
| 2928 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) |
|
| 2929 | - wp_delete_attachment($post_thumbnail_id); |
|
| 2974 | + if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) { |
|
| 2975 | + wp_delete_attachment($post_thumbnail_id); |
|
| 2976 | + } |
|
| 2930 | 2977 | |
| 2931 | 2978 | } |
| 2932 | 2979 | } |
@@ -3011,8 +3058,9 @@ discard block |
||
| 3011 | 3058 | |
| 3012 | 3059 | global $wpdb; |
| 3013 | 3060 | |
| 3014 | - if ($listing_type == '') |
|
| 3015 | - $listing_type = 'gd_place'; |
|
| 3061 | + if ($listing_type == '') { |
|
| 3062 | + $listing_type = 'gd_place'; |
|
| 3063 | + } |
|
| 3016 | 3064 | |
| 3017 | 3065 | $fields_info = array(); |
| 3018 | 3066 | |
@@ -3035,8 +3083,9 @@ discard block |
||
| 3035 | 3083 | |
| 3036 | 3084 | $fields_info[$prefix . 'address'] = $data->field_type; |
| 3037 | 3085 | |
| 3038 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) |
|
| 3039 | - $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3086 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 3087 | + $fields_info[$prefix . 'zip'] = $data->field_type; |
|
| 3088 | + } |
|
| 3040 | 3089 | |
| 3041 | 3090 | } else {
|
| 3042 | 3091 | |
@@ -3146,7 +3195,7 @@ discard block |
||
| 3146 | 3195 | $facebook_image = $upload_dir['baseurl'].$post->featured_image; |
| 3147 | 3196 | |
| 3148 | 3197 | } |
| 3149 | - }elseif(geodir_is_page('location')){// location page
|
|
| 3198 | + } elseif(geodir_is_page('location')){// location page
|
|
| 3150 | 3199 | if (function_exists('geodir_get_location_seo')) {
|
| 3151 | 3200 | $seo = geodir_get_location_seo(); |
| 3152 | 3201 | if (isset($seo->seo_image) && $seo->seo_image) {
|
@@ -3192,8 +3241,10 @@ discard block |
||
| 3192 | 3241 | function geodir_delete_map_cache(){
|
| 3193 | 3242 | $files = glob(realpath(dirname(__FILE__))."/map-functions/map-cache/*.json"); // get all file names |
| 3194 | 3243 | foreach($files as $file){ // iterate files
|
| 3195 | - if(is_file($file)) |
|
| 3196 | - unlink($file); // delete file |
|
| 3244 | + if(is_file($file)) { |
|
| 3245 | + unlink($file); |
|
| 3246 | + } |
|
| 3247 | + // delete file |
|
| 3197 | 3248 | } |
| 3198 | 3249 | } |
| 3199 | 3250 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function geodir_get_ajax_url() |
| 21 | 21 | {
|
| 22 | - return admin_url('admin-ajax.php?action=geodir_ajax_action');
|
|
| 22 | + return admin_url('admin-ajax.php?action=geodir_ajax_action');
|
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | ///////////////////// |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | add_filter('query_vars', 'geodir_add_geodir_page_var');
|
| 88 | 88 | add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
|
| 89 | 89 | if (get_option('permalink_structure') != '')
|
| 90 | - add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
|
|
| 90 | + add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
|
|
| 91 | 91 | |
| 92 | 92 | add_filter('parse_query', 'geodir_modified_query');
|
| 93 | 93 | |
@@ -154,14 +154,14 @@ discard block |
||
| 154 | 154 | /* POST AND LOOP ACTIONS */ |
| 155 | 155 | //////////////////////// |
| 156 | 156 | if (!is_admin()) {
|
| 157 | - add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
|
|
| 158 | - add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
|
|
| 159 | - /** Exclude Virtual Pages From Pages List **/ |
|
| 160 | - add_action('pre_get_posts', 'set_listing_request', 0);
|
|
| 161 | - add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
|
|
| 162 | - add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
|
|
| 163 | - add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
|
|
| 164 | - add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
|
|
| 157 | + add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere
|
|
| 158 | + add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
|
|
| 159 | + /** Exclude Virtual Pages From Pages List **/ |
|
| 160 | + add_action('pre_get_posts', 'set_listing_request', 0);
|
|
| 161 | + add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
|
|
| 162 | + add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
|
|
| 163 | + add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
|
|
| 164 | + add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
|
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | function geodir_unset_prev_theme_nav_location($newname) |
| 225 | 225 | {
|
| 226 | - $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
|
|
| 227 | - if ($geodir_theme_location) {
|
|
| 228 | - update_option('geodir_theme_location_nav', $geodir_theme_location);
|
|
| 229 | - } else {
|
|
| 230 | - update_option('geodir_theme_location_nav', '');
|
|
| 231 | - } |
|
| 226 | + $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
|
|
| 227 | + if ($geodir_theme_location) {
|
|
| 228 | + update_option('geodir_theme_location_nav', $geodir_theme_location);
|
|
| 229 | + } else {
|
|
| 230 | + update_option('geodir_theme_location_nav', '');
|
|
| 231 | + } |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /// add action for theme switch to blank previous theme navigation location setting |
@@ -249,42 +249,42 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | function geodir_add_post_filters() |
| 251 | 251 | {
|
| 252 | - /** |
|
| 253 | - * Contains all function for filtering listing. |
|
| 254 | - * |
|
| 255 | - * @since 1.0.0 |
|
| 256 | - * @package GeoDirectory |
|
| 257 | - */ |
|
| 258 | - include_once('geodirectory-functions/listing_filters.php');
|
|
| 252 | + /** |
|
| 253 | + * Contains all function for filtering listing. |
|
| 254 | + * |
|
| 255 | + * @since 1.0.0 |
|
| 256 | + * @package GeoDirectory |
|
| 257 | + */ |
|
| 258 | + include_once('geodirectory-functions/listing_filters.php');
|
|
| 259 | 259 | |
| 260 | - // Theme My Login compatibility fix |
|
| 261 | - if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
|
|
| 262 | - remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) ); |
|
| 263 | - } |
|
| 260 | + // Theme My Login compatibility fix |
|
| 261 | + if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) {
|
|
| 262 | + remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) ); |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - if ( isset( $_REQUEST['geodir_search'] ) ) {
|
|
| 266 | - add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 ); |
|
| 267 | - add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 ); |
|
| 268 | - } |
|
| 265 | + if ( isset( $_REQUEST['geodir_search'] ) ) {
|
|
| 266 | + add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 ); |
|
| 267 | + add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 ); |
|
| 268 | + } |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | |
| 272 | 272 | if (!function_exists('geodir_init_defaults')) {
|
| 273 | - /** |
|
| 274 | - * Calls the function to register the GeoDirectory default CPT and taxonomies. |
|
| 275 | - * |
|
| 276 | - * @since 1.0.0 |
|
| 277 | - * @package GeoDirectory |
|
| 278 | - */ |
|
| 279 | - function geodir_init_defaults() |
|
| 280 | - {
|
|
| 281 | - if (function_exists('geodir_register_defaults')) {
|
|
| 273 | + /** |
|
| 274 | + * Calls the function to register the GeoDirectory default CPT and taxonomies. |
|
| 275 | + * |
|
| 276 | + * @since 1.0.0 |
|
| 277 | + * @package GeoDirectory |
|
| 278 | + */ |
|
| 279 | + function geodir_init_defaults() |
|
| 280 | + {
|
|
| 281 | + if (function_exists('geodir_register_defaults')) {
|
|
| 282 | 282 | |
| 283 | - geodir_register_defaults(); |
|
| 283 | + geodir_register_defaults(); |
|
| 284 | 284 | |
| 285 | - } |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | - } |
|
| 287 | + } |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | |
@@ -306,26 +306,26 @@ discard block |
||
| 306 | 306 | // CALLED ON 'sidebars_widgets' FILTER |
| 307 | 307 | |
| 308 | 308 | if (!function_exists('geodir_restrict_widget')) {
|
| 309 | - /** |
|
| 310 | - * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page. |
|
| 311 | - * |
|
| 312 | - * @global bool $is_listing Sets the global value to true if on a GD category page. False if not. |
|
| 313 | - * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not. |
|
| 314 | - * @since 1.0.0 |
|
| 315 | - * @package GeoDirectory |
|
| 316 | - */ |
|
| 317 | - function geodir_restrict_widget() |
|
| 318 | - {
|
|
| 319 | - global $is_listing, $is_single_place; |
|
| 309 | + /** |
|
| 310 | + * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page. |
|
| 311 | + * |
|
| 312 | + * @global bool $is_listing Sets the global value to true if on a GD category page. False if not. |
|
| 313 | + * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not. |
|
| 314 | + * @since 1.0.0 |
|
| 315 | + * @package GeoDirectory |
|
| 316 | + */ |
|
| 317 | + function geodir_restrict_widget() |
|
| 318 | + {
|
|
| 319 | + global $is_listing, $is_single_place; |
|
| 320 | 320 | |
| 321 | - // set is listing |
|
| 322 | - (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
|
|
| 321 | + // set is listing |
|
| 322 | + (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
|
|
| 323 | 323 | |
| 324 | - // set is single place |
|
| 325 | - (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
|
|
| 324 | + // set is single place |
|
| 325 | + (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
|
|
| 326 | 326 | |
| 327 | 327 | |
| 328 | - } |
|
| 328 | + } |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | |
@@ -346,31 +346,31 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | function geodir_detail_page_sidebar_content_sorting() |
| 348 | 348 | {
|
| 349 | - $arr_detail_page_sidebar_content = |
|
| 350 | - /** |
|
| 351 | - * An array of functions to be called to be displayed on the details (post) page sidebar. |
|
| 352 | - * |
|
| 353 | - * This filter can be used to remove sections of the details page sidebar, |
|
| 354 | - * add new sections or rearrange the order of the sections. |
|
| 355 | - * |
|
| 356 | - * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
|
|
| 357 | - * @since 1.0.0 |
|
| 358 | - */ |
|
| 359 | - apply_filters('geodir_detail_page_sidebar_content',
|
|
| 360 | - array('geodir_social_sharing_buttons',
|
|
| 361 | - 'geodir_detail_page_google_analytics', |
|
| 362 | - 'geodir_edit_post_link', |
|
| 363 | - 'geodir_detail_page_review_rating', |
|
| 364 | - 'geodir_detail_page_more_info' |
|
| 365 | - ) // end of array |
|
| 366 | - ); // end of apply filter |
|
| 367 | - if (!empty($arr_detail_page_sidebar_content)) {
|
|
| 368 | - foreach ($arr_detail_page_sidebar_content as $content_function) {
|
|
| 369 | - if (function_exists($content_function)) {
|
|
| 370 | - add_action('geodir_detail_page_sidebar', $content_function);
|
|
| 371 | - } |
|
| 372 | - } |
|
| 373 | - } |
|
| 349 | + $arr_detail_page_sidebar_content = |
|
| 350 | + /** |
|
| 351 | + * An array of functions to be called to be displayed on the details (post) page sidebar. |
|
| 352 | + * |
|
| 353 | + * This filter can be used to remove sections of the details page sidebar, |
|
| 354 | + * add new sections or rearrange the order of the sections. |
|
| 355 | + * |
|
| 356 | + * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
|
|
| 357 | + * @since 1.0.0 |
|
| 358 | + */ |
|
| 359 | + apply_filters('geodir_detail_page_sidebar_content',
|
|
| 360 | + array('geodir_social_sharing_buttons',
|
|
| 361 | + 'geodir_detail_page_google_analytics', |
|
| 362 | + 'geodir_edit_post_link', |
|
| 363 | + 'geodir_detail_page_review_rating', |
|
| 364 | + 'geodir_detail_page_more_info' |
|
| 365 | + ) // end of array |
|
| 366 | + ); // end of apply filter |
|
| 367 | + if (!empty($arr_detail_page_sidebar_content)) {
|
|
| 368 | + foreach ($arr_detail_page_sidebar_content as $content_function) {
|
|
| 369 | + if (function_exists($content_function)) {
|
|
| 370 | + add_action('geodir_detail_page_sidebar', $content_function);
|
|
| 371 | + } |
|
| 372 | + } |
|
| 373 | + } |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
|
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | function geodir_add_to_favourite_link() |
| 387 | 387 | {
|
| 388 | - global $post, $preview; |
|
| 389 | - if (!$preview && geodir_is_page('detail')) {
|
|
| 390 | - ?> |
|
| 388 | + global $post, $preview; |
|
| 389 | + if (!$preview && geodir_is_page('detail')) {
|
|
| 390 | + ?> |
|
| 391 | 391 | <p class="edit_link"> |
| 392 | 392 | <?php geodir_favourite_html($post->post_author, $post->ID); ?> |
| 393 | 393 | </p> |
| 394 | 394 | <?php |
| 395 | - } |
|
| 395 | + } |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -406,41 +406,41 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | function geodir_social_sharing_buttons() |
| 408 | 408 | {
|
| 409 | - global $preview; |
|
| 410 | - ob_start(); // Start buffering; |
|
| 411 | - /** |
|
| 412 | - * This action is called before the social buttons twitter,facebook and google plus are output in a containing div. |
|
| 413 | - * |
|
| 414 | - * @since 1.0.0 |
|
| 415 | - */ |
|
| 416 | - do_action('geodir_before_social_sharing_buttons');
|
|
| 417 | - if (!$preview) {
|
|
| 418 | - ?> |
|
| 409 | + global $preview; |
|
| 410 | + ob_start(); // Start buffering; |
|
| 411 | + /** |
|
| 412 | + * This action is called before the social buttons twitter,facebook and google plus are output in a containing div. |
|
| 413 | + * |
|
| 414 | + * @since 1.0.0 |
|
| 415 | + */ |
|
| 416 | + do_action('geodir_before_social_sharing_buttons');
|
|
| 417 | + if (!$preview) {
|
|
| 418 | + ?> |
|
| 419 | 419 | <div class="likethis"> |
| 420 | 420 | <?php geodir_twitter_tweet_button(); ?> |
| 421 | 421 | <?php geodir_fb_like_button(); ?> |
| 422 | 422 | <?php geodir_google_plus_button(); ?> |
| 423 | 423 | </div> |
| 424 | 424 | <?php |
| 425 | - }// end of if, if its a preview or not |
|
| 426 | - |
|
| 427 | - /** |
|
| 428 | - * This action is called after the social buttons twitter,facebook and google plus are output in a containing div. |
|
| 429 | - * |
|
| 430 | - * @since 1.0.0 |
|
| 431 | - */ |
|
| 432 | - do_action('geodir_after_social_sharing_buttons');
|
|
| 433 | - $content_html = ob_get_clean(); |
|
| 434 | - if (trim($content_html) != '') |
|
| 435 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
| 436 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
|
|
| 437 | - /** |
|
| 438 | - * Filter the geodir_social_sharing_buttons() function content. |
|
| 439 | - * |
|
| 440 | - * @param string $content_html The output html of the geodir_social_sharing_buttons() function. |
|
| 441 | - */ |
|
| 442 | - echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
|
|
| 443 | - } |
|
| 425 | + }// end of if, if its a preview or not |
|
| 426 | + |
|
| 427 | + /** |
|
| 428 | + * This action is called after the social buttons twitter,facebook and google plus are output in a containing div. |
|
| 429 | + * |
|
| 430 | + * @since 1.0.0 |
|
| 431 | + */ |
|
| 432 | + do_action('geodir_after_social_sharing_buttons');
|
|
| 433 | + $content_html = ob_get_clean(); |
|
| 434 | + if (trim($content_html) != '') |
|
| 435 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
| 436 | + if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
|
|
| 437 | + /** |
|
| 438 | + * Filter the geodir_social_sharing_buttons() function content. |
|
| 439 | + * |
|
| 440 | + * @param string $content_html The output html of the geodir_social_sharing_buttons() function. |
|
| 441 | + */ |
|
| 442 | + echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
|
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | 445 | |
| 446 | 446 | } |
@@ -458,46 +458,46 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | function geodir_edit_post_link() |
| 460 | 460 | {
|
| 461 | - global $post, $preview; |
|
| 462 | - ob_start(); // Start buffering; |
|
| 463 | - /** |
|
| 464 | - * This is called before the edit post link html in the function geodir_edit_post_link() |
|
| 465 | - * |
|
| 466 | - * @since 1.0.0 |
|
| 467 | - */ |
|
| 468 | - do_action('geodir_before_edit_post_link');
|
|
| 469 | - if (!$preview) {
|
|
| 470 | - $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
| 461 | + global $post, $preview; |
|
| 462 | + ob_start(); // Start buffering; |
|
| 463 | + /** |
|
| 464 | + * This is called before the edit post link html in the function geodir_edit_post_link() |
|
| 465 | + * |
|
| 466 | + * @since 1.0.0 |
|
| 467 | + */ |
|
| 468 | + do_action('geodir_before_edit_post_link');
|
|
| 469 | + if (!$preview) {
|
|
| 470 | + $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
| 471 | 471 | |
| 472 | - if ($is_current_user_owner) {
|
|
| 473 | - $post_id = $post->ID; |
|
| 472 | + if ($is_current_user_owner) {
|
|
| 473 | + $post_id = $post->ID; |
|
| 474 | 474 | |
| 475 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 476 | - $post_id = (int)$_REQUEST['pid']; |
|
| 477 | - } |
|
| 475 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 476 | + $post_id = (int)$_REQUEST['pid']; |
|
| 477 | + } |
|
| 478 | 478 | |
| 479 | - $postlink = get_permalink(geodir_add_listing_page_id()); |
|
| 480 | - $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
|
|
| 481 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
|
|
| 482 | - } |
|
| 483 | - }// end of if, if its a preview or not |
|
| 484 | - /** |
|
| 485 | - * This is called after the edit post link html in the function geodir_edit_post_link() |
|
| 486 | - * |
|
| 487 | - * @since 1.0.0 |
|
| 488 | - */ |
|
| 489 | - do_action('geodir_after_edit_post_link');
|
|
| 490 | - $content_html = ob_get_clean(); |
|
| 491 | - if (trim($content_html) != '') |
|
| 492 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
| 493 | - if ((int)get_option('geodir_disable_user_links_section') != 1) {
|
|
| 494 | - /** |
|
| 495 | - * Filter the geodir_edit_post_link() function content. |
|
| 496 | - * |
|
| 497 | - * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
| 498 | - */ |
|
| 499 | - echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
|
|
| 500 | - } |
|
| 479 | + $postlink = get_permalink(geodir_add_listing_page_id()); |
|
| 480 | + $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
|
|
| 481 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
|
|
| 482 | + } |
|
| 483 | + }// end of if, if its a preview or not |
|
| 484 | + /** |
|
| 485 | + * This is called after the edit post link html in the function geodir_edit_post_link() |
|
| 486 | + * |
|
| 487 | + * @since 1.0.0 |
|
| 488 | + */ |
|
| 489 | + do_action('geodir_after_edit_post_link');
|
|
| 490 | + $content_html = ob_get_clean(); |
|
| 491 | + if (trim($content_html) != '') |
|
| 492 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
| 493 | + if ((int)get_option('geodir_disable_user_links_section') != 1) {
|
|
| 494 | + /** |
|
| 495 | + * Filter the geodir_edit_post_link() function content. |
|
| 496 | + * |
|
| 497 | + * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
| 498 | + */ |
|
| 499 | + echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
|
|
| 500 | + } |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -511,42 +511,42 @@ discard block |
||
| 511 | 511 | */ |
| 512 | 512 | function geodir_detail_page_google_analytics() |
| 513 | 513 | {
|
| 514 | - global $post,$preview; |
|
| 515 | - if($preview){return '';}
|
|
| 516 | - $package_info = array(); |
|
| 517 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 514 | + global $post,$preview; |
|
| 515 | + if($preview){return '';}
|
|
| 516 | + $package_info = array(); |
|
| 517 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 518 | 518 | |
| 519 | - $id = trim(get_option('geodir_ga_account_id'));
|
|
| 519 | + $id = trim(get_option('geodir_ga_account_id'));
|
|
| 520 | 520 | |
| 521 | - if (!$id) {
|
|
| 522 | - return; //if no Google Analytics ID then bail. |
|
| 523 | - } |
|
| 521 | + if (!$id) {
|
|
| 522 | + return; //if no Google Analytics ID then bail. |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | - ob_start(); // Start buffering; |
|
| 526 | - /** |
|
| 527 | - * This is called before the edit post link html in the function geodir_detail_page_google_analytics() |
|
| 528 | - * |
|
| 529 | - * @since 1.0.0 |
|
| 530 | - */ |
|
| 531 | - do_action('geodir_before_google_analytics');
|
|
| 525 | + ob_start(); // Start buffering; |
|
| 526 | + /** |
|
| 527 | + * This is called before the edit post link html in the function geodir_detail_page_google_analytics() |
|
| 528 | + * |
|
| 529 | + * @since 1.0.0 |
|
| 530 | + */ |
|
| 531 | + do_action('geodir_before_google_analytics');
|
|
| 532 | 532 | |
| 533 | - $refresh_time = get_option('geodir_ga_refresh_time', 5);
|
|
| 534 | - /** |
|
| 535 | - * Filter the time interval to check & refresh new users results. |
|
| 536 | - * |
|
| 537 | - * @since 1.5.9 |
|
| 538 | - * |
|
| 539 | - * @param int $refresh_time Time interval to check & refresh new users results. |
|
| 540 | - */ |
|
| 541 | - $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
|
|
| 542 | - $refresh_time = absint($refresh_time * 1000); |
|
| 533 | + $refresh_time = get_option('geodir_ga_refresh_time', 5);
|
|
| 534 | + /** |
|
| 535 | + * Filter the time interval to check & refresh new users results. |
|
| 536 | + * |
|
| 537 | + * @since 1.5.9 |
|
| 538 | + * |
|
| 539 | + * @param int $refresh_time Time interval to check & refresh new users results. |
|
| 540 | + */ |
|
| 541 | + $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
|
|
| 542 | + $refresh_time = absint($refresh_time * 1000); |
|
| 543 | 543 | |
| 544 | - $hide_refresh = get_option('geodir_ga_auto_refresh');
|
|
| 544 | + $hide_refresh = get_option('geodir_ga_auto_refresh');
|
|
| 545 | 545 | |
| 546 | - $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
|
| 547 | - if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
|
|
| 548 | - $page_url = urlencode($_SERVER['REQUEST_URI']); |
|
| 549 | - ?> |
|
| 546 | + $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
|
| 547 | + if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
|
|
| 548 | + $page_url = urlencode($_SERVER['REQUEST_URI']); |
|
| 549 | + ?> |
|
| 550 | 550 | <script type="text/javascript"> |
| 551 | 551 | var gd_gaTimeOut; |
| 552 | 552 | var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
|
@@ -798,15 +798,15 @@ discard block |
||
| 798 | 798 | var labels = results[1].rows.map(function(row) { return +row[0]; });
|
| 799 | 799 | |
| 800 | 800 | <?php |
| 801 | - // Here we list the shorthand days of the week so it can be used in translation. |
|
| 802 | - __("Mon",'geodirectory');
|
|
| 803 | - __("Tue",'geodirectory');
|
|
| 804 | - __("Wed",'geodirectory');
|
|
| 805 | - __("Thu",'geodirectory');
|
|
| 806 | - __("Fri",'geodirectory');
|
|
| 807 | - __("Sat",'geodirectory');
|
|
| 808 | - __("Sun",'geodirectory');
|
|
| 809 | - ?> |
|
| 801 | + // Here we list the shorthand days of the week so it can be used in translation. |
|
| 802 | + __("Mon",'geodirectory');
|
|
| 803 | + __("Tue",'geodirectory');
|
|
| 804 | + __("Wed",'geodirectory');
|
|
| 805 | + __("Thu",'geodirectory');
|
|
| 806 | + __("Fri",'geodirectory');
|
|
| 807 | + __("Sat",'geodirectory');
|
|
| 808 | + __("Sun",'geodirectory');
|
|
| 809 | + ?> |
|
| 810 | 810 | |
| 811 | 811 | labels = [ |
| 812 | 812 | "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
|
@@ -1055,24 +1055,24 @@ discard block |
||
| 1055 | 1055 | </span> |
| 1056 | 1056 | |
| 1057 | 1057 | <?php |
| 1058 | - } |
|
| 1059 | - /** |
|
| 1060 | - * This is called after the edit post link html in the function geodir_detail_page_google_analytics() |
|
| 1061 | - * |
|
| 1062 | - * @since 1.0.0 |
|
| 1063 | - */ |
|
| 1064 | - do_action('geodir_after_google_analytics');
|
|
| 1065 | - $content_html = ob_get_clean(); |
|
| 1066 | - if (trim($content_html) != '') |
|
| 1067 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
| 1068 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
|
|
| 1069 | - /** |
|
| 1070 | - * Filter the geodir_edit_post_link() function content. |
|
| 1071 | - * |
|
| 1072 | - * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
| 1073 | - */ |
|
| 1074 | - echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
|
|
| 1075 | - } |
|
| 1058 | + } |
|
| 1059 | + /** |
|
| 1060 | + * This is called after the edit post link html in the function geodir_detail_page_google_analytics() |
|
| 1061 | + * |
|
| 1062 | + * @since 1.0.0 |
|
| 1063 | + */ |
|
| 1064 | + do_action('geodir_after_google_analytics');
|
|
| 1065 | + $content_html = ob_get_clean(); |
|
| 1066 | + if (trim($content_html) != '') |
|
| 1067 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
| 1068 | + if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
|
|
| 1069 | + /** |
|
| 1070 | + * Filter the geodir_edit_post_link() function content. |
|
| 1071 | + * |
|
| 1072 | + * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
| 1073 | + */ |
|
| 1074 | + echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
|
|
| 1075 | + } |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | /** |
@@ -1089,94 +1089,94 @@ discard block |
||
| 1089 | 1089 | */ |
| 1090 | 1090 | function geodir_detail_page_review_rating() |
| 1091 | 1091 | {
|
| 1092 | - global $post, $preview, $post_images; |
|
| 1092 | + global $post, $preview, $post_images; |
|
| 1093 | 1093 | |
| 1094 | - if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
|
|
| 1095 | - return; |
|
| 1096 | - } |
|
| 1097 | - ob_start(); // Start buffering; |
|
| 1098 | - /** |
|
| 1099 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
| 1100 | - * |
|
| 1101 | - * This is called outside the check for an actual rating and the check for preview page. |
|
| 1102 | - * |
|
| 1103 | - * @since 1.0.0 |
|
| 1104 | - */ |
|
| 1105 | - do_action('geodir_before_detail_page_review_rating');
|
|
| 1106 | - |
|
| 1107 | - $comment_count = geodir_get_review_count_total($post->ID); |
|
| 1108 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 1109 | - |
|
| 1110 | - if ($post_avgratings != 0 && !$preview) {
|
|
| 1111 | - /** |
|
| 1112 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
| 1113 | - * |
|
| 1114 | - * This is called inside the check for an actual rating and the check for preview page. |
|
| 1115 | - * |
|
| 1116 | - * @since 1.0.0 |
|
| 1117 | - * @param float $post_avgratings Average rating for the current post. |
|
| 1118 | - * @param int $post->ID Current post ID. |
|
| 1119 | - */ |
|
| 1120 | - do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
|
|
| 1121 | - |
|
| 1122 | - $html = '<p style=" float:left;">'; |
|
| 1123 | - $html .= geodir_get_rating_stars($post_avgratings, $post->ID); |
|
| 1124 | - $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
|
| 1125 | - $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
|
| 1094 | + if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
|
|
| 1095 | + return; |
|
| 1096 | + } |
|
| 1097 | + ob_start(); // Start buffering; |
|
| 1098 | + /** |
|
| 1099 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
| 1100 | + * |
|
| 1101 | + * This is called outside the check for an actual rating and the check for preview page. |
|
| 1102 | + * |
|
| 1103 | + * @since 1.0.0 |
|
| 1104 | + */ |
|
| 1105 | + do_action('geodir_before_detail_page_review_rating');
|
|
| 1106 | + |
|
| 1107 | + $comment_count = geodir_get_review_count_total($post->ID); |
|
| 1108 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 1109 | + |
|
| 1110 | + if ($post_avgratings != 0 && !$preview) {
|
|
| 1111 | + /** |
|
| 1112 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
| 1113 | + * |
|
| 1114 | + * This is called inside the check for an actual rating and the check for preview page. |
|
| 1115 | + * |
|
| 1116 | + * @since 1.0.0 |
|
| 1117 | + * @param float $post_avgratings Average rating for the current post. |
|
| 1118 | + * @param int $post->ID Current post ID. |
|
| 1119 | + */ |
|
| 1120 | + do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
|
|
| 1121 | + |
|
| 1122 | + $html = '<p style=" float:left;">'; |
|
| 1123 | + $html .= geodir_get_rating_stars($post_avgratings, $post->ID); |
|
| 1124 | + $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
|
| 1125 | + $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
|
| 1126 | 1126 | |
| 1127 | 1127 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
|
| 1128 | 1128 | |
| 1129 | 1129 | $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
|
| 1130 | 1130 | |
| 1131 | - $html .= '<span class="item">'; |
|
| 1132 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
| 1131 | + $html .= '<span class="item">'; |
|
| 1132 | + $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
| 1133 | 1133 | |
| 1134 | - if ($post_images) {
|
|
| 1135 | - foreach ($post_images as $img) {
|
|
| 1136 | - $post_img = $img->src; |
|
| 1137 | - break; |
|
| 1138 | - } |
|
| 1139 | - } |
|
| 1140 | - |
|
| 1141 | - if (isset($post_img) && $post_img) {
|
|
| 1142 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
| 1143 | - } |
|
| 1144 | - |
|
| 1145 | - $html .= '</span>'; |
|
| 1146 | - |
|
| 1147 | - echo $html .= '</div>'; |
|
| 1148 | - /** |
|
| 1149 | - * This is called after the rating html in the function geodir_detail_page_review_rating(). |
|
| 1150 | - * |
|
| 1151 | - * This is called inside the check for an actual rating and the check for preview page. |
|
| 1152 | - * |
|
| 1153 | - * @since 1.0.0 |
|
| 1154 | - * @param float $post_avgratings Average rating for the current post. |
|
| 1155 | - * @param int $post->ID Current post ID. |
|
| 1156 | - */ |
|
| 1157 | - do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
|
|
| 1158 | - } |
|
| 1159 | - /** |
|
| 1160 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
| 1161 | - * |
|
| 1162 | - * This is called outside the check for an actual rating and the check for preview page. |
|
| 1163 | - * |
|
| 1164 | - * @since 1.0.0 |
|
| 1165 | - */ |
|
| 1166 | - do_action('geodir_after_detail_page_review_rating');
|
|
| 1167 | - $content_html = ob_get_clean(); |
|
| 1168 | - if (trim($content_html) != '') {
|
|
| 1169 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
| 1170 | - } |
|
| 1171 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) {
|
|
| 1172 | - /** |
|
| 1173 | - * Filter the geodir_detail_page_review_rating() function content. |
|
| 1174 | - * |
|
| 1175 | - * @since 1.0.0 |
|
| 1176 | - * @param string $content_html The output html of the geodir_detail_page_review_rating() function. |
|
| 1177 | - */ |
|
| 1178 | - echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
|
|
| 1179 | - } |
|
| 1134 | + if ($post_images) {
|
|
| 1135 | + foreach ($post_images as $img) {
|
|
| 1136 | + $post_img = $img->src; |
|
| 1137 | + break; |
|
| 1138 | + } |
|
| 1139 | + } |
|
| 1140 | + |
|
| 1141 | + if (isset($post_img) && $post_img) {
|
|
| 1142 | + $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
| 1143 | + } |
|
| 1144 | + |
|
| 1145 | + $html .= '</span>'; |
|
| 1146 | + |
|
| 1147 | + echo $html .= '</div>'; |
|
| 1148 | + /** |
|
| 1149 | + * This is called after the rating html in the function geodir_detail_page_review_rating(). |
|
| 1150 | + * |
|
| 1151 | + * This is called inside the check for an actual rating and the check for preview page. |
|
| 1152 | + * |
|
| 1153 | + * @since 1.0.0 |
|
| 1154 | + * @param float $post_avgratings Average rating for the current post. |
|
| 1155 | + * @param int $post->ID Current post ID. |
|
| 1156 | + */ |
|
| 1157 | + do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
|
|
| 1158 | + } |
|
| 1159 | + /** |
|
| 1160 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
| 1161 | + * |
|
| 1162 | + * This is called outside the check for an actual rating and the check for preview page. |
|
| 1163 | + * |
|
| 1164 | + * @since 1.0.0 |
|
| 1165 | + */ |
|
| 1166 | + do_action('geodir_after_detail_page_review_rating');
|
|
| 1167 | + $content_html = ob_get_clean(); |
|
| 1168 | + if (trim($content_html) != '') {
|
|
| 1169 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
| 1170 | + } |
|
| 1171 | + if ((int)get_option('geodir_disable_rating_info_section') != 1) {
|
|
| 1172 | + /** |
|
| 1173 | + * Filter the geodir_detail_page_review_rating() function content. |
|
| 1174 | + * |
|
| 1175 | + * @since 1.0.0 |
|
| 1176 | + * @param string $content_html The output html of the geodir_detail_page_review_rating() function. |
|
| 1177 | + */ |
|
| 1178 | + echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
|
|
| 1179 | + } |
|
| 1180 | 1180 | } |
| 1181 | 1181 | |
| 1182 | 1182 | /** |
@@ -1188,35 +1188,35 @@ discard block |
||
| 1188 | 1188 | */ |
| 1189 | 1189 | function geodir_detail_page_more_info() |
| 1190 | 1190 | {
|
| 1191 | - ob_start(); // Start buffering; |
|
| 1192 | - /** |
|
| 1193 | - * This is called before the info section html. |
|
| 1194 | - * |
|
| 1195 | - * @since 1.0.0 |
|
| 1196 | - */ |
|
| 1197 | - do_action('geodir_before_detail_page_more_info');
|
|
| 1198 | - if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
|
|
| 1199 | - echo $geodir_post_detail_fields; |
|
| 1200 | - } |
|
| 1201 | - /** |
|
| 1202 | - * This is called after the info section html. |
|
| 1203 | - * |
|
| 1204 | - * @since 1.0.0 |
|
| 1205 | - */ |
|
| 1206 | - do_action('geodir_after_detail_page_more_info');
|
|
| 1207 | - |
|
| 1208 | - $content_html = ob_get_clean(); |
|
| 1209 | - if (trim($content_html) != '') |
|
| 1210 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
| 1211 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) {
|
|
| 1212 | - /** |
|
| 1213 | - * Filter the output html for function geodir_detail_page_more_info(). |
|
| 1214 | - * |
|
| 1215 | - * @since 1.0.0 |
|
| 1216 | - * @param string $content_html The output html of the geodir_detail_page_more_info() function. |
|
| 1217 | - */ |
|
| 1218 | - echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
|
|
| 1219 | - } |
|
| 1191 | + ob_start(); // Start buffering; |
|
| 1192 | + /** |
|
| 1193 | + * This is called before the info section html. |
|
| 1194 | + * |
|
| 1195 | + * @since 1.0.0 |
|
| 1196 | + */ |
|
| 1197 | + do_action('geodir_before_detail_page_more_info');
|
|
| 1198 | + if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
|
|
| 1199 | + echo $geodir_post_detail_fields; |
|
| 1200 | + } |
|
| 1201 | + /** |
|
| 1202 | + * This is called after the info section html. |
|
| 1203 | + * |
|
| 1204 | + * @since 1.0.0 |
|
| 1205 | + */ |
|
| 1206 | + do_action('geodir_after_detail_page_more_info');
|
|
| 1207 | + |
|
| 1208 | + $content_html = ob_get_clean(); |
|
| 1209 | + if (trim($content_html) != '') |
|
| 1210 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
| 1211 | + if ((int)get_option('geodir_disable_listing_info_section') != 1) {
|
|
| 1212 | + /** |
|
| 1213 | + * Filter the output html for function geodir_detail_page_more_info(). |
|
| 1214 | + * |
|
| 1215 | + * @since 1.0.0 |
|
| 1216 | + * @param string $content_html The output html of the geodir_detail_page_more_info() function. |
|
| 1217 | + */ |
|
| 1218 | + echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
|
|
| 1219 | + } |
|
| 1220 | 1220 | } |
| 1221 | 1221 | |
| 1222 | 1222 | |
@@ -1230,15 +1230,15 @@ discard block |
||
| 1230 | 1230 | */ |
| 1231 | 1231 | function geodir_localize_all_js_msg() |
| 1232 | 1232 | {// check_ajax_referer function is used to make sure no files are uploaded remotely but it will fail if used between https and non https so we do the check below of the urls
|
| 1233 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
|
|
| 1234 | - $ajax_url = admin_url('admin-ajax.php');
|
|
| 1235 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
|
|
| 1236 | - $ajax_url = admin_url('admin-ajax.php');
|
|
| 1237 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
|
|
| 1238 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
|
|
| 1239 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
|
|
| 1240 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
|
|
| 1241 | - } |
|
| 1233 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
|
|
| 1234 | + $ajax_url = admin_url('admin-ajax.php');
|
|
| 1235 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
|
|
| 1236 | + $ajax_url = admin_url('admin-ajax.php');
|
|
| 1237 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
|
|
| 1238 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
|
|
| 1239 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
|
|
| 1240 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
|
|
| 1241 | + } |
|
| 1242 | 1242 | |
| 1243 | 1243 | /** |
| 1244 | 1244 | * Filter the allowed image type extensions for post images. |
@@ -1248,60 +1248,60 @@ discard block |
||
| 1248 | 1248 | */ |
| 1249 | 1249 | $allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
|
| 1250 | 1250 | |
| 1251 | - $default_marker_icon = get_option('geodir_default_marker_icon');
|
|
| 1252 | - $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
|
|
| 1253 | - $default_marker_width = $default_marker_size['w']; |
|
| 1254 | - $default_marker_height = $default_marker_size['h']; |
|
| 1251 | + $default_marker_icon = get_option('geodir_default_marker_icon');
|
|
| 1252 | + $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
|
|
| 1253 | + $default_marker_width = $default_marker_size['w']; |
|
| 1254 | + $default_marker_height = $default_marker_size['h']; |
|
| 1255 | 1255 | |
| 1256 | - $arr_alert_msg = array( |
|
| 1257 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
| 1258 | - 'geodir_admin_ajax_url' => $ajax_url, |
|
| 1259 | - 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
|
|
| 1260 | - 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
|
|
| 1261 | - 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
|
|
| 1262 | - 'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
|
|
| 1263 | - //start not show alert msg |
|
| 1264 | - 'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
|
|
| 1265 | - 'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
|
|
| 1266 | - 'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
|
|
| 1267 | - 'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
|
|
| 1268 | - 'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
|
|
| 1269 | - // end not show alert msg |
|
| 1270 | - 'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
|
|
| 1271 | - 'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
|
|
| 1272 | - //start not show alert msg |
|
| 1273 | - 'rating_error_msg' => __('Error : please retry', 'geodirectory'),
|
|
| 1274 | - 'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
|
|
| 1275 | - 'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
|
|
| 1276 | - 'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
|
|
| 1277 | - 'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
|
|
| 1278 | - 'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
|
|
| 1279 | - 'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
|
|
| 1280 | - 'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
|
|
| 1281 | - 'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
|
|
| 1282 | - 'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
|
|
| 1283 | - 'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
|
|
| 1284 | - 'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
|
|
| 1285 | - 'geodir_default_marker_icon' => $default_marker_icon, |
|
| 1286 | - 'geodir_default_marker_w' => $default_marker_width, |
|
| 1287 | - 'geodir_default_marker_h' => $default_marker_height, |
|
| 1288 | - 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG, |
|
| 1289 | - 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG, |
|
| 1290 | - 'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
|
|
| 1291 | - 'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
|
|
| 1292 | - 'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
|
|
| 1293 | - 'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
|
|
| 1294 | - 'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
|
|
| 1295 | - 'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
|
|
| 1296 | - /* on/off dragging for phone devices */ |
|
| 1297 | - 'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
|
|
| 1298 | - 'geodir_is_mobile' => wp_is_mobile() ? true : false, |
|
| 1299 | - 'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
|
|
| 1300 | - 'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
|
|
| 1301 | - 'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
|
|
| 1302 | - 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
|
|
| 1303 | - 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
|
|
| 1304 | - 'geodir_action_remove' => __('Remove', 'geodirectory'),
|
|
| 1256 | + $arr_alert_msg = array( |
|
| 1257 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
| 1258 | + 'geodir_admin_ajax_url' => $ajax_url, |
|
| 1259 | + 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
|
|
| 1260 | + 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
|
|
| 1261 | + 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
|
|
| 1262 | + 'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
|
|
| 1263 | + //start not show alert msg |
|
| 1264 | + 'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
|
|
| 1265 | + 'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
|
|
| 1266 | + 'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
|
|
| 1267 | + 'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
|
|
| 1268 | + 'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
|
|
| 1269 | + // end not show alert msg |
|
| 1270 | + 'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
|
|
| 1271 | + 'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'),
|
|
| 1272 | + //start not show alert msg |
|
| 1273 | + 'rating_error_msg' => __('Error : please retry', 'geodirectory'),
|
|
| 1274 | + 'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
|
|
| 1275 | + 'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
|
|
| 1276 | + 'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
|
|
| 1277 | + 'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
|
|
| 1278 | + 'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
|
|
| 1279 | + 'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
|
|
| 1280 | + 'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
|
|
| 1281 | + 'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
|
|
| 1282 | + 'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
|
|
| 1283 | + 'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
|
|
| 1284 | + 'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
|
|
| 1285 | + 'geodir_default_marker_icon' => $default_marker_icon, |
|
| 1286 | + 'geodir_default_marker_w' => $default_marker_width, |
|
| 1287 | + 'geodir_default_marker_h' => $default_marker_height, |
|
| 1288 | + 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG, |
|
| 1289 | + 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG, |
|
| 1290 | + 'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
|
|
| 1291 | + 'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
|
|
| 1292 | + 'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
|
|
| 1293 | + 'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
|
|
| 1294 | + 'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
|
|
| 1295 | + 'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
|
|
| 1296 | + /* on/off dragging for phone devices */ |
|
| 1297 | + 'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
|
|
| 1298 | + 'geodir_is_mobile' => wp_is_mobile() ? true : false, |
|
| 1299 | + 'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
|
|
| 1300 | + 'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
|
|
| 1301 | + 'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
|
|
| 1302 | + 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
|
|
| 1303 | + 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
|
|
| 1304 | + 'geodir_action_remove' => __('Remove', 'geodirectory'),
|
|
| 1305 | 1305 | 'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
|
| 1306 | 1306 | 'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
|
| 1307 | 1307 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
|
@@ -1309,40 +1309,40 @@ discard block |
||
| 1309 | 1309 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
|
| 1310 | 1310 | 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
|
| 1311 | 1311 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
|
| 1312 | - 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
|
|
| 1313 | - 'geodir_map_name' => geodir_map_name(), |
|
| 1314 | - 'osmStart' => __('Start', 'geodirectory'),
|
|
| 1315 | - 'osmVia' => __('Via {viaNumber}', 'geodirectory'),
|
|
| 1316 | - 'osmEnd' => __('Enter Your Location', 'geodirectory'),
|
|
| 1317 | - 'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
|
|
| 1318 | - 'geoMyLocation' => __('My Location', 'geodirectory'),
|
|
| 1319 | - 'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
|
|
| 1320 | - 'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
|
|
| 1321 | - 'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
|
|
| 1322 | - 'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
|
|
| 1323 | - 'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
|
|
| 1324 | - ); |
|
| 1325 | - |
|
| 1326 | - /** |
|
| 1327 | - * Filters the translated JS strings from function geodir_localize_all_js_msg(). |
|
| 1328 | - * |
|
| 1329 | - * With this filter you can add, remove or change translated JS strings. |
|
| 1330 | - * You should add your own translations to this if you are building an addon rather than adding another script block. |
|
| 1331 | - * |
|
| 1332 | - * @since 1.0.0 |
|
| 1333 | - */ |
|
| 1334 | - $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
|
|
| 1335 | - |
|
| 1336 | - foreach ($arr_alert_msg as $key => $value) {
|
|
| 1337 | - if (!is_scalar($value)) |
|
| 1338 | - continue; |
|
| 1339 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
| 1340 | - } |
|
| 1312 | + 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
|
|
| 1313 | + 'geodir_map_name' => geodir_map_name(), |
|
| 1314 | + 'osmStart' => __('Start', 'geodirectory'),
|
|
| 1315 | + 'osmVia' => __('Via {viaNumber}', 'geodirectory'),
|
|
| 1316 | + 'osmEnd' => __('Enter Your Location', 'geodirectory'),
|
|
| 1317 | + 'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
|
|
| 1318 | + 'geoMyLocation' => __('My Location', 'geodirectory'),
|
|
| 1319 | + 'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
|
|
| 1320 | + 'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
|
|
| 1321 | + 'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
|
|
| 1322 | + 'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
|
|
| 1323 | + 'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
|
|
| 1324 | + ); |
|
| 1325 | + |
|
| 1326 | + /** |
|
| 1327 | + * Filters the translated JS strings from function geodir_localize_all_js_msg(). |
|
| 1328 | + * |
|
| 1329 | + * With this filter you can add, remove or change translated JS strings. |
|
| 1330 | + * You should add your own translations to this if you are building an addon rather than adding another script block. |
|
| 1331 | + * |
|
| 1332 | + * @since 1.0.0 |
|
| 1333 | + */ |
|
| 1334 | + $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
|
|
| 1341 | 1335 | |
| 1342 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
| 1343 | - echo '<script>'; |
|
| 1344 | - echo $script; |
|
| 1345 | - echo '</script>'; |
|
| 1336 | + foreach ($arr_alert_msg as $key => $value) {
|
|
| 1337 | + if (!is_scalar($value)) |
|
| 1338 | + continue; |
|
| 1339 | + $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
| 1340 | + } |
|
| 1341 | + |
|
| 1342 | + $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
| 1343 | + echo '<script>'; |
|
| 1344 | + echo $script; |
|
| 1345 | + echo '</script>'; |
|
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
|
@@ -1358,11 +1358,11 @@ discard block |
||
| 1358 | 1358 | */ |
| 1359 | 1359 | function geodir_admin_bar_site_menu($wp_admin_bar) |
| 1360 | 1360 | {
|
| 1361 | - if (get_option("geodir_installed")) {
|
|
| 1362 | - if (current_user_can('manage_options')) {
|
|
| 1363 | - $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
|
|
| 1364 | - } |
|
| 1365 | - } |
|
| 1361 | + if (get_option("geodir_installed")) {
|
|
| 1362 | + if (current_user_can('manage_options')) {
|
|
| 1363 | + $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
|
|
| 1364 | + } |
|
| 1365 | + } |
|
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
|
@@ -1388,25 +1388,25 @@ discard block |
||
| 1388 | 1388 | */ |
| 1389 | 1389 | function geodir_store_sidebars() |
| 1390 | 1390 | {
|
| 1391 | - global $geodir_sidebars; |
|
| 1392 | - global $sidebars_widgets; |
|
| 1393 | - |
|
| 1394 | - if (!is_array($sidebars_widgets)) |
|
| 1395 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1396 | - $geodir_old_sidebars = array(); |
|
| 1397 | - |
|
| 1398 | - if (is_array($geodir_sidebars)) {
|
|
| 1399 | - foreach ($geodir_sidebars as $val) {
|
|
| 1400 | - if (is_array($sidebars_widgets)) {
|
|
| 1401 | - if (array_key_exists($val, $sidebars_widgets)) |
|
| 1402 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
| 1403 | - else |
|
| 1404 | - $geodir_old_sidebars[$val] = array(); |
|
| 1405 | - } |
|
| 1406 | - } |
|
| 1407 | - } |
|
| 1408 | - update_option('geodir_sidebars', $geodir_old_sidebars);
|
|
| 1409 | - geodir_option_version_backup('geodir_sidebars');
|
|
| 1391 | + global $geodir_sidebars; |
|
| 1392 | + global $sidebars_widgets; |
|
| 1393 | + |
|
| 1394 | + if (!is_array($sidebars_widgets)) |
|
| 1395 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1396 | + $geodir_old_sidebars = array(); |
|
| 1397 | + |
|
| 1398 | + if (is_array($geodir_sidebars)) {
|
|
| 1399 | + foreach ($geodir_sidebars as $val) {
|
|
| 1400 | + if (is_array($sidebars_widgets)) {
|
|
| 1401 | + if (array_key_exists($val, $sidebars_widgets)) |
|
| 1402 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
| 1403 | + else |
|
| 1404 | + $geodir_old_sidebars[$val] = array(); |
|
| 1405 | + } |
|
| 1406 | + } |
|
| 1407 | + } |
|
| 1408 | + update_option('geodir_sidebars', $geodir_old_sidebars);
|
|
| 1409 | + geodir_option_version_backup('geodir_sidebars');
|
|
| 1410 | 1410 | |
| 1411 | 1411 | } |
| 1412 | 1412 | |
@@ -1420,28 +1420,28 @@ discard block |
||
| 1420 | 1420 | */ |
| 1421 | 1421 | function geodir_restore_sidebars() |
| 1422 | 1422 | {
|
| 1423 | - global $sidebars_widgets; |
|
| 1424 | - |
|
| 1425 | - if (!is_array($sidebars_widgets)) |
|
| 1426 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1427 | - |
|
| 1428 | - if (is_array($sidebars_widgets)) {
|
|
| 1429 | - $geodir_old_sidebars = get_option('geodir_sidebars');
|
|
| 1430 | - if (is_array($geodir_old_sidebars)) {
|
|
| 1431 | - foreach ($geodir_old_sidebars as $key => $val) {
|
|
| 1432 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
| 1433 | - {
|
|
| 1434 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
| 1435 | - } |
|
| 1423 | + global $sidebars_widgets; |
|
| 1436 | 1424 | |
| 1425 | + if (!is_array($sidebars_widgets)) |
|
| 1426 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1437 | 1427 | |
| 1438 | - } |
|
| 1439 | - } |
|
| 1428 | + if (is_array($sidebars_widgets)) {
|
|
| 1429 | + $geodir_old_sidebars = get_option('geodir_sidebars');
|
|
| 1430 | + if (is_array($geodir_old_sidebars)) {
|
|
| 1431 | + foreach ($geodir_old_sidebars as $key => $val) {
|
|
| 1432 | + if(0 === strpos($key, 'geodir_'))// if gd widget |
|
| 1433 | + {
|
|
| 1434 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
| 1435 | + } |
|
| 1440 | 1436 | |
| 1441 | - } |
|
| 1442 | 1437 | |
| 1443 | - update_option('sidebars_widgets', $sidebars_widgets);
|
|
| 1444 | - update_option('geodir_sidebars', '');
|
|
| 1438 | + } |
|
| 1439 | + } |
|
| 1440 | + |
|
| 1441 | + } |
|
| 1442 | + |
|
| 1443 | + update_option('sidebars_widgets', $sidebars_widgets);
|
|
| 1444 | + update_option('geodir_sidebars', '');
|
|
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
|
@@ -1454,9 +1454,9 @@ discard block |
||
| 1454 | 1454 | */ |
| 1455 | 1455 | function geodir_after_listing_post_gridview() |
| 1456 | 1456 | {
|
| 1457 | - global $gridview_columns; |
|
| 1457 | + global $gridview_columns; |
|
| 1458 | 1458 | |
| 1459 | - $gridview_columns = ''; |
|
| 1459 | + $gridview_columns = ''; |
|
| 1460 | 1460 | |
| 1461 | 1461 | } |
| 1462 | 1462 | |
@@ -1484,11 +1484,11 @@ discard block |
||
| 1484 | 1484 | */ |
| 1485 | 1485 | function so_handle_038($url, $original_url, $_context) |
| 1486 | 1486 | {
|
| 1487 | - if (strstr($url, "maps.google.com/maps/api/js") !== false) {
|
|
| 1488 | - $url = str_replace("&", "&", $url); // or $url = $original_url
|
|
| 1489 | - } |
|
| 1487 | + if (strstr($url, "maps.google.com/maps/api/js") !== false) {
|
|
| 1488 | + $url = str_replace("&", "&", $url); // or $url = $original_url
|
|
| 1489 | + } |
|
| 1490 | 1490 | |
| 1491 | - return $url; |
|
| 1491 | + return $url; |
|
| 1492 | 1492 | } |
| 1493 | 1493 | |
| 1494 | 1494 | |
@@ -1504,34 +1504,34 @@ discard block |
||
| 1504 | 1504 | function geodir_after_main_form_fields() {
|
| 1505 | 1505 | global $gd_session; |
| 1506 | 1506 | |
| 1507 | - if (get_option('geodir_accept_term_condition')) {
|
|
| 1508 | - global $post; |
|
| 1509 | - $term_condition = ''; |
|
| 1510 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 1511 | - $post = (object)$gd_session->get('listing');
|
|
| 1512 | - $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
|
| 1513 | - } |
|
| 1514 | - |
|
| 1515 | - ?> |
|
| 1507 | + if (get_option('geodir_accept_term_condition')) {
|
|
| 1508 | + global $post; |
|
| 1509 | + $term_condition = ''; |
|
| 1510 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 1511 | + $post = (object)$gd_session->get('listing');
|
|
| 1512 | + $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
|
| 1513 | + } |
|
| 1514 | + |
|
| 1515 | + ?> |
|
| 1516 | 1516 | <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix"> |
| 1517 | 1517 | <label> </label> |
| 1518 | 1518 | |
| 1519 | 1519 | <div class="geodir_taxonomy_field" style="float:left; width:70%;"> |
| 1520 | 1520 | <span style="display:block"> |
| 1521 | 1521 | <input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
|
| 1522 | - echo 'checked="checked"'; |
|
| 1523 | - } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
|
| 1522 | + echo 'checked="checked"'; |
|
| 1523 | + } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
|
| 1524 | 1524 | class="geodir_textfield" value="1" |
| 1525 | 1525 | style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
|
| 1526 | 1526 | </span> |
| 1527 | 1527 | </div> |
| 1528 | 1528 | <span class="geodir_message_error"><?php if (isset($required_msg)) {
|
| 1529 | - _e($required_msg, 'geodirectory'); |
|
| 1530 | - } ?></span> |
|
| 1529 | + _e($required_msg, 'geodirectory'); |
|
| 1530 | + } ?></span> |
|
| 1531 | 1531 | </div> |
| 1532 | 1532 | <?php |
| 1533 | 1533 | |
| 1534 | - } |
|
| 1534 | + } |
|
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | 1537 | |
@@ -1556,42 +1556,42 @@ discard block |
||
| 1556 | 1556 | */ |
| 1557 | 1557 | function geodir_detail_page_tab_is_display($is_display, $tab) |
| 1558 | 1558 | {
|
| 1559 | - global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
| 1559 | + global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
| 1560 | 1560 | |
| 1561 | - if ($tab == 'post_profile') {
|
|
| 1562 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1563 | - $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
|
|
| 1561 | + if ($tab == 'post_profile') {
|
|
| 1562 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1563 | + $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
|
|
| 1564 | 1564 | |
| 1565 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) {
|
|
| 1566 | - $is_display = false; |
|
| 1567 | - } |
|
| 1568 | - } |
|
| 1565 | + if (!($desc_limit === '' || (int)$desc_limit > 0)) {
|
|
| 1566 | + $is_display = false; |
|
| 1567 | + } |
|
| 1568 | + } |
|
| 1569 | 1569 | |
| 1570 | - if ($tab == 'post_info') |
|
| 1571 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
| 1570 | + if ($tab == 'post_info') |
|
| 1571 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
| 1572 | 1572 | |
| 1573 | - if ($tab == 'post_images') |
|
| 1574 | - $is_display = (!empty($post_images)) ? true : false; |
|
| 1573 | + if ($tab == 'post_images') |
|
| 1574 | + $is_display = (!empty($post_images)) ? true : false; |
|
| 1575 | 1575 | |
| 1576 | - if ($tab == 'post_video') |
|
| 1577 | - $is_display = (!empty($video)) ? true : false; |
|
| 1576 | + if ($tab == 'post_video') |
|
| 1577 | + $is_display = (!empty($video)) ? true : false; |
|
| 1578 | 1578 | |
| 1579 | - if ($tab == 'special_offers') |
|
| 1580 | - $is_display = (!empty($special_offers)) ? true : false; |
|
| 1579 | + if ($tab == 'special_offers') |
|
| 1580 | + $is_display = (!empty($special_offers)) ? true : false; |
|
| 1581 | 1581 | |
| 1582 | - if ($tab == 'reviews') |
|
| 1583 | - $is_display = (geodir_is_page('detail')) ? true : false;
|
|
| 1582 | + if ($tab == 'reviews') |
|
| 1583 | + $is_display = (geodir_is_page('detail')) ? true : false;
|
|
| 1584 | 1584 | |
| 1585 | - if ($tab == 'related_listing') {
|
|
| 1586 | - $message = __('No listings found which match your selection.', 'geodirectory');
|
|
| 1585 | + if ($tab == 'related_listing') {
|
|
| 1586 | + $message = __('No listings found which match your selection.', 'geodirectory');
|
|
| 1587 | 1587 | |
| 1588 | - /** This action is documented in geodirectory-functions/template_functions.php */ |
|
| 1589 | - $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
|
|
| 1588 | + /** This action is documented in geodirectory-functions/template_functions.php */ |
|
| 1589 | + $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
|
|
| 1590 | 1590 | |
| 1591 | - $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
|
|
| 1592 | - } |
|
| 1591 | + $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
|
|
| 1592 | + } |
|
| 1593 | 1593 | |
| 1594 | - return $is_display; |
|
| 1594 | + return $is_display; |
|
| 1595 | 1595 | } |
| 1596 | 1596 | |
| 1597 | 1597 | |
@@ -1607,69 +1607,69 @@ discard block |
||
| 1607 | 1607 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 1608 | 1608 | */ |
| 1609 | 1609 | function geodir_changes_in_custom_fields_table() {
|
| 1610 | - global $wpdb, $plugin_prefix; |
|
| 1610 | + global $wpdb, $plugin_prefix; |
|
| 1611 | 1611 | |
| 1612 | 1612 | // Remove unused virtual page |
| 1613 | 1613 | $listings_page_id = (int)get_option('geodir_listing_page');
|
| 1614 | 1614 | if ($listings_page_id) {
|
| 1615 | 1615 | $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
|
| 1616 | - delete_option('geodir_listing_page');
|
|
| 1616 | + delete_option('geodir_listing_page');
|
|
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | - if (!get_option('geodir_changes_in_custom_fields_table')) {
|
|
| 1620 | - $wpdb->query( |
|
| 1621 | - $wpdb->prepare( |
|
| 1622 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
| 1623 | - array('1', '1', 'admin')
|
|
| 1624 | - ) |
|
| 1625 | - ); |
|
| 1619 | + if (!get_option('geodir_changes_in_custom_fields_table')) {
|
|
| 1620 | + $wpdb->query( |
|
| 1621 | + $wpdb->prepare( |
|
| 1622 | + "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
| 1623 | + array('1', '1', 'admin')
|
|
| 1624 | + ) |
|
| 1625 | + ); |
|
| 1626 | 1626 | |
| 1627 | 1627 | |
| 1628 | - /* --- terms meta value set --- */ |
|
| 1628 | + /* --- terms meta value set --- */ |
|
| 1629 | 1629 | |
| 1630 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
|
|
| 1630 | + update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
|
|
| 1631 | 1631 | |
| 1632 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
|
|
| 1632 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
|
|
| 1633 | 1633 | |
| 1634 | - if (!empty($options_data)) {
|
|
| 1634 | + if (!empty($options_data)) {
|
|
| 1635 | 1635 | |
| 1636 | - foreach ($options_data as $optobj) {
|
|
| 1636 | + foreach ($options_data as $optobj) {
|
|
| 1637 | 1637 | |
| 1638 | - $option_val = str_replace('tax_meta_', '', $optobj->option_name);
|
|
| 1638 | + $option_val = str_replace('tax_meta_', '', $optobj->option_name);
|
|
| 1639 | 1639 | |
| 1640 | - $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
|
|
| 1640 | + $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
|
|
| 1641 | 1641 | |
| 1642 | - if (!empty($taxonomies_data)) {
|
|
| 1642 | + if (!empty($taxonomies_data)) {
|
|
| 1643 | 1643 | |
| 1644 | - foreach ($taxonomies_data as $taxobj) {
|
|
| 1644 | + foreach ($taxonomies_data as $taxobj) {
|
|
| 1645 | 1645 | |
| 1646 | - $taxObject = get_taxonomy($taxobj->taxonomy); |
|
| 1647 | - $post_type = $taxObject->object_type[0]; |
|
| 1646 | + $taxObject = get_taxonomy($taxobj->taxonomy); |
|
| 1647 | + $post_type = $taxObject->object_type[0]; |
|
| 1648 | 1648 | |
| 1649 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
| 1649 | + $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
| 1650 | 1650 | |
| 1651 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
|
|
| 1651 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
|
|
| 1652 | 1652 | |
| 1653 | - if ($duplicate_data) {
|
|
| 1653 | + if ($duplicate_data) {
|
|
| 1654 | 1654 | |
| 1655 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
|
|
| 1655 | + $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
|
|
| 1656 | 1656 | |
| 1657 | - } else {
|
|
| 1657 | + } else {
|
|
| 1658 | 1658 | |
| 1659 | - $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
|
|
| 1659 | + $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
|
|
| 1660 | 1660 | |
| 1661 | - } |
|
| 1661 | + } |
|
| 1662 | 1662 | |
| 1663 | - } |
|
| 1663 | + } |
|
| 1664 | 1664 | |
| 1665 | - } |
|
| 1665 | + } |
|
| 1666 | 1666 | |
| 1667 | - } |
|
| 1668 | - } |
|
| 1667 | + } |
|
| 1668 | + } |
|
| 1669 | 1669 | |
| 1670 | - update_option('geodir_changes_in_custom_fields_table', '1');
|
|
| 1670 | + update_option('geodir_changes_in_custom_fields_table', '1');
|
|
| 1671 | 1671 | |
| 1672 | - } |
|
| 1672 | + } |
|
| 1673 | 1673 | |
| 1674 | 1674 | } |
| 1675 | 1675 | |
@@ -1688,24 +1688,24 @@ discard block |
||
| 1688 | 1688 | function geodir_location_slug_check($slug) |
| 1689 | 1689 | {
|
| 1690 | 1690 | |
| 1691 | - global $wpdb, $table_prefix; |
|
| 1691 | + global $wpdb, $table_prefix; |
|
| 1692 | 1692 | |
| 1693 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
|
|
| 1693 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
|
|
| 1694 | 1694 | |
| 1695 | - if ($slug_exists) {
|
|
| 1695 | + if ($slug_exists) {
|
|
| 1696 | 1696 | |
| 1697 | - $suffix = 1; |
|
| 1698 | - do {
|
|
| 1699 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
| 1700 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
|
|
| 1701 | - $suffix++; |
|
| 1702 | - } while ($location_slug_check && $suffix < 100); |
|
| 1697 | + $suffix = 1; |
|
| 1698 | + do {
|
|
| 1699 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
| 1700 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
|
|
| 1701 | + $suffix++; |
|
| 1702 | + } while ($location_slug_check && $suffix < 100); |
|
| 1703 | 1703 | |
| 1704 | - $slug = $alt_location_name; |
|
| 1704 | + $slug = $alt_location_name; |
|
| 1705 | 1705 | |
| 1706 | - } |
|
| 1706 | + } |
|
| 1707 | 1707 | |
| 1708 | - return $slug; |
|
| 1708 | + return $slug; |
|
| 1709 | 1709 | |
| 1710 | 1710 | } |
| 1711 | 1711 | |
@@ -1730,42 +1730,42 @@ discard block |
||
| 1730 | 1730 | function geodir_update_term_slug($term_id, $tt_id, $taxonomy) |
| 1731 | 1731 | {
|
| 1732 | 1732 | |
| 1733 | - global $wpdb, $plugin_prefix, $table_prefix; |
|
| 1733 | + global $wpdb, $plugin_prefix, $table_prefix; |
|
| 1734 | 1734 | |
| 1735 | - $tern_data = get_term_by('id', $term_id, $taxonomy);
|
|
| 1735 | + $tern_data = get_term_by('id', $term_id, $taxonomy);
|
|
| 1736 | 1736 | |
| 1737 | - $slug = $tern_data->slug; |
|
| 1737 | + $slug = $tern_data->slug; |
|
| 1738 | 1738 | |
| 1739 | - /** |
|
| 1740 | - * Filter if a term slug exists. |
|
| 1741 | - * |
|
| 1742 | - * @since 1.0.0 |
|
| 1743 | - * @package GeoDirectory |
|
| 1744 | - * @param bool $bool Default: false. |
|
| 1745 | - * @param string $slug The term slug. |
|
| 1746 | - * @param int $term_id The term ID. |
|
| 1747 | - */ |
|
| 1748 | - $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
|
|
| 1739 | + /** |
|
| 1740 | + * Filter if a term slug exists. |
|
| 1741 | + * |
|
| 1742 | + * @since 1.0.0 |
|
| 1743 | + * @package GeoDirectory |
|
| 1744 | + * @param bool $bool Default: false. |
|
| 1745 | + * @param string $slug The term slug. |
|
| 1746 | + * @param int $term_id The term ID. |
|
| 1747 | + */ |
|
| 1748 | + $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
|
|
| 1749 | 1749 | |
| 1750 | - if ($slug_exists) {
|
|
| 1750 | + if ($slug_exists) {
|
|
| 1751 | 1751 | |
| 1752 | - $suffix = 1; |
|
| 1753 | - do {
|
|
| 1754 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
| 1752 | + $suffix = 1; |
|
| 1753 | + do {
|
|
| 1754 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
| 1755 | 1755 | |
| 1756 | - /** This action is documented in geodirectory_hooks_actions.php */ |
|
| 1757 | - $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
|
|
| 1756 | + /** This action is documented in geodirectory_hooks_actions.php */ |
|
| 1757 | + $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
|
|
| 1758 | 1758 | |
| 1759 | - $suffix++; |
|
| 1760 | - } while ($term_slug_check && $suffix < 100); |
|
| 1759 | + $suffix++; |
|
| 1760 | + } while ($term_slug_check && $suffix < 100); |
|
| 1761 | 1761 | |
| 1762 | - $slug = $new_slug; |
|
| 1762 | + $slug = $new_slug; |
|
| 1763 | 1763 | |
| 1764 | - //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
|
|
| 1764 | + //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
|
|
| 1765 | 1765 | |
| 1766 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
|
|
| 1766 | + $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
|
|
| 1767 | 1767 | |
| 1768 | - } |
|
| 1768 | + } |
|
| 1769 | 1769 | |
| 1770 | 1770 | // Update tag in detail table. |
| 1771 | 1771 | $taxonomy_obj = get_taxonomy($taxonomy); |
@@ -1806,21 +1806,21 @@ discard block |
||
| 1806 | 1806 | function geodir_term_slug_is_exists($slug_exists, $slug, $term_id) |
| 1807 | 1807 | {
|
| 1808 | 1808 | |
| 1809 | - global $wpdb, $table_prefix; |
|
| 1809 | + global $wpdb, $table_prefix; |
|
| 1810 | 1810 | |
| 1811 | - $default_location = geodir_get_default_location(); |
|
| 1811 | + $default_location = geodir_get_default_location(); |
|
| 1812 | 1812 | |
| 1813 | - $country_slug = $default_location->country_slug; |
|
| 1814 | - $region_slug = $default_location->region_slug; |
|
| 1815 | - $city_slug = $default_location->city_slug; |
|
| 1813 | + $country_slug = $default_location->country_slug; |
|
| 1814 | + $region_slug = $default_location->region_slug; |
|
| 1815 | + $city_slug = $default_location->city_slug; |
|
| 1816 | 1816 | |
| 1817 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
| 1818 | - return $slug_exists = true; |
|
| 1817 | + if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
| 1818 | + return $slug_exists = true; |
|
| 1819 | 1819 | |
| 1820 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
|
|
| 1821 | - return $slug_exists = true; |
|
| 1820 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
|
|
| 1821 | + return $slug_exists = true; |
|
| 1822 | 1822 | |
| 1823 | - return $slug_exists; |
|
| 1823 | + return $slug_exists; |
|
| 1824 | 1824 | } |
| 1825 | 1825 | |
| 1826 | 1826 | |
@@ -1840,75 +1840,75 @@ discard block |
||
| 1840 | 1840 | */ |
| 1841 | 1841 | function geodir_custom_page_title($title = '', $sep = '') |
| 1842 | 1842 | {
|
| 1843 | - global $wp; |
|
| 1844 | - if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
|
|
| 1845 | - return $title; |
|
| 1846 | - } |
|
| 1843 | + global $wp; |
|
| 1844 | + if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
|
|
| 1845 | + return $title; |
|
| 1846 | + } |
|
| 1847 | 1847 | |
| 1848 | - if ($sep == '') {
|
|
| 1849 | - /** |
|
| 1850 | - * Filter the page title separator. |
|
| 1851 | - * |
|
| 1852 | - * @since 1.0.0 |
|
| 1853 | - * @package GeoDirectory |
|
| 1854 | - * @param string $sep The separator, default: `|`. |
|
| 1855 | - */ |
|
| 1856 | - $sep = apply_filters('geodir_page_title_separator', '|');
|
|
| 1857 | - } |
|
| 1848 | + if ($sep == '') {
|
|
| 1849 | + /** |
|
| 1850 | + * Filter the page title separator. |
|
| 1851 | + * |
|
| 1852 | + * @since 1.0.0 |
|
| 1853 | + * @package GeoDirectory |
|
| 1854 | + * @param string $sep The separator, default: `|`. |
|
| 1855 | + */ |
|
| 1856 | + $sep = apply_filters('geodir_page_title_separator', '|');
|
|
| 1857 | + } |
|
| 1858 | 1858 | |
| 1859 | 1859 | |
| 1860 | - $gd_page = ''; |
|
| 1861 | - if(geodir_is_page('home')){
|
|
| 1862 | - $gd_page = 'home'; |
|
| 1863 | - $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
|
|
| 1864 | - } |
|
| 1865 | - elseif(geodir_is_page('detail')){
|
|
| 1866 | - $gd_page = 'detail'; |
|
| 1867 | - $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
|
|
| 1868 | - } |
|
| 1869 | - elseif(geodir_is_page('pt')){
|
|
| 1870 | - $gd_page = 'pt'; |
|
| 1871 | - $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
|
|
| 1872 | - } |
|
| 1873 | - elseif(geodir_is_page('listing')){
|
|
| 1874 | - $gd_page = 'listing'; |
|
| 1875 | - $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
|
|
| 1876 | - } |
|
| 1877 | - elseif(geodir_is_page('location')){
|
|
| 1878 | - $gd_page = 'location'; |
|
| 1879 | - $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
|
|
| 1880 | - } |
|
| 1881 | - elseif(geodir_is_page('search')){
|
|
| 1882 | - $gd_page = 'search'; |
|
| 1883 | - $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
|
|
| 1884 | - } |
|
| 1885 | - elseif(geodir_is_page('add-listing')){
|
|
| 1886 | - $gd_page = 'add-listing'; |
|
| 1887 | - $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
|
|
| 1888 | - } |
|
| 1889 | - elseif(geodir_is_page('author')){
|
|
| 1890 | - $gd_page = 'author'; |
|
| 1891 | - $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
|
|
| 1892 | - } |
|
| 1893 | - elseif(geodir_is_page('login')){
|
|
| 1894 | - $gd_page = 'login'; |
|
| 1895 | - $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
|
|
| 1896 | - } |
|
| 1897 | - elseif(geodir_is_page('listing-success')){
|
|
| 1898 | - $gd_page = 'listing-success'; |
|
| 1899 | - $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
|
|
| 1900 | - } |
|
| 1860 | + $gd_page = ''; |
|
| 1861 | + if(geodir_is_page('home')){
|
|
| 1862 | + $gd_page = 'home'; |
|
| 1863 | + $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
|
|
| 1864 | + } |
|
| 1865 | + elseif(geodir_is_page('detail')){
|
|
| 1866 | + $gd_page = 'detail'; |
|
| 1867 | + $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
|
|
| 1868 | + } |
|
| 1869 | + elseif(geodir_is_page('pt')){
|
|
| 1870 | + $gd_page = 'pt'; |
|
| 1871 | + $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
|
|
| 1872 | + } |
|
| 1873 | + elseif(geodir_is_page('listing')){
|
|
| 1874 | + $gd_page = 'listing'; |
|
| 1875 | + $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
|
|
| 1876 | + } |
|
| 1877 | + elseif(geodir_is_page('location')){
|
|
| 1878 | + $gd_page = 'location'; |
|
| 1879 | + $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
|
|
| 1880 | + } |
|
| 1881 | + elseif(geodir_is_page('search')){
|
|
| 1882 | + $gd_page = 'search'; |
|
| 1883 | + $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
|
|
| 1884 | + } |
|
| 1885 | + elseif(geodir_is_page('add-listing')){
|
|
| 1886 | + $gd_page = 'add-listing'; |
|
| 1887 | + $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
|
|
| 1888 | + } |
|
| 1889 | + elseif(geodir_is_page('author')){
|
|
| 1890 | + $gd_page = 'author'; |
|
| 1891 | + $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
|
|
| 1892 | + } |
|
| 1893 | + elseif(geodir_is_page('login')){
|
|
| 1894 | + $gd_page = 'login'; |
|
| 1895 | + $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
|
|
| 1896 | + } |
|
| 1897 | + elseif(geodir_is_page('listing-success')){
|
|
| 1898 | + $gd_page = 'listing-success'; |
|
| 1899 | + $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
|
|
| 1900 | + } |
|
| 1901 | 1901 | |
| 1902 | 1902 | |
| 1903 | - /** |
|
| 1904 | - * Filter page meta title to replace variables. |
|
| 1905 | - * |
|
| 1906 | - * @since 1.5.4 |
|
| 1907 | - * @param string $title The page title including variables. |
|
| 1908 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 1909 | - * @param string $sep The title separator symbol. |
|
| 1910 | - */ |
|
| 1911 | - return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
|
|
| 1903 | + /** |
|
| 1904 | + * Filter page meta title to replace variables. |
|
| 1905 | + * |
|
| 1906 | + * @since 1.5.4 |
|
| 1907 | + * @param string $title The page title including variables. |
|
| 1908 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 1909 | + * @param string $sep The title separator symbol. |
|
| 1910 | + */ |
|
| 1911 | + return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
|
|
| 1912 | 1912 | |
| 1913 | 1913 | } |
| 1914 | 1914 | |
@@ -1924,36 +1924,36 @@ discard block |
||
| 1924 | 1924 | function geodir_set_post_attachment() |
| 1925 | 1925 | {
|
| 1926 | 1926 | |
| 1927 | - if (!get_option('geodir_set_post_attachments')) {
|
|
| 1927 | + if (!get_option('geodir_set_post_attachments')) {
|
|
| 1928 | 1928 | |
| 1929 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 1930 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1929 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
| 1930 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1931 | 1931 | |
| 1932 | - $all_postypes = geodir_get_posttypes(); |
|
| 1932 | + $all_postypes = geodir_get_posttypes(); |
|
| 1933 | 1933 | |
| 1934 | - foreach($all_postypes as $post_type){
|
|
| 1935 | - $args = array( |
|
| 1936 | - 'posts_per_page' => -1, |
|
| 1937 | - 'post_type' => $post_type, |
|
| 1938 | - 'post_status' => 'publish'); |
|
| 1934 | + foreach($all_postypes as $post_type){
|
|
| 1935 | + $args = array( |
|
| 1936 | + 'posts_per_page' => -1, |
|
| 1937 | + 'post_type' => $post_type, |
|
| 1938 | + 'post_status' => 'publish'); |
|
| 1939 | 1939 | |
| 1940 | - $posts_array = get_posts($args); |
|
| 1940 | + $posts_array = get_posts($args); |
|
| 1941 | 1941 | |
| 1942 | - if (!empty($posts_array)) {
|
|
| 1942 | + if (!empty($posts_array)) {
|
|
| 1943 | 1943 | |
| 1944 | - foreach ($posts_array as $post) {
|
|
| 1944 | + foreach ($posts_array as $post) {
|
|
| 1945 | 1945 | |
| 1946 | - geodir_set_wp_featured_image($post->ID); |
|
| 1946 | + geodir_set_wp_featured_image($post->ID); |
|
| 1947 | 1947 | |
| 1948 | - } |
|
| 1948 | + } |
|
| 1949 | 1949 | |
| 1950 | - } |
|
| 1951 | - } |
|
| 1950 | + } |
|
| 1951 | + } |
|
| 1952 | 1952 | |
| 1953 | 1953 | |
| 1954 | - update_option('geodir_set_post_attachments', '1');
|
|
| 1954 | + update_option('geodir_set_post_attachments', '1');
|
|
| 1955 | 1955 | |
| 1956 | - } |
|
| 1956 | + } |
|
| 1957 | 1957 | |
| 1958 | 1958 | } |
| 1959 | 1959 | |
@@ -1970,19 +1970,19 @@ discard block |
||
| 1970 | 1970 | function geodir_remove_url_seperator() |
| 1971 | 1971 | {
|
| 1972 | 1972 | |
| 1973 | - if (!get_option('geodir_remove_url_seperator')) {
|
|
| 1973 | + if (!get_option('geodir_remove_url_seperator')) {
|
|
| 1974 | 1974 | |
| 1975 | - if (get_option('geodir_listingurl_separator'))
|
|
| 1976 | - delete_option('geodir_listingurl_separator');
|
|
| 1975 | + if (get_option('geodir_listingurl_separator'))
|
|
| 1976 | + delete_option('geodir_listingurl_separator');
|
|
| 1977 | 1977 | |
| 1978 | - if (get_option('geodir_detailurl_separator'))
|
|
| 1979 | - delete_option('geodir_detailurl_separator');
|
|
| 1978 | + if (get_option('geodir_detailurl_separator'))
|
|
| 1979 | + delete_option('geodir_detailurl_separator');
|
|
| 1980 | 1980 | |
| 1981 | - flush_rewrite_rules(false); |
|
| 1981 | + flush_rewrite_rules(false); |
|
| 1982 | 1982 | |
| 1983 | - update_option('geodir_remove_url_seperator', '1');
|
|
| 1983 | + update_option('geodir_remove_url_seperator', '1');
|
|
| 1984 | 1984 | |
| 1985 | - } |
|
| 1985 | + } |
|
| 1986 | 1986 | |
| 1987 | 1987 | } |
| 1988 | 1988 | |
@@ -1998,19 +1998,19 @@ discard block |
||
| 1998 | 1998 | */ |
| 1999 | 1999 | function geodir_remove_url_seperator_form_permalink_settings($permalink_arr) |
| 2000 | 2000 | {
|
| 2001 | - foreach ($permalink_arr as $key => $value) {
|
|
| 2001 | + foreach ($permalink_arr as $key => $value) {
|
|
| 2002 | 2002 | |
| 2003 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
| 2004 | - unset($permalink_arr[$key]); |
|
| 2003 | + if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
| 2004 | + unset($permalink_arr[$key]); |
|
| 2005 | 2005 | |
| 2006 | - } |
|
| 2006 | + } |
|
| 2007 | 2007 | |
| 2008 | - return $permalink_arr; |
|
| 2008 | + return $permalink_arr; |
|
| 2009 | 2009 | |
| 2010 | 2010 | } |
| 2011 | 2011 | |
| 2012 | 2012 | if (!is_admin()) {
|
| 2013 | - add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
|
|
| 2013 | + add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
|
|
| 2014 | 2014 | } |
| 2015 | 2015 | /** |
| 2016 | 2016 | * Set status from draft to publish. |
@@ -2023,16 +2023,16 @@ discard block |
||
| 2023 | 2023 | */ |
| 2024 | 2024 | function geodir_set_status_draft_to_publish_for_own_post($post) |
| 2025 | 2025 | {
|
| 2026 | - $user_id = get_current_user_id(); |
|
| 2026 | + $user_id = get_current_user_id(); |
|
| 2027 | 2027 | |
| 2028 | - if(!$user_id){return $post;}
|
|
| 2028 | + if(!$user_id){return $post;}
|
|
| 2029 | 2029 | |
| 2030 | - $gd_post_types = geodir_get_posttypes(); |
|
| 2030 | + $gd_post_types = geodir_get_posttypes(); |
|
| 2031 | 2031 | |
| 2032 | - if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
|
|
| 2033 | - $post[0]->post_status = 'publish'; |
|
| 2034 | - } |
|
| 2035 | - return $post; |
|
| 2032 | + if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
|
|
| 2033 | + $post[0]->post_status = 'publish'; |
|
| 2034 | + } |
|
| 2035 | + return $post; |
|
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | 2038 | |
@@ -2124,33 +2124,33 @@ discard block |
||
| 2124 | 2124 | */ |
| 2125 | 2125 | function geodir_detail_page_tab_headings_change($tabs_arr) |
| 2126 | 2126 | {
|
| 2127 | - global $wpdb; |
|
| 2127 | + global $wpdb; |
|
| 2128 | 2128 | |
| 2129 | - $post_type = geodir_get_current_posttype(); |
|
| 2129 | + $post_type = geodir_get_current_posttype(); |
|
| 2130 | 2130 | |
| 2131 | - $all_postypes = geodir_get_posttypes(); |
|
| 2131 | + $all_postypes = geodir_get_posttypes(); |
|
| 2132 | 2132 | |
| 2133 | - if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
|
|
| 2133 | + if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
|
|
| 2134 | 2134 | |
| 2135 | - if (array_key_exists('post_video', $tabs_arr)) {
|
|
| 2135 | + if (array_key_exists('post_video', $tabs_arr)) {
|
|
| 2136 | 2136 | |
| 2137 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
|
|
| 2137 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
|
|
| 2138 | 2138 | |
| 2139 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
| 2140 | - $tabs_arr['post_video']['heading_text'] = $field_title; |
|
| 2141 | - } |
|
| 2139 | + if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
| 2140 | + $tabs_arr['post_video']['heading_text'] = $field_title; |
|
| 2141 | + } |
|
| 2142 | 2142 | |
| 2143 | - if (array_key_exists('special_offers', $tabs_arr)) {
|
|
| 2143 | + if (array_key_exists('special_offers', $tabs_arr)) {
|
|
| 2144 | 2144 | |
| 2145 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
|
|
| 2145 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
|
|
| 2146 | 2146 | |
| 2147 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
| 2148 | - $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
| 2149 | - } |
|
| 2147 | + if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
| 2148 | + $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
| 2149 | + } |
|
| 2150 | 2150 | |
| 2151 | - } |
|
| 2151 | + } |
|
| 2152 | 2152 | |
| 2153 | - return $tabs_arr; |
|
| 2153 | + return $tabs_arr; |
|
| 2154 | 2154 | |
| 2155 | 2155 | } |
| 2156 | 2156 | |
@@ -2163,10 +2163,10 @@ discard block |
||
| 2163 | 2163 | */ |
| 2164 | 2164 | function geodir_remove_template_redirect_actions() |
| 2165 | 2165 | {
|
| 2166 | - if (geodir_is_page('login')){
|
|
| 2167 | - remove_all_actions('template_redirect');
|
|
| 2168 | - remove_action('init', 'avia_modify_front', 10);
|
|
| 2169 | - } |
|
| 2166 | + if (geodir_is_page('login')){
|
|
| 2167 | + remove_all_actions('template_redirect');
|
|
| 2168 | + remove_action('init', 'avia_modify_front', 10);
|
|
| 2169 | + } |
|
| 2170 | 2170 | } |
| 2171 | 2171 | |
| 2172 | 2172 | |
@@ -2188,51 +2188,51 @@ discard block |
||
| 2188 | 2188 | function geodirectory_before_featured_image_delete($attachment_id) |
| 2189 | 2189 | {
|
| 2190 | 2190 | |
| 2191 | - global $wpdb, $plugin_prefix; |
|
| 2191 | + global $wpdb, $plugin_prefix; |
|
| 2192 | 2192 | |
| 2193 | - $post_id = get_post_field('post_parent', $attachment_id);
|
|
| 2193 | + $post_id = get_post_field('post_parent', $attachment_id);
|
|
| 2194 | 2194 | |
| 2195 | - $attachment_url = wp_get_attachment_url($attachment_id); |
|
| 2195 | + $attachment_url = wp_get_attachment_url($attachment_id); |
|
| 2196 | 2196 | |
| 2197 | - if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
|
|
| 2197 | + if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
|
|
| 2198 | 2198 | |
| 2199 | - $post_type = get_post_type($post_id); |
|
| 2199 | + $post_type = get_post_type($post_id); |
|
| 2200 | 2200 | |
| 2201 | - $all_postypes = geodir_get_posttypes(); |
|
| 2201 | + $all_postypes = geodir_get_posttypes(); |
|
| 2202 | 2202 | |
| 2203 | - if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
| 2204 | - return false; |
|
| 2203 | + if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
| 2204 | + return false; |
|
| 2205 | 2205 | |
| 2206 | - $uploads = wp_upload_dir(); |
|
| 2206 | + $uploads = wp_upload_dir(); |
|
| 2207 | 2207 | |
| 2208 | - $split_img_path = explode($uploads['baseurl'], $attachment_url); |
|
| 2208 | + $split_img_path = explode($uploads['baseurl'], $attachment_url); |
|
| 2209 | 2209 | |
| 2210 | - $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
| 2210 | + $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
| 2211 | 2211 | |
| 2212 | - $wpdb->query( |
|
| 2213 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
|
|
| 2214 | - array($post_id, $split_img_file_path) |
|
| 2215 | - ) |
|
| 2216 | - ); |
|
| 2212 | + $wpdb->query( |
|
| 2213 | + $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
|
|
| 2214 | + array($post_id, $split_img_file_path) |
|
| 2215 | + ) |
|
| 2216 | + ); |
|
| 2217 | 2217 | |
| 2218 | - $attachment_data = $wpdb->get_row( |
|
| 2219 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
|
|
| 2220 | - array($post_id) |
|
| 2221 | - ) |
|
| 2222 | - ); |
|
| 2218 | + $attachment_data = $wpdb->get_row( |
|
| 2219 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
|
|
| 2220 | + array($post_id) |
|
| 2221 | + ) |
|
| 2222 | + ); |
|
| 2223 | 2223 | |
| 2224 | - if (!empty($attachment_data)) {
|
|
| 2225 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
|
|
| 2226 | - } |
|
| 2224 | + if (!empty($attachment_data)) {
|
|
| 2225 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
|
|
| 2226 | + } |
|
| 2227 | 2227 | |
| 2228 | 2228 | |
| 2229 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
| 2229 | + $table_name = $plugin_prefix . $post_type . '_detail'; |
|
| 2230 | 2230 | |
| 2231 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
|
|
| 2231 | + $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
|
|
| 2232 | 2232 | |
| 2233 | - geodir_set_wp_featured_image($post_id); |
|
| 2233 | + geodir_set_wp_featured_image($post_id); |
|
| 2234 | 2234 | |
| 2235 | - } |
|
| 2235 | + } |
|
| 2236 | 2236 | |
| 2237 | 2237 | } |
| 2238 | 2238 | |
@@ -2250,79 +2250,79 @@ discard block |
||
| 2250 | 2250 | function geodir_temp_set_post_attachment() |
| 2251 | 2251 | {
|
| 2252 | 2252 | |
| 2253 | - global $wpdb, $plugin_prefix; |
|
| 2253 | + global $wpdb, $plugin_prefix; |
|
| 2254 | 2254 | |
| 2255 | - $all_postypes = geodir_get_posttypes(); |
|
| 2255 | + $all_postypes = geodir_get_posttypes(); |
|
| 2256 | 2256 | |
| 2257 | - foreach ($all_postypes as $posttype) {
|
|
| 2257 | + foreach ($all_postypes as $posttype) {
|
|
| 2258 | 2258 | |
| 2259 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
| 2259 | + $tablename = $plugin_prefix . $posttype . '_detail'; |
|
| 2260 | 2260 | |
| 2261 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
|
|
| 2261 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
|
|
| 2262 | 2262 | |
| 2263 | - if (!empty($get_post_data)) {
|
|
| 2263 | + if (!empty($get_post_data)) {
|
|
| 2264 | 2264 | |
| 2265 | - foreach ($get_post_data as $data) {
|
|
| 2265 | + foreach ($get_post_data as $data) {
|
|
| 2266 | 2266 | |
| 2267 | - $post_id = $data->post_id; |
|
| 2267 | + $post_id = $data->post_id; |
|
| 2268 | 2268 | |
| 2269 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
|
|
| 2269 | + $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
|
|
| 2270 | 2270 | |
| 2271 | - if (!empty($attachment_data)) {
|
|
| 2271 | + if (!empty($attachment_data)) {
|
|
| 2272 | 2272 | |
| 2273 | - foreach ($attachment_data as $attach) {
|
|
| 2273 | + foreach ($attachment_data as $attach) {
|
|
| 2274 | 2274 | |
| 2275 | - $file_info = pathinfo($attach->file); |
|
| 2275 | + $file_info = pathinfo($attach->file); |
|
| 2276 | 2276 | |
| 2277 | - $sub_dir = ''; |
|
| 2278 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 2279 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 2277 | + $sub_dir = ''; |
|
| 2278 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 2279 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 2280 | 2280 | |
| 2281 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
| 2282 | - $uploads_path = $uploads['basedir']; |
|
| 2281 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
| 2282 | + $uploads_path = $uploads['basedir']; |
|
| 2283 | 2283 | |
| 2284 | - $file_name = $file_info['basename']; |
|
| 2284 | + $file_name = $file_info['basename']; |
|
| 2285 | 2285 | |
| 2286 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
| 2286 | + $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
| 2287 | 2287 | |
| 2288 | - if (!file_exists($img_arr['path'])) {
|
|
| 2288 | + if (!file_exists($img_arr['path'])) {
|
|
| 2289 | 2289 | |
| 2290 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
|
|
| 2290 | + $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
|
|
| 2291 | 2291 | |
| 2292 | - } |
|
| 2292 | + } |
|
| 2293 | 2293 | |
| 2294 | - } |
|
| 2294 | + } |
|
| 2295 | 2295 | |
| 2296 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
|
|
| 2296 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
|
|
| 2297 | 2297 | |
| 2298 | - if (!empty($attachment_data)) {
|
|
| 2298 | + if (!empty($attachment_data)) {
|
|
| 2299 | 2299 | |
| 2300 | - if ($attachment_data->ID) |
|
| 2301 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
|
|
| 2300 | + if ($attachment_data->ID) |
|
| 2301 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
|
|
| 2302 | 2302 | |
| 2303 | - } else {
|
|
| 2303 | + } else {
|
|
| 2304 | 2304 | |
| 2305 | - if (has_post_thumbnail($post_id)) {
|
|
| 2305 | + if (has_post_thumbnail($post_id)) {
|
|
| 2306 | 2306 | |
| 2307 | - $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 2307 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 2308 | 2308 | |
| 2309 | - wp_delete_attachment($post_thumbnail_id); |
|
| 2309 | + wp_delete_attachment($post_thumbnail_id); |
|
| 2310 | 2310 | |
| 2311 | - } |
|
| 2311 | + } |
|
| 2312 | 2312 | |
| 2313 | - } |
|
| 2313 | + } |
|
| 2314 | 2314 | |
| 2315 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
|
|
| 2315 | + $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
|
|
| 2316 | 2316 | |
| 2317 | - geodir_set_wp_featured_image($post_id); |
|
| 2317 | + geodir_set_wp_featured_image($post_id); |
|
| 2318 | 2318 | |
| 2319 | - } |
|
| 2319 | + } |
|
| 2320 | 2320 | |
| 2321 | - } |
|
| 2321 | + } |
|
| 2322 | 2322 | |
| 2323 | - } |
|
| 2323 | + } |
|
| 2324 | 2324 | |
| 2325 | - } |
|
| 2325 | + } |
|
| 2326 | 2326 | |
| 2327 | 2327 | } |
| 2328 | 2328 | |
@@ -2340,9 +2340,9 @@ discard block |
||
| 2340 | 2340 | function geodir_default_rating_star_icon() |
| 2341 | 2341 | {
|
| 2342 | 2342 | |
| 2343 | - if (!get_option('geodir_default_rating_star_icon')) {
|
|
| 2344 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
|
|
| 2345 | - } |
|
| 2343 | + if (!get_option('geodir_default_rating_star_icon')) {
|
|
| 2344 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
|
|
| 2345 | + } |
|
| 2346 | 2346 | |
| 2347 | 2347 | } |
| 2348 | 2348 | |
@@ -2360,25 +2360,25 @@ discard block |
||
| 2360 | 2360 | */ |
| 2361 | 2361 | function geodir_user_post_listing_count($user_id = 0) |
| 2362 | 2362 | {
|
| 2363 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 2364 | - if(!$user_id){
|
|
| 2365 | - $user_id = $current_user->ID; |
|
| 2366 | - } |
|
| 2363 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 2364 | + if(!$user_id){
|
|
| 2365 | + $user_id = $current_user->ID; |
|
| 2366 | + } |
|
| 2367 | 2367 | |
| 2368 | - $all_posts = get_option('geodir_listing_link_user_dashboard');
|
|
| 2368 | + $all_posts = get_option('geodir_listing_link_user_dashboard');
|
|
| 2369 | 2369 | |
| 2370 | - $user_listing = array(); |
|
| 2371 | - if ($user_id && is_array($all_posts) && !empty($all_posts)) {
|
|
| 2372 | - foreach ($all_posts as $ptype) {
|
|
| 2373 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
|
|
| 2370 | + $user_listing = array(); |
|
| 2371 | + if ($user_id && is_array($all_posts) && !empty($all_posts)) {
|
|
| 2372 | + foreach ($all_posts as $ptype) {
|
|
| 2373 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
|
|
| 2374 | 2374 | |
| 2375 | - if ($total_posts > 0) {
|
|
| 2376 | - $user_listing[$ptype] = $total_posts; |
|
| 2377 | - } |
|
| 2378 | - } |
|
| 2379 | - } |
|
| 2375 | + if ($total_posts > 0) {
|
|
| 2376 | + $user_listing[$ptype] = $total_posts; |
|
| 2377 | + } |
|
| 2378 | + } |
|
| 2379 | + } |
|
| 2380 | 2380 | |
| 2381 | - return $user_listing; |
|
| 2381 | + return $user_listing; |
|
| 2382 | 2382 | } |
| 2383 | 2383 | |
| 2384 | 2384 | |
@@ -2398,189 +2398,189 @@ discard block |
||
| 2398 | 2398 | */ |
| 2399 | 2399 | function geodir_detail_page_custom_field_tab($tabs_arr) |
| 2400 | 2400 | {
|
| 2401 | - global $post; |
|
| 2402 | - |
|
| 2403 | - $post_type = geodir_get_current_posttype(); |
|
| 2404 | - $all_postypes = geodir_get_posttypes(); |
|
| 2405 | - |
|
| 2406 | - if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
|
|
| 2407 | - $package_info = array(); |
|
| 2408 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 2409 | - $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 2410 | - $fields_location = 'owntab'; |
|
| 2411 | - |
|
| 2412 | - $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
|
| 2413 | - //remove video and special offers if it is already set to show |
|
| 2414 | - if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
|
|
| 2415 | - $unset_video = true; |
|
| 2416 | - } |
|
| 2417 | - |
|
| 2418 | - if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
|
|
| 2419 | - $unset_special_offers = true; |
|
| 2420 | - } |
|
| 2421 | - if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
|
|
| 2422 | - foreach($custom_fields as $key => $custom_field){
|
|
| 2423 | - if($custom_field['name']=='geodir_video' && isset($unset_video)){
|
|
| 2424 | - unset($custom_fields[$key]); |
|
| 2425 | - } |
|
| 2426 | - if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
|
|
| 2427 | - unset($custom_fields[$key]); |
|
| 2428 | - } |
|
| 2429 | - } |
|
| 2430 | - } |
|
| 2431 | - |
|
| 2432 | - |
|
| 2433 | - if (!empty($custom_fields)) {
|
|
| 2434 | - $parse_custom_fields = array(); |
|
| 2435 | - foreach ($custom_fields as $field) {
|
|
| 2436 | - $field = stripslashes_deep($field); // strip slashes |
|
| 2437 | - $type = $field; |
|
| 2438 | - $field_name = $field['htmlvar_name']; |
|
| 2439 | - if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
|
|
| 2440 | - $post->{$field_name} = $_REQUEST[$field_name];
|
|
| 2441 | - } |
|
| 2401 | + global $post; |
|
| 2442 | 2402 | |
| 2443 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 2444 | - if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
|
|
| 2445 | - continue; |
|
| 2446 | - } |
|
| 2403 | + $post_type = geodir_get_current_posttype(); |
|
| 2404 | + $all_postypes = geodir_get_posttypes(); |
|
| 2447 | 2405 | |
| 2448 | - $parse_custom_fields[] = $field; |
|
| 2449 | - } |
|
| 2450 | - } |
|
| 2451 | - $custom_fields = $parse_custom_fields; |
|
| 2452 | - } |
|
| 2453 | - //print_r($custom_fields); |
|
| 2454 | - if (!empty($custom_fields)) {
|
|
| 2406 | + if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
|
|
| 2407 | + $package_info = array(); |
|
| 2408 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 2409 | + $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 2410 | + $fields_location = 'owntab'; |
|
| 2455 | 2411 | |
| 2456 | - global $field_set_start; |
|
| 2412 | + $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
|
| 2413 | + //remove video and special offers if it is already set to show |
|
| 2414 | + if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
|
|
| 2415 | + $unset_video = true; |
|
| 2416 | + } |
|
| 2457 | 2417 | |
| 2458 | - $post = stripslashes_deep($post); // strip slashes |
|
| 2459 | - |
|
| 2460 | - $field_set_start = 0; |
|
| 2461 | - $fieldset_count = 0; |
|
| 2462 | - $fieldset = ''; |
|
| 2463 | - $total_fields = count($custom_fields); |
|
| 2464 | - $count_field = 0; |
|
| 2465 | - $fieldset_arr = array(); |
|
| 2466 | - $i = 0; |
|
| 2467 | - $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL; |
|
| 2468 | - |
|
| 2469 | - foreach ($custom_fields as $field) {
|
|
| 2470 | - $count_field++; |
|
| 2471 | - $field_name = $field['htmlvar_name']; |
|
| 2472 | - if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
|
|
| 2473 | - $post->{$field_name} = $_REQUEST[$field_name];
|
|
| 2474 | - } |
|
| 2418 | + if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
|
|
| 2419 | + $unset_special_offers = true; |
|
| 2420 | + } |
|
| 2421 | + if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
|
|
| 2422 | + foreach($custom_fields as $key => $custom_field){
|
|
| 2423 | + if($custom_field['name']=='geodir_video' && isset($unset_video)){
|
|
| 2424 | + unset($custom_fields[$key]); |
|
| 2425 | + } |
|
| 2426 | + if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
|
|
| 2427 | + unset($custom_fields[$key]); |
|
| 2428 | + } |
|
| 2429 | + } |
|
| 2430 | + } |
|
| 2475 | 2431 | |
| 2476 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 2477 | - $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
|
| 2478 | - $site_title = trim($field['site_title']); |
|
| 2479 | - $type = $field; |
|
| 2480 | - $variables_array = array(); |
|
| 2481 | 2432 | |
| 2482 | - if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
|
|
| 2483 | - continue; |
|
| 2484 | - } |
|
| 2433 | + if (!empty($custom_fields)) {
|
|
| 2434 | + $parse_custom_fields = array(); |
|
| 2435 | + foreach ($custom_fields as $field) {
|
|
| 2436 | + $field = stripslashes_deep($field); // strip slashes |
|
| 2437 | + $type = $field; |
|
| 2438 | + $field_name = $field['htmlvar_name']; |
|
| 2439 | + if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
|
|
| 2440 | + $post->{$field_name} = $_REQUEST[$field_name];
|
|
| 2441 | + } |
|
| 2485 | 2442 | |
| 2486 | - if ($type['type'] != 'fieldset') {
|
|
| 2487 | - $i++; |
|
| 2488 | - $variables_array['post_id'] = $post->ID; |
|
| 2489 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 2490 | - $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
|
|
| 2491 | - |
|
| 2492 | - }else{
|
|
| 2493 | - $i = 0; |
|
| 2494 | - $fieldset_count++; |
|
| 2495 | - $field_set_start = 1; |
|
| 2496 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
| 2497 | - $fieldset_arr[$fieldset_count]['label'] = $label; |
|
| 2498 | - } |
|
| 2443 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 2444 | + if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
|
|
| 2445 | + continue; |
|
| 2446 | + } |
|
| 2499 | 2447 | |
| 2448 | + $parse_custom_fields[] = $field; |
|
| 2449 | + } |
|
| 2450 | + } |
|
| 2451 | + $custom_fields = $parse_custom_fields; |
|
| 2452 | + } |
|
| 2453 | + //print_r($custom_fields); |
|
| 2454 | + if (!empty($custom_fields)) {
|
|
| 2500 | 2455 | |
| 2501 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 2502 | - $type = stripslashes_deep($type); // strip slashes |
|
| 2503 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 2504 | - $html = ''; |
|
| 2505 | - $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
| 2506 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 2507 | - $field_icon = geodir_field_icon_proccess($type); |
|
| 2508 | - $filed_type = $type['type']; |
|
| 2509 | - |
|
| 2510 | - /** |
|
| 2511 | - * Filter the output for custom fields. |
|
| 2512 | - * |
|
| 2513 | - * Here we can remove or add new functions depending on the field type. |
|
| 2514 | - * |
|
| 2515 | - * @param string $html The html to be filtered (blank). |
|
| 2516 | - * @param string $fields_location The location the field is to be show. |
|
| 2517 | - * @param array $type The array of field values. |
|
| 2518 | - */ |
|
| 2519 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 2520 | - |
|
| 2521 | - |
|
| 2522 | - /** |
|
| 2523 | - * Filter custom field output in tab. |
|
| 2524 | - * |
|
| 2525 | - * @since 1.5.6 |
|
| 2526 | - * |
|
| 2527 | - * @param string $html_var The HTML variable name for the field. |
|
| 2528 | - * @param string $html Custom field unfiltered HTML. |
|
| 2529 | - * @param array $variables_array Custom field variables array. |
|
| 2530 | - */ |
|
| 2531 | - $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
|
|
| 2532 | - |
|
| 2533 | - $fieldset_html = ''; |
|
| 2534 | - if ($field_set_start == 1) {
|
|
| 2535 | - $add_html = false; |
|
| 2536 | - if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
|
|
| 2537 | - if ($fieldset != '') {
|
|
| 2538 | - $add_html = true; |
|
| 2539 | - $label = $fieldset_arr[$fieldset_count - 1]['label']; |
|
| 2540 | - $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name']; |
|
| 2541 | - } |
|
| 2542 | - $fieldset_html = $fieldset; |
|
| 2543 | - $fieldset = ''; |
|
| 2544 | - } else {
|
|
| 2545 | - $fieldset .= $html; |
|
| 2546 | - if ($total_fields == $count_field && $fieldset != '') {
|
|
| 2547 | - $add_html = true; |
|
| 2548 | - $label = $fieldset_arr[$fieldset_count]['label']; |
|
| 2549 | - $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name']; |
|
| 2550 | - $fieldset_html = $fieldset; |
|
| 2551 | - } |
|
| 2552 | - } |
|
| 2456 | + global $field_set_start; |
|
| 2553 | 2457 | |
| 2554 | - if ($add_html) {
|
|
| 2555 | - $tabs_arr[$htmlvar_name] = array( |
|
| 2556 | - 'heading_text' => __($label, 'geodirectory'), |
|
| 2557 | - 'is_active_tab' => false, |
|
| 2558 | - /** |
|
| 2559 | - * Filter if a custom field should be displayed on the details page tab. |
|
| 2560 | - * |
|
| 2561 | - * @since 1.0.0 |
|
| 2562 | - * @param string $htmlvar_name The field HTML var name. |
|
| 2563 | - */ |
|
| 2564 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
|
|
| 2565 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
| 2566 | - ); |
|
| 2567 | - } |
|
| 2568 | - } else {
|
|
| 2569 | - if ($html != '') {
|
|
| 2570 | - $tabs_arr[$html_var] = array( |
|
| 2571 | - 'heading_text' => __($label, 'geodirectory'), |
|
| 2572 | - 'is_active_tab' => false, |
|
| 2573 | - /** This action is documented in geodirectory_hooks_actions.php */ |
|
| 2574 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
|
|
| 2575 | - 'tab_content' => $html |
|
| 2576 | - ); |
|
| 2577 | - } |
|
| 2578 | - } |
|
| 2579 | - } |
|
| 2580 | - } |
|
| 2581 | - } |
|
| 2582 | - } |
|
| 2583 | - return $tabs_arr; |
|
| 2458 | + $post = stripslashes_deep($post); // strip slashes |
|
| 2459 | + |
|
| 2460 | + $field_set_start = 0; |
|
| 2461 | + $fieldset_count = 0; |
|
| 2462 | + $fieldset = ''; |
|
| 2463 | + $total_fields = count($custom_fields); |
|
| 2464 | + $count_field = 0; |
|
| 2465 | + $fieldset_arr = array(); |
|
| 2466 | + $i = 0; |
|
| 2467 | + $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL; |
|
| 2468 | + |
|
| 2469 | + foreach ($custom_fields as $field) {
|
|
| 2470 | + $count_field++; |
|
| 2471 | + $field_name = $field['htmlvar_name']; |
|
| 2472 | + if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
|
|
| 2473 | + $post->{$field_name} = $_REQUEST[$field_name];
|
|
| 2474 | + } |
|
| 2475 | + |
|
| 2476 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 2477 | + $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
|
| 2478 | + $site_title = trim($field['site_title']); |
|
| 2479 | + $type = $field; |
|
| 2480 | + $variables_array = array(); |
|
| 2481 | + |
|
| 2482 | + if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
|
|
| 2483 | + continue; |
|
| 2484 | + } |
|
| 2485 | + |
|
| 2486 | + if ($type['type'] != 'fieldset') {
|
|
| 2487 | + $i++; |
|
| 2488 | + $variables_array['post_id'] = $post->ID; |
|
| 2489 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 2490 | + $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
|
|
| 2491 | + |
|
| 2492 | + }else{
|
|
| 2493 | + $i = 0; |
|
| 2494 | + $fieldset_count++; |
|
| 2495 | + $field_set_start = 1; |
|
| 2496 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
| 2497 | + $fieldset_arr[$fieldset_count]['label'] = $label; |
|
| 2498 | + } |
|
| 2499 | + |
|
| 2500 | + |
|
| 2501 | + if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 2502 | + $type = stripslashes_deep($type); // strip slashes |
|
| 2503 | + if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 2504 | + $html = ''; |
|
| 2505 | + $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
| 2506 | + if($html_var=='post'){$html_var='post_address';}
|
|
| 2507 | + $field_icon = geodir_field_icon_proccess($type); |
|
| 2508 | + $filed_type = $type['type']; |
|
| 2509 | + |
|
| 2510 | + /** |
|
| 2511 | + * Filter the output for custom fields. |
|
| 2512 | + * |
|
| 2513 | + * Here we can remove or add new functions depending on the field type. |
|
| 2514 | + * |
|
| 2515 | + * @param string $html The html to be filtered (blank). |
|
| 2516 | + * @param string $fields_location The location the field is to be show. |
|
| 2517 | + * @param array $type The array of field values. |
|
| 2518 | + */ |
|
| 2519 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 2520 | + |
|
| 2521 | + |
|
| 2522 | + /** |
|
| 2523 | + * Filter custom field output in tab. |
|
| 2524 | + * |
|
| 2525 | + * @since 1.5.6 |
|
| 2526 | + * |
|
| 2527 | + * @param string $html_var The HTML variable name for the field. |
|
| 2528 | + * @param string $html Custom field unfiltered HTML. |
|
| 2529 | + * @param array $variables_array Custom field variables array. |
|
| 2530 | + */ |
|
| 2531 | + $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
|
|
| 2532 | + |
|
| 2533 | + $fieldset_html = ''; |
|
| 2534 | + if ($field_set_start == 1) {
|
|
| 2535 | + $add_html = false; |
|
| 2536 | + if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
|
|
| 2537 | + if ($fieldset != '') {
|
|
| 2538 | + $add_html = true; |
|
| 2539 | + $label = $fieldset_arr[$fieldset_count - 1]['label']; |
|
| 2540 | + $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name']; |
|
| 2541 | + } |
|
| 2542 | + $fieldset_html = $fieldset; |
|
| 2543 | + $fieldset = ''; |
|
| 2544 | + } else {
|
|
| 2545 | + $fieldset .= $html; |
|
| 2546 | + if ($total_fields == $count_field && $fieldset != '') {
|
|
| 2547 | + $add_html = true; |
|
| 2548 | + $label = $fieldset_arr[$fieldset_count]['label']; |
|
| 2549 | + $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name']; |
|
| 2550 | + $fieldset_html = $fieldset; |
|
| 2551 | + } |
|
| 2552 | + } |
|
| 2553 | + |
|
| 2554 | + if ($add_html) {
|
|
| 2555 | + $tabs_arr[$htmlvar_name] = array( |
|
| 2556 | + 'heading_text' => __($label, 'geodirectory'), |
|
| 2557 | + 'is_active_tab' => false, |
|
| 2558 | + /** |
|
| 2559 | + * Filter if a custom field should be displayed on the details page tab. |
|
| 2560 | + * |
|
| 2561 | + * @since 1.0.0 |
|
| 2562 | + * @param string $htmlvar_name The field HTML var name. |
|
| 2563 | + */ |
|
| 2564 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
|
|
| 2565 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
| 2566 | + ); |
|
| 2567 | + } |
|
| 2568 | + } else {
|
|
| 2569 | + if ($html != '') {
|
|
| 2570 | + $tabs_arr[$html_var] = array( |
|
| 2571 | + 'heading_text' => __($label, 'geodirectory'), |
|
| 2572 | + 'is_active_tab' => false, |
|
| 2573 | + /** This action is documented in geodirectory_hooks_actions.php */ |
|
| 2574 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
|
|
| 2575 | + 'tab_content' => $html |
|
| 2576 | + ); |
|
| 2577 | + } |
|
| 2578 | + } |
|
| 2579 | + } |
|
| 2580 | + } |
|
| 2581 | + } |
|
| 2582 | + } |
|
| 2583 | + return $tabs_arr; |
|
| 2584 | 2584 | } |
| 2585 | 2585 | |
| 2586 | 2586 | /* display add listing page for wpml */ |
@@ -2604,41 +2604,41 @@ discard block |
||
| 2604 | 2604 | */ |
| 2605 | 2605 | function geodir_add_post_status_author_page() |
| 2606 | 2606 | {
|
| 2607 | - global $wpdb, $post; |
|
| 2608 | - |
|
| 2609 | - $html = ''; |
|
| 2610 | - if (get_current_user_id()) {
|
|
| 2611 | - |
|
| 2612 | - $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
|
|
| 2613 | - if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
|
|
| 2614 | - |
|
| 2615 | - // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them. |
|
| 2616 | - $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
|
|
| 2617 | - $status = "<strong>(";
|
|
| 2618 | - $status_icon = '<i class="fa fa-play"></i>'; |
|
| 2619 | - if ($real_status == 'publish') {
|
|
| 2620 | - $status .= __('Published', 'geodirectory');
|
|
| 2621 | - }elseif ($real_status == 'pending') {
|
|
| 2622 | - $status .= __('Awaiting Review', 'geodirectory');
|
|
| 2623 | - } else {
|
|
| 2624 | - $status .= __('Not published', 'geodirectory');
|
|
| 2625 | - $status_icon = '<i class="fa fa-pause"></i>'; |
|
| 2626 | - } |
|
| 2627 | - $status .= ")</strong>"; |
|
| 2607 | + global $wpdb, $post; |
|
| 2608 | + |
|
| 2609 | + $html = ''; |
|
| 2610 | + if (get_current_user_id()) {
|
|
| 2611 | + |
|
| 2612 | + $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
|
|
| 2613 | + if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
|
|
| 2614 | + |
|
| 2615 | + // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them. |
|
| 2616 | + $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
|
|
| 2617 | + $status = "<strong>(";
|
|
| 2618 | + $status_icon = '<i class="fa fa-play"></i>'; |
|
| 2619 | + if ($real_status == 'publish') {
|
|
| 2620 | + $status .= __('Published', 'geodirectory');
|
|
| 2621 | + }elseif ($real_status == 'pending') {
|
|
| 2622 | + $status .= __('Awaiting Review', 'geodirectory');
|
|
| 2623 | + } else {
|
|
| 2624 | + $status .= __('Not published', 'geodirectory');
|
|
| 2625 | + $status_icon = '<i class="fa fa-pause"></i>'; |
|
| 2626 | + } |
|
| 2627 | + $status .= ")</strong>"; |
|
| 2628 | 2628 | |
| 2629 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
|
|
| 2630 | - } |
|
| 2631 | - } |
|
| 2629 | + $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
|
|
| 2630 | + } |
|
| 2631 | + } |
|
| 2632 | 2632 | |
| 2633 | - if ($html != '') {
|
|
| 2634 | - /** |
|
| 2635 | - * Filter the post status text on the author page. |
|
| 2636 | - * |
|
| 2637 | - * @since 1.0.0 |
|
| 2638 | - * @param string $html The HTML of the status. |
|
| 2639 | - */ |
|
| 2640 | - echo apply_filters('geodir_filter_status_text_on_author_page', $html);
|
|
| 2641 | - } |
|
| 2633 | + if ($html != '') {
|
|
| 2634 | + /** |
|
| 2635 | + * Filter the post status text on the author page. |
|
| 2636 | + * |
|
| 2637 | + * @since 1.0.0 |
|
| 2638 | + * @param string $html The HTML of the status. |
|
| 2639 | + */ |
|
| 2640 | + echo apply_filters('geodir_filter_status_text_on_author_page', $html);
|
|
| 2641 | + } |
|
| 2642 | 2642 | |
| 2643 | 2643 | |
| 2644 | 2644 | } |
@@ -2652,9 +2652,9 @@ discard block |
||
| 2652 | 2652 | * @package GeoDirectory |
| 2653 | 2653 | */ |
| 2654 | 2654 | function geodir_init_no_rating() {
|
| 2655 | - if (geodir_rating_disabled_post_types()) {
|
|
| 2656 | - add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
|
|
| 2657 | - } |
|
| 2655 | + if (geodir_rating_disabled_post_types()) {
|
|
| 2656 | + add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
|
|
| 2657 | + } |
|
| 2658 | 2658 | } |
| 2659 | 2659 | |
| 2660 | 2660 | /** |
@@ -2668,22 +2668,22 @@ discard block |
||
| 2668 | 2668 | * @return array Modified sort options array. |
| 2669 | 2669 | */ |
| 2670 | 2670 | function geodir_no_rating_get_sort_options($options, $post_type = '') {
|
| 2671 | - if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
|
|
| 2672 | - $new_options = array(); |
|
| 2671 | + if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
|
|
| 2672 | + $new_options = array(); |
|
| 2673 | 2673 | |
| 2674 | - if (!empty($options)) {
|
|
| 2675 | - foreach ($options as $option) {
|
|
| 2676 | - if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
|
|
| 2677 | - continue; |
|
| 2678 | - } |
|
| 2679 | - $new_options[] = $option; |
|
| 2680 | - } |
|
| 2674 | + if (!empty($options)) {
|
|
| 2675 | + foreach ($options as $option) {
|
|
| 2676 | + if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
|
|
| 2677 | + continue; |
|
| 2678 | + } |
|
| 2679 | + $new_options[] = $option; |
|
| 2680 | + } |
|
| 2681 | 2681 | |
| 2682 | - $options = $new_options; |
|
| 2683 | - } |
|
| 2684 | - } |
|
| 2682 | + $options = $new_options; |
|
| 2683 | + } |
|
| 2684 | + } |
|
| 2685 | 2685 | |
| 2686 | - return $options; |
|
| 2686 | + return $options; |
|
| 2687 | 2687 | } |
| 2688 | 2688 | |
| 2689 | 2689 | /** |
@@ -2695,9 +2695,9 @@ discard block |
||
| 2695 | 2695 | * @return array Modified class array. |
| 2696 | 2696 | */ |
| 2697 | 2697 | function geodir_body_class_active_map($classes = array()) {
|
| 2698 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
| 2698 | + $classes[] = 'gd-map-' . geodir_map_name(); |
|
| 2699 | 2699 | |
| 2700 | - return $classes; |
|
| 2700 | + return $classes; |
|
| 2701 | 2701 | } |
| 2702 | 2702 | add_filter('body_class', 'geodir_body_class_active_map', 100);
|
| 2703 | 2703 | |
@@ -2710,9 +2710,9 @@ discard block |
||
| 2710 | 2710 | * @return string Modified class string. |
| 2711 | 2711 | */ |
| 2712 | 2712 | function geodir_admin_body_class_active_map($class = '') {
|
| 2713 | - $class .= ' gd-map-' . geodir_map_name(); |
|
| 2713 | + $class .= ' gd-map-' . geodir_map_name(); |
|
| 2714 | 2714 | |
| 2715 | - return $class; |
|
| 2715 | + return $class; |
|
| 2716 | 2716 | } |
| 2717 | 2717 | add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
|
| 2718 | 2718 | |
@@ -2730,36 +2730,36 @@ discard block |
||
| 2730 | 2730 | * @return array Translation texts. |
| 2731 | 2731 | */ |
| 2732 | 2732 | function geodir_load_gd_options_text_translation($translation_texts = array()) {
|
| 2733 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
| 2734 | - |
|
| 2735 | - $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
|
|
| 2736 | - |
|
| 2737 | - /** |
|
| 2738 | - * Filters the geodirectory option names that requires to add for translation. |
|
| 2739 | - * |
|
| 2740 | - * @since 1.5.7 |
|
| 2741 | - * @package GeoDirectory |
|
| 2742 | - * |
|
| 2743 | - * @param array $gd_options Array of option names. |
|
| 2744 | - */ |
|
| 2745 | - $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
|
|
| 2746 | - $gd_options = array_unique($gd_options); |
|
| 2747 | - |
|
| 2748 | - if (!empty($gd_options)) {
|
|
| 2749 | - foreach ($gd_options as $gd_option) {
|
|
| 2750 | - if ($gd_option != '' && $option_value = get_option($gd_option)) {
|
|
| 2751 | - $option_value = is_string($option_value) ? stripslashes_deep($option_value) : ''; |
|
| 2733 | + $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
| 2734 | + |
|
| 2735 | + $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
|
|
| 2736 | + |
|
| 2737 | + /** |
|
| 2738 | + * Filters the geodirectory option names that requires to add for translation. |
|
| 2739 | + * |
|
| 2740 | + * @since 1.5.7 |
|
| 2741 | + * @package GeoDirectory |
|
| 2742 | + * |
|
| 2743 | + * @param array $gd_options Array of option names. |
|
| 2744 | + */ |
|
| 2745 | + $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
|
|
| 2746 | + $gd_options = array_unique($gd_options); |
|
| 2747 | + |
|
| 2748 | + if (!empty($gd_options)) {
|
|
| 2749 | + foreach ($gd_options as $gd_option) {
|
|
| 2750 | + if ($gd_option != '' && $option_value = get_option($gd_option)) {
|
|
| 2751 | + $option_value = is_string($option_value) ? stripslashes_deep($option_value) : ''; |
|
| 2752 | 2752 | |
| 2753 | - if ($option_value != '' && !in_array($option_value, $translation_texts)) {
|
|
| 2754 | - $translation_texts[] = stripslashes_deep($option_value); |
|
| 2755 | - } |
|
| 2756 | - } |
|
| 2757 | - } |
|
| 2758 | - } |
|
| 2753 | + if ($option_value != '' && !in_array($option_value, $translation_texts)) {
|
|
| 2754 | + $translation_texts[] = stripslashes_deep($option_value); |
|
| 2755 | + } |
|
| 2756 | + } |
|
| 2757 | + } |
|
| 2758 | + } |
|
| 2759 | 2759 | |
| 2760 | - $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
| 2760 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
| 2761 | 2761 | |
| 2762 | - return $translation_texts; |
|
| 2762 | + return $translation_texts; |
|
| 2763 | 2763 | } |
| 2764 | 2764 | |
| 2765 | 2765 | add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
|
@@ -2773,15 +2773,15 @@ discard block |
||
| 2773 | 2773 | |
| 2774 | 2774 | add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
|
| 2775 | 2775 | function gd_get_comments_link($comments_link, $post_id) {
|
| 2776 | - $post_type = get_post_type($post_id); |
|
| 2776 | + $post_type = get_post_type($post_id); |
|
| 2777 | 2777 | |
| 2778 | - $all_postypes = geodir_get_posttypes(); |
|
| 2779 | - if (in_array($post_type, $all_postypes)) {
|
|
| 2780 | - $comments_link = str_replace('#comments', '#reviews', $comments_link);
|
|
| 2781 | - $comments_link = str_replace('#respond', '#reviews', $comments_link);
|
|
| 2782 | - } |
|
| 2778 | + $all_postypes = geodir_get_posttypes(); |
|
| 2779 | + if (in_array($post_type, $all_postypes)) {
|
|
| 2780 | + $comments_link = str_replace('#comments', '#reviews', $comments_link);
|
|
| 2781 | + $comments_link = str_replace('#respond', '#reviews', $comments_link);
|
|
| 2782 | + } |
|
| 2783 | 2783 | |
| 2784 | - return $comments_link; |
|
| 2784 | + return $comments_link; |
|
| 2785 | 2785 | } |
| 2786 | 2786 | |
| 2787 | 2787 | |
@@ -2799,11 +2799,11 @@ discard block |
||
| 2799 | 2799 | function geodir_add_nav_menu_class( $args ) |
| 2800 | 2800 | {
|
| 2801 | 2801 | |
| 2802 | - if(isset($args['menu_class'])){
|
|
| 2803 | - $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
|
| 2804 | - } |
|
| 2802 | + if(isset($args['menu_class'])){
|
|
| 2803 | + $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
|
| 2804 | + } |
|
| 2805 | 2805 | |
| 2806 | - return $args; |
|
| 2806 | + return $args; |
|
| 2807 | 2807 | } |
| 2808 | 2808 | |
| 2809 | 2809 | add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
@@ -2820,15 +2820,15 @@ discard block |
||
| 2820 | 2820 | * @return string Filtered locale ID. |
| 2821 | 2821 | */ |
| 2822 | 2822 | function geodir_wpml_filter_locale($locale) {
|
| 2823 | - global $sitepress; |
|
| 2823 | + global $sitepress; |
|
| 2824 | 2824 | |
| 2825 | - $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : ''); |
|
| 2825 | + $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : ''); |
|
| 2826 | 2826 | |
| 2827 | - if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
|
|
| 2828 | - $locale = $sitepress->get_locale($current_lang); |
|
| 2829 | - } |
|
| 2827 | + if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
|
|
| 2828 | + $locale = $sitepress->get_locale($current_lang); |
|
| 2829 | + } |
|
| 2830 | 2830 | |
| 2831 | - return $locale; |
|
| 2831 | + return $locale; |
|
| 2832 | 2832 | } |
| 2833 | 2833 | |
| 2834 | 2834 | /** |
@@ -2838,19 +2838,19 @@ discard block |
||
| 2838 | 2838 | * @package GeoDirectory |
| 2839 | 2839 | */ |
| 2840 | 2840 | function geodir_wpml_set_filter() {
|
| 2841 | - if (geodir_is_wpml()) {
|
|
| 2842 | - global $sitepress; |
|
| 2841 | + if (geodir_is_wpml()) {
|
|
| 2842 | + global $sitepress; |
|
| 2843 | 2843 | |
| 2844 | - if ($sitepress->get_setting('sync_comments_on_duplicates')) {
|
|
| 2845 | - add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
|
|
| 2846 | - } |
|
| 2844 | + if ($sitepress->get_setting('sync_comments_on_duplicates')) {
|
|
| 2845 | + add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
|
|
| 2846 | + } |
|
| 2847 | 2847 | |
| 2848 | - add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
|
|
| 2849 | - add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 ); |
|
| 2850 | - if (is_admin()) {
|
|
| 2851 | - add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 ); |
|
| 2852 | - } |
|
| 2853 | - } |
|
| 2848 | + add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
|
|
| 2849 | + add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 ); |
|
| 2850 | + if (is_admin()) {
|
|
| 2851 | + add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 ); |
|
| 2852 | + } |
|
| 2853 | + } |
|
| 2854 | 2854 | } |
| 2855 | 2855 | add_filter('plugins_loaded', 'geodir_wpml_set_filter');
|
| 2856 | 2856 | |
@@ -2863,38 +2863,38 @@ discard block |
||
| 2863 | 2863 | * @return array Filtered languages. |
| 2864 | 2864 | */ |
| 2865 | 2865 | function geodir_wpml_filter_ls_languages($languages) {
|
| 2866 | - if (geodir_is_geodir_page()) {
|
|
| 2867 | - $keep_vars = array(); |
|
| 2866 | + if (geodir_is_geodir_page()) {
|
|
| 2867 | + $keep_vars = array(); |
|
| 2868 | 2868 | |
| 2869 | - if (geodir_is_page('add-listing')) {
|
|
| 2870 | - $keep_vars = array('listing_type', 'package_id');
|
|
| 2871 | - } else if (geodir_is_page('search')) {
|
|
| 2872 | - $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
|
|
| 2873 | - } else if (geodir_is_page('author')) {
|
|
| 2874 | - $keep_vars = array('geodir_dashbord', 'stype', 'list');
|
|
| 2875 | - } else if (geodir_is_page('login')) {
|
|
| 2876 | - $keep_vars = array('forgot', 'signup');
|
|
| 2877 | - } |
|
| 2869 | + if (geodir_is_page('add-listing')) {
|
|
| 2870 | + $keep_vars = array('listing_type', 'package_id');
|
|
| 2871 | + } else if (geodir_is_page('search')) {
|
|
| 2872 | + $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
|
|
| 2873 | + } else if (geodir_is_page('author')) {
|
|
| 2874 | + $keep_vars = array('geodir_dashbord', 'stype', 'list');
|
|
| 2875 | + } else if (geodir_is_page('login')) {
|
|
| 2876 | + $keep_vars = array('forgot', 'signup');
|
|
| 2877 | + } |
|
| 2878 | 2878 | |
| 2879 | - if (!empty($keep_vars)) {
|
|
| 2880 | - foreach ( $languages as $code => $url) {
|
|
| 2881 | - $filter_url = $url['url']; |
|
| 2879 | + if (!empty($keep_vars)) {
|
|
| 2880 | + foreach ( $languages as $code => $url) {
|
|
| 2881 | + $filter_url = $url['url']; |
|
| 2882 | 2882 | |
| 2883 | - foreach ($keep_vars as $var) {
|
|
| 2884 | - if (isset($_GET[$var]) && !is_array($_GET[$var])) {
|
|
| 2885 | - $filter_url = remove_query_arg(array($var), $filter_url); |
|
| 2886 | - $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url); |
|
| 2887 | - } |
|
| 2888 | - } |
|
| 2883 | + foreach ($keep_vars as $var) {
|
|
| 2884 | + if (isset($_GET[$var]) && !is_array($_GET[$var])) {
|
|
| 2885 | + $filter_url = remove_query_arg(array($var), $filter_url); |
|
| 2886 | + $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url); |
|
| 2887 | + } |
|
| 2888 | + } |
|
| 2889 | 2889 | |
| 2890 | - if ($filter_url != $url['url']) {
|
|
| 2891 | - $languages[$code]['url'] = $filter_url; |
|
| 2892 | - } |
|
| 2893 | - } |
|
| 2894 | - } |
|
| 2895 | - } |
|
| 2890 | + if ($filter_url != $url['url']) {
|
|
| 2891 | + $languages[$code]['url'] = $filter_url; |
|
| 2892 | + } |
|
| 2893 | + } |
|
| 2894 | + } |
|
| 2895 | + } |
|
| 2896 | 2896 | |
| 2897 | - return $languages; |
|
| 2897 | + return $languages; |
|
| 2898 | 2898 | } |
| 2899 | 2899 | add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 ); |
| 2900 | 2900 | |
@@ -2905,18 +2905,18 @@ discard block |
||
| 2905 | 2905 | * |
| 2906 | 2906 | */ |
| 2907 | 2907 | function geodir_remove_yoast_seo_metas(){
|
| 2908 | - if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
|
|
| 2909 | - $wpseo = WPSEO_Frontend::get_instance(); |
|
| 2908 | + if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
|
|
| 2909 | + $wpseo = WPSEO_Frontend::get_instance(); |
|
| 2910 | 2910 | |
| 2911 | - remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 ); |
|
| 2912 | - remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 ); |
|
| 2913 | - remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 ); |
|
| 2914 | - remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 ); |
|
| 2915 | - remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 ); |
|
| 2916 | - remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 ); |
|
| 2911 | + remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 ); |
|
| 2912 | + remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 ); |
|
| 2913 | + remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 ); |
|
| 2914 | + remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 ); |
|
| 2915 | + remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 ); |
|
| 2916 | + remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 ); |
|
| 2917 | 2917 | |
| 2918 | - remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); |
|
| 2919 | - } |
|
| 2918 | + remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); |
|
| 2919 | + } |
|
| 2920 | 2920 | } |
| 2921 | 2921 | |
| 2922 | 2922 | /** |
@@ -2930,20 +2930,20 @@ discard block |
||
| 2930 | 2930 | * |
| 2931 | 2931 | */ |
| 2932 | 2932 | function geodir_wpml_ajax_set_guest_lang() {
|
| 2933 | - if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
|
|
| 2934 | - if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
|
|
| 2935 | - global $sitepress; |
|
| 2933 | + if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
|
|
| 2934 | + if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
|
|
| 2935 | + global $sitepress; |
|
| 2936 | 2936 | |
| 2937 | - $referer = wp_get_referer(); |
|
| 2937 | + $referer = wp_get_referer(); |
|
| 2938 | 2938 | |
| 2939 | - $current_lang = $sitepress->get_current_language(); |
|
| 2940 | - $referrer_lang = $sitepress->get_language_from_url( $referer ); |
|
| 2939 | + $current_lang = $sitepress->get_current_language(); |
|
| 2940 | + $referrer_lang = $sitepress->get_language_from_url( $referer ); |
|
| 2941 | 2941 | |
| 2942 | - if ( $referrer_lang && $current_lang != $referrer_lang ) {
|
|
| 2943 | - $_GET['lang'] = $referrer_lang; |
|
| 2944 | - } |
|
| 2945 | - } |
|
| 2946 | - } |
|
| 2942 | + if ( $referrer_lang && $current_lang != $referrer_lang ) {
|
|
| 2943 | + $_GET['lang'] = $referrer_lang; |
|
| 2944 | + } |
|
| 2945 | + } |
|
| 2946 | + } |
|
| 2947 | 2947 | } |
| 2948 | 2948 | add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 ); |
| 2949 | 2949 | |
@@ -2955,36 +2955,36 @@ discard block |
||
| 2955 | 2955 | * @param object $wp The WordPress object. |
| 2956 | 2956 | */ |
| 2957 | 2957 | function geodir_check_redirect($wp) {
|
| 2958 | - if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
|
|
| 2959 | - $current_url = geodir_curPageURL(); |
|
| 2960 | - $search = 'czech-republic'; |
|
| 2961 | - $replace = 'czechia'; |
|
| 2958 | + if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
|
|
| 2959 | + $current_url = geodir_curPageURL(); |
|
| 2960 | + $search = 'czech-republic'; |
|
| 2961 | + $replace = 'czechia'; |
|
| 2962 | 2962 | |
| 2963 | - $has_slash = substr($current_url, -1); |
|
| 2964 | - if ($has_slash != "/") {
|
|
| 2965 | - $current_url .= '/'; |
|
| 2966 | - } |
|
| 2963 | + $has_slash = substr($current_url, -1); |
|
| 2964 | + if ($has_slash != "/") {
|
|
| 2965 | + $current_url .= '/'; |
|
| 2966 | + } |
|
| 2967 | 2967 | |
| 2968 | - $redirect = false; |
|
| 2969 | - if (strpos($current_url, '/' . $search . '/') !== false) {
|
|
| 2970 | - $redirect = true; |
|
| 2971 | - $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
|
|
| 2972 | - } |
|
| 2968 | + $redirect = false; |
|
| 2969 | + if (strpos($current_url, '/' . $search . '/') !== false) {
|
|
| 2970 | + $redirect = true; |
|
| 2971 | + $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
|
|
| 2972 | + } |
|
| 2973 | 2973 | |
| 2974 | - if ($has_slash != "/") {
|
|
| 2975 | - $current_url = trim($current_url, '/'); |
|
| 2976 | - } |
|
| 2974 | + if ($has_slash != "/") {
|
|
| 2975 | + $current_url = trim($current_url, '/'); |
|
| 2976 | + } |
|
| 2977 | 2977 | |
| 2978 | - if (strpos($current_url, 'gd_country=' . $search) !== false) {
|
|
| 2979 | - $redirect = true; |
|
| 2980 | - $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
|
|
| 2981 | - } |
|
| 2982 | - |
|
| 2983 | - if ($redirect) {
|
|
| 2984 | - wp_redirect($current_url); |
|
| 2985 | - exit; |
|
| 2986 | - } |
|
| 2987 | - } |
|
| 2978 | + if (strpos($current_url, 'gd_country=' . $search) !== false) {
|
|
| 2979 | + $redirect = true; |
|
| 2980 | + $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
|
|
| 2981 | + } |
|
| 2982 | + |
|
| 2983 | + if ($redirect) {
|
|
| 2984 | + wp_redirect($current_url); |
|
| 2985 | + exit; |
|
| 2986 | + } |
|
| 2987 | + } |
|
| 2988 | 2988 | } |
| 2989 | 2989 | add_action('parse_request', 'geodir_check_redirect', 101, 1);
|
| 2990 | 2990 | |
@@ -3004,50 +3004,50 @@ discard block |
||
| 3004 | 3004 | * @param string $original_slug The original post slug. |
| 3005 | 3005 | */ |
| 3006 | 3006 | function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
|
| 3007 | - global $wpdb, $sitepress; |
|
| 3007 | + global $wpdb, $sitepress; |
|
| 3008 | 3008 | |
| 3009 | - if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
|
|
| 3010 | - $wpml_post_join = ""; |
|
| 3011 | - $wpml_post_where = ""; |
|
| 3012 | - $wpml_term_join = ""; |
|
| 3013 | - $wpml_term_where = ""; |
|
| 3009 | + if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
|
|
| 3010 | + $wpml_post_join = ""; |
|
| 3011 | + $wpml_post_where = ""; |
|
| 3012 | + $wpml_term_join = ""; |
|
| 3013 | + $wpml_term_where = ""; |
|
| 3014 | 3014 | |
| 3015 | - if (geodir_wpml_is_post_type_translated($post_type)) {
|
|
| 3016 | - $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language(); |
|
| 3017 | - $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress); |
|
| 3018 | - if (!$post_language) {
|
|
| 3019 | - $post_language = $sitepress->get_current_language(); |
|
| 3020 | - } |
|
| 3015 | + if (geodir_wpml_is_post_type_translated($post_type)) {
|
|
| 3016 | + $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language(); |
|
| 3017 | + $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress); |
|
| 3018 | + if (!$post_language) {
|
|
| 3019 | + $post_language = $sitepress->get_current_language(); |
|
| 3020 | + } |
|
| 3021 | 3021 | |
| 3022 | - $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
|
|
| 3023 | - $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
| 3022 | + $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
|
|
| 3023 | + $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
| 3024 | 3024 | |
| 3025 | - $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
|
|
| 3026 | - $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
| 3027 | - } |
|
| 3025 | + $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)";
|
|
| 3026 | + $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
| 3027 | + } |
|
| 3028 | 3028 | |
| 3029 | - $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
|
|
| 3029 | + $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) );
|
|
| 3030 | 3030 | |
| 3031 | - if ( $term_slug_check ) {
|
|
| 3032 | - $suffix = 1; |
|
| 3031 | + if ( $term_slug_check ) {
|
|
| 3032 | + $suffix = 1; |
|
| 3033 | 3033 | |
| 3034 | - do {
|
|
| 3035 | - $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
|
| 3034 | + do {
|
|
| 3035 | + $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
|
| 3036 | 3036 | |
| 3037 | - $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
|
|
| 3037 | + $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) );
|
|
| 3038 | 3038 | |
| 3039 | - $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
|
|
| 3039 | + $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) );
|
|
| 3040 | 3040 | |
| 3041 | - $term_slug_check = $term_check || $post_check; |
|
| 3041 | + $term_slug_check = $term_check || $post_check; |
|
| 3042 | 3042 | |
| 3043 | - $suffix++; |
|
| 3044 | - } while ( $term_slug_check ); |
|
| 3043 | + $suffix++; |
|
| 3044 | + } while ( $term_slug_check ); |
|
| 3045 | 3045 | |
| 3046 | - $slug = $alt_slug; |
|
| 3047 | - } |
|
| 3048 | - } |
|
| 3046 | + $slug = $alt_slug; |
|
| 3047 | + } |
|
| 3048 | + } |
|
| 3049 | 3049 | |
| 3050 | - return $slug; |
|
| 3050 | + return $slug; |
|
| 3051 | 3051 | } |
| 3052 | 3052 | add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 ); |
| 3053 | 3053 | |
@@ -3067,47 +3067,47 @@ discard block |
||
| 3067 | 3067 | * @return bool true when exists. false when not exists. |
| 3068 | 3068 | */ |
| 3069 | 3069 | function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
|
| 3070 | - global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress; |
|
| 3070 | + global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress; |
|
| 3071 | 3071 | |
| 3072 | - if ( $slug_exists ) {
|
|
| 3073 | - return $slug_exists; |
|
| 3074 | - } |
|
| 3072 | + if ( $slug_exists ) {
|
|
| 3073 | + return $slug_exists; |
|
| 3074 | + } |
|
| 3075 | 3075 | |
| 3076 | - if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
|
|
| 3077 | - $taxonomy = $gd_term_taxonomy[$term_id]; |
|
| 3078 | - } else {
|
|
| 3079 | - $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) ); |
|
| 3080 | - $gd_term_taxonomy[$term_id] = $taxonomy; |
|
| 3081 | - } |
|
| 3076 | + if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
|
|
| 3077 | + $taxonomy = $gd_term_taxonomy[$term_id]; |
|
| 3078 | + } else {
|
|
| 3079 | + $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) ); |
|
| 3080 | + $gd_term_taxonomy[$term_id] = $taxonomy; |
|
| 3081 | + } |
|
| 3082 | 3082 | |
| 3083 | - if ( empty($taxonomy) ) {
|
|
| 3084 | - return $slug_exists; |
|
| 3085 | - } |
|
| 3083 | + if ( empty($taxonomy) ) {
|
|
| 3084 | + return $slug_exists; |
|
| 3085 | + } |
|
| 3086 | 3086 | |
| 3087 | - if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
|
|
| 3088 | - $post_type = $gd_term_post_type[$term_id]; |
|
| 3089 | - } else {
|
|
| 3090 | - $taxonomy_obj = get_taxonomy( $taxonomy ); |
|
| 3091 | - $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL; |
|
| 3092 | - } |
|
| 3087 | + if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
|
|
| 3088 | + $post_type = $gd_term_post_type[$term_id]; |
|
| 3089 | + } else {
|
|
| 3090 | + $taxonomy_obj = get_taxonomy( $taxonomy ); |
|
| 3091 | + $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL; |
|
| 3092 | + } |
|
| 3093 | 3093 | |
| 3094 | - $wpml_post_join = ""; |
|
| 3095 | - $wpml_post_where = ""; |
|
| 3094 | + $wpml_post_join = ""; |
|
| 3095 | + $wpml_post_where = ""; |
|
| 3096 | 3096 | |
| 3097 | - if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
|
|
| 3098 | - $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language(); |
|
| 3099 | - if (!$term_language) {
|
|
| 3100 | - $term_language = $sitepress->get_current_language(); |
|
| 3101 | - } |
|
| 3097 | + if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
|
|
| 3098 | + $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language(); |
|
| 3099 | + if (!$term_language) {
|
|
| 3100 | + $term_language = $sitepress->get_current_language(); |
|
| 3101 | + } |
|
| 3102 | 3102 | |
| 3103 | - $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
|
|
| 3104 | - $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'"; |
|
| 3105 | - } |
|
| 3103 | + $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)";
|
|
| 3104 | + $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'"; |
|
| 3105 | + } |
|
| 3106 | 3106 | |
| 3107 | - if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
|
|
| 3108 | - $slug_exists = true; |
|
| 3109 | - } |
|
| 3107 | + if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) {
|
|
| 3108 | + $slug_exists = true; |
|
| 3109 | + } |
|
| 3110 | 3110 | |
| 3111 | - return $slug_exists; |
|
| 3111 | + return $slug_exists; |
|
| 3112 | 3112 | } |
| 3113 | 3113 | add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 ); |
| 3114 | 3114 | \ No newline at end of file |
@@ -86,8 +86,9 @@ discard block |
||
| 86 | 86 | add_filter('query_vars', 'geodir_add_location_var');
|
| 87 | 87 | add_filter('query_vars', 'geodir_add_geodir_page_var');
|
| 88 | 88 | add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
|
| 89 | -if (get_option('permalink_structure') != '')
|
|
| 90 | - add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
|
|
| 89 | +if (get_option('permalink_structure') != '') { |
|
| 90 | + add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
| 91 | +} |
|
| 91 | 92 | |
| 92 | 93 | add_filter('parse_query', 'geodir_modified_query');
|
| 93 | 94 | |
@@ -431,8 +432,9 @@ discard block |
||
| 431 | 432 | */ |
| 432 | 433 | do_action('geodir_after_social_sharing_buttons');
|
| 433 | 434 | $content_html = ob_get_clean(); |
| 434 | - if (trim($content_html) != '') |
|
| 435 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
| 435 | + if (trim($content_html) != '') { |
|
| 436 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
| 437 | + } |
|
| 436 | 438 | if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
|
| 437 | 439 | /** |
| 438 | 440 | * Filter the geodir_social_sharing_buttons() function content. |
@@ -488,8 +490,9 @@ discard block |
||
| 488 | 490 | */ |
| 489 | 491 | do_action('geodir_after_edit_post_link');
|
| 490 | 492 | $content_html = ob_get_clean(); |
| 491 | - if (trim($content_html) != '') |
|
| 492 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
| 493 | + if (trim($content_html) != '') { |
|
| 494 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
| 495 | + } |
|
| 493 | 496 | if ((int)get_option('geodir_disable_user_links_section') != 1) {
|
| 494 | 497 | /** |
| 495 | 498 | * Filter the geodir_edit_post_link() function content. |
@@ -1063,8 +1066,9 @@ discard block |
||
| 1063 | 1066 | */ |
| 1064 | 1067 | do_action('geodir_after_google_analytics');
|
| 1065 | 1068 | $content_html = ob_get_clean(); |
| 1066 | - if (trim($content_html) != '') |
|
| 1067 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
| 1069 | + if (trim($content_html) != '') { |
|
| 1070 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
| 1071 | + } |
|
| 1068 | 1072 | if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
|
| 1069 | 1073 | /** |
| 1070 | 1074 | * Filter the geodir_edit_post_link() function content. |
@@ -1206,8 +1210,9 @@ discard block |
||
| 1206 | 1210 | do_action('geodir_after_detail_page_more_info');
|
| 1207 | 1211 | |
| 1208 | 1212 | $content_html = ob_get_clean(); |
| 1209 | - if (trim($content_html) != '') |
|
| 1210 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
| 1213 | + if (trim($content_html) != '') { |
|
| 1214 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
| 1215 | + } |
|
| 1211 | 1216 | if ((int)get_option('geodir_disable_listing_info_section') != 1) {
|
| 1212 | 1217 | /** |
| 1213 | 1218 | * Filter the output html for function geodir_detail_page_more_info(). |
@@ -1334,8 +1339,9 @@ discard block |
||
| 1334 | 1339 | $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
|
| 1335 | 1340 | |
| 1336 | 1341 | foreach ($arr_alert_msg as $key => $value) {
|
| 1337 | - if (!is_scalar($value)) |
|
| 1338 | - continue; |
|
| 1342 | + if (!is_scalar($value)) { |
|
| 1343 | + continue; |
|
| 1344 | + } |
|
| 1339 | 1345 | $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
| 1340 | 1346 | } |
| 1341 | 1347 | |
@@ -1391,17 +1397,19 @@ discard block |
||
| 1391 | 1397 | global $geodir_sidebars; |
| 1392 | 1398 | global $sidebars_widgets; |
| 1393 | 1399 | |
| 1394 | - if (!is_array($sidebars_widgets)) |
|
| 1395 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1400 | + if (!is_array($sidebars_widgets)) { |
|
| 1401 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1402 | + } |
|
| 1396 | 1403 | $geodir_old_sidebars = array(); |
| 1397 | 1404 | |
| 1398 | 1405 | if (is_array($geodir_sidebars)) {
|
| 1399 | 1406 | foreach ($geodir_sidebars as $val) {
|
| 1400 | 1407 | if (is_array($sidebars_widgets)) {
|
| 1401 | - if (array_key_exists($val, $sidebars_widgets)) |
|
| 1402 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
| 1403 | - else |
|
| 1404 | - $geodir_old_sidebars[$val] = array(); |
|
| 1408 | + if (array_key_exists($val, $sidebars_widgets)) { |
|
| 1409 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
| 1410 | + } else { |
|
| 1411 | + $geodir_old_sidebars[$val] = array(); |
|
| 1412 | + } |
|
| 1405 | 1413 | } |
| 1406 | 1414 | } |
| 1407 | 1415 | } |
@@ -1422,16 +1430,19 @@ discard block |
||
| 1422 | 1430 | {
|
| 1423 | 1431 | global $sidebars_widgets; |
| 1424 | 1432 | |
| 1425 | - if (!is_array($sidebars_widgets)) |
|
| 1426 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1433 | + if (!is_array($sidebars_widgets)) { |
|
| 1434 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
| 1435 | + } |
|
| 1427 | 1436 | |
| 1428 | 1437 | if (is_array($sidebars_widgets)) {
|
| 1429 | 1438 | $geodir_old_sidebars = get_option('geodir_sidebars');
|
| 1430 | 1439 | if (is_array($geodir_old_sidebars)) {
|
| 1431 | 1440 | foreach ($geodir_old_sidebars as $key => $val) {
|
| 1432 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
| 1441 | + if(0 === strpos($key, 'geodir_')) { |
|
| 1442 | + // if gd widget |
|
| 1433 | 1443 | {
|
| 1434 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
| 1444 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
| 1445 | + } |
|
| 1435 | 1446 | } |
| 1436 | 1447 | |
| 1437 | 1448 | |
@@ -1567,20 +1578,25 @@ discard block |
||
| 1567 | 1578 | } |
| 1568 | 1579 | } |
| 1569 | 1580 | |
| 1570 | - if ($tab == 'post_info') |
|
| 1571 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
| 1581 | + if ($tab == 'post_info') { |
|
| 1582 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
| 1583 | + } |
|
| 1572 | 1584 | |
| 1573 | - if ($tab == 'post_images') |
|
| 1574 | - $is_display = (!empty($post_images)) ? true : false; |
|
| 1585 | + if ($tab == 'post_images') { |
|
| 1586 | + $is_display = (!empty($post_images)) ? true : false; |
|
| 1587 | + } |
|
| 1575 | 1588 | |
| 1576 | - if ($tab == 'post_video') |
|
| 1577 | - $is_display = (!empty($video)) ? true : false; |
|
| 1589 | + if ($tab == 'post_video') { |
|
| 1590 | + $is_display = (!empty($video)) ? true : false; |
|
| 1591 | + } |
|
| 1578 | 1592 | |
| 1579 | - if ($tab == 'special_offers') |
|
| 1580 | - $is_display = (!empty($special_offers)) ? true : false; |
|
| 1593 | + if ($tab == 'special_offers') { |
|
| 1594 | + $is_display = (!empty($special_offers)) ? true : false; |
|
| 1595 | + } |
|
| 1581 | 1596 | |
| 1582 | - if ($tab == 'reviews') |
|
| 1583 | - $is_display = (geodir_is_page('detail')) ? true : false;
|
|
| 1597 | + if ($tab == 'reviews') { |
|
| 1598 | + $is_display = (geodir_is_page('detail')) ? true : false; |
|
| 1599 | + } |
|
| 1584 | 1600 | |
| 1585 | 1601 | if ($tab == 'related_listing') {
|
| 1586 | 1602 | $message = __('No listings found which match your selection.', 'geodirectory');
|
@@ -1814,11 +1830,13 @@ discard block |
||
| 1814 | 1830 | $region_slug = $default_location->region_slug; |
| 1815 | 1831 | $city_slug = $default_location->city_slug; |
| 1816 | 1832 | |
| 1817 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
| 1818 | - return $slug_exists = true; |
|
| 1833 | + if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) { |
|
| 1834 | + return $slug_exists = true; |
|
| 1835 | + } |
|
| 1819 | 1836 | |
| 1820 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
|
|
| 1821 | - return $slug_exists = true; |
|
| 1837 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) { |
|
| 1838 | + return $slug_exists = true; |
|
| 1839 | + } |
|
| 1822 | 1840 | |
| 1823 | 1841 | return $slug_exists; |
| 1824 | 1842 | } |
@@ -1861,40 +1879,31 @@ discard block |
||
| 1861 | 1879 | if(geodir_is_page('home')){
|
| 1862 | 1880 | $gd_page = 'home'; |
| 1863 | 1881 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
|
| 1864 | - } |
|
| 1865 | - elseif(geodir_is_page('detail')){
|
|
| 1882 | + } elseif(geodir_is_page('detail')){
|
|
| 1866 | 1883 | $gd_page = 'detail'; |
| 1867 | 1884 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
|
| 1868 | - } |
|
| 1869 | - elseif(geodir_is_page('pt')){
|
|
| 1885 | + } elseif(geodir_is_page('pt')){
|
|
| 1870 | 1886 | $gd_page = 'pt'; |
| 1871 | 1887 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
|
| 1872 | - } |
|
| 1873 | - elseif(geodir_is_page('listing')){
|
|
| 1888 | + } elseif(geodir_is_page('listing')){
|
|
| 1874 | 1889 | $gd_page = 'listing'; |
| 1875 | 1890 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
|
| 1876 | - } |
|
| 1877 | - elseif(geodir_is_page('location')){
|
|
| 1891 | + } elseif(geodir_is_page('location')){
|
|
| 1878 | 1892 | $gd_page = 'location'; |
| 1879 | 1893 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
|
| 1880 | - } |
|
| 1881 | - elseif(geodir_is_page('search')){
|
|
| 1894 | + } elseif(geodir_is_page('search')){
|
|
| 1882 | 1895 | $gd_page = 'search'; |
| 1883 | 1896 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
|
| 1884 | - } |
|
| 1885 | - elseif(geodir_is_page('add-listing')){
|
|
| 1897 | + } elseif(geodir_is_page('add-listing')){
|
|
| 1886 | 1898 | $gd_page = 'add-listing'; |
| 1887 | 1899 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
|
| 1888 | - } |
|
| 1889 | - elseif(geodir_is_page('author')){
|
|
| 1900 | + } elseif(geodir_is_page('author')){
|
|
| 1890 | 1901 | $gd_page = 'author'; |
| 1891 | 1902 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
|
| 1892 | - } |
|
| 1893 | - elseif(geodir_is_page('login')){
|
|
| 1903 | + } elseif(geodir_is_page('login')){
|
|
| 1894 | 1904 | $gd_page = 'login'; |
| 1895 | 1905 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
|
| 1896 | - } |
|
| 1897 | - elseif(geodir_is_page('listing-success')){
|
|
| 1906 | + } elseif(geodir_is_page('listing-success')){
|
|
| 1898 | 1907 | $gd_page = 'listing-success'; |
| 1899 | 1908 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
|
| 1900 | 1909 | } |
@@ -1972,11 +1981,13 @@ discard block |
||
| 1972 | 1981 | |
| 1973 | 1982 | if (!get_option('geodir_remove_url_seperator')) {
|
| 1974 | 1983 | |
| 1975 | - if (get_option('geodir_listingurl_separator'))
|
|
| 1976 | - delete_option('geodir_listingurl_separator');
|
|
| 1984 | + if (get_option('geodir_listingurl_separator')) { |
|
| 1985 | + delete_option('geodir_listingurl_separator'); |
|
| 1986 | + } |
|
| 1977 | 1987 | |
| 1978 | - if (get_option('geodir_detailurl_separator'))
|
|
| 1979 | - delete_option('geodir_detailurl_separator');
|
|
| 1988 | + if (get_option('geodir_detailurl_separator')) { |
|
| 1989 | + delete_option('geodir_detailurl_separator'); |
|
| 1990 | + } |
|
| 1980 | 1991 | |
| 1981 | 1992 | flush_rewrite_rules(false); |
| 1982 | 1993 | |
@@ -2000,8 +2011,9 @@ discard block |
||
| 2000 | 2011 | {
|
| 2001 | 2012 | foreach ($permalink_arr as $key => $value) {
|
| 2002 | 2013 | |
| 2003 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
| 2004 | - unset($permalink_arr[$key]); |
|
| 2014 | + if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') { |
|
| 2015 | + unset($permalink_arr[$key]); |
|
| 2016 | + } |
|
| 2005 | 2017 | |
| 2006 | 2018 | } |
| 2007 | 2019 | |
@@ -2136,16 +2148,18 @@ discard block |
||
| 2136 | 2148 | |
| 2137 | 2149 | $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
|
| 2138 | 2150 | |
| 2139 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
| 2140 | - $tabs_arr['post_video']['heading_text'] = $field_title; |
|
| 2151 | + if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') { |
|
| 2152 | + $tabs_arr['post_video']['heading_text'] = $field_title; |
|
| 2153 | + } |
|
| 2141 | 2154 | } |
| 2142 | 2155 | |
| 2143 | 2156 | if (array_key_exists('special_offers', $tabs_arr)) {
|
| 2144 | 2157 | |
| 2145 | 2158 | $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
|
| 2146 | 2159 | |
| 2147 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
| 2148 | - $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
| 2160 | + if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') { |
|
| 2161 | + $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
| 2162 | + } |
|
| 2149 | 2163 | } |
| 2150 | 2164 | |
| 2151 | 2165 | } |
@@ -2200,8 +2214,9 @@ discard block |
||
| 2200 | 2214 | |
| 2201 | 2215 | $all_postypes = geodir_get_posttypes(); |
| 2202 | 2216 | |
| 2203 | - if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
| 2204 | - return false; |
|
| 2217 | + if (!in_array($post_type, $all_postypes) || !is_admin()) { |
|
| 2218 | + return false; |
|
| 2219 | + } |
|
| 2205 | 2220 | |
| 2206 | 2221 | $uploads = wp_upload_dir(); |
| 2207 | 2222 | |
@@ -2275,8 +2290,9 @@ discard block |
||
| 2275 | 2290 | $file_info = pathinfo($attach->file); |
| 2276 | 2291 | |
| 2277 | 2292 | $sub_dir = ''; |
| 2278 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 2279 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 2293 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
| 2294 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
| 2295 | + } |
|
| 2280 | 2296 | |
| 2281 | 2297 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
| 2282 | 2298 | $uploads_path = $uploads['basedir']; |
@@ -2297,8 +2313,9 @@ discard block |
||
| 2297 | 2313 | |
| 2298 | 2314 | if (!empty($attachment_data)) {
|
| 2299 | 2315 | |
| 2300 | - if ($attachment_data->ID) |
|
| 2301 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
|
|
| 2316 | + if ($attachment_data->ID) { |
|
| 2317 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
| 2318 | + } |
|
| 2302 | 2319 | |
| 2303 | 2320 | } else {
|
| 2304 | 2321 | |
@@ -2489,7 +2506,7 @@ discard block |
||
| 2489 | 2506 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
| 2490 | 2507 | $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
|
| 2491 | 2508 | |
| 2492 | - }else{
|
|
| 2509 | + } else{
|
|
| 2493 | 2510 | $i = 0; |
| 2494 | 2511 | $fieldset_count++; |
| 2495 | 2512 | $field_set_start = 1; |
@@ -2618,7 +2635,7 @@ discard block |
||
| 2618 | 2635 | $status_icon = '<i class="fa fa-play"></i>'; |
| 2619 | 2636 | if ($real_status == 'publish') {
|
| 2620 | 2637 | $status .= __('Published', 'geodirectory');
|
| 2621 | - }elseif ($real_status == 'pending') {
|
|
| 2638 | + } elseif ($real_status == 'pending') {
|
|
| 2622 | 2639 | $status .= __('Awaiting Review', 'geodirectory');
|
| 2623 | 2640 | } else {
|
| 2624 | 2641 | $status .= __('Not published', 'geodirectory');
|
@@ -10,33 +10,33 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | add_action('admin_init', 'geodir_admin_init');
|
| 12 | 12 | if (!function_exists('geodir_admin_init')) {
|
| 13 | - /** |
|
| 14 | - * Adds GD setting pages in admin. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - * @global string $current_tab The current settings tab name. |
|
| 19 | - */ |
|
| 20 | - function geodir_admin_init() |
|
| 21 | - {
|
|
| 22 | - |
|
| 23 | - if (is_admin()): |
|
| 24 | - global $current_tab; |
|
| 25 | - geodir_redirect_to_admin_panel_on_installed(); |
|
| 26 | - $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
|
| 27 | - if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | - geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 29 | - /** |
|
| 30 | - * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
|
| 31 | - * |
|
| 32 | - * @since 1.0.0 |
|
| 33 | - */ |
|
| 34 | - do_action('admin_panel_init');
|
|
| 35 | - add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
|
|
| 36 | - |
|
| 37 | - |
|
| 38 | - endif; |
|
| 39 | - } |
|
| 13 | + /** |
|
| 14 | + * Adds GD setting pages in admin. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + * @global string $current_tab The current settings tab name. |
|
| 19 | + */ |
|
| 20 | + function geodir_admin_init() |
|
| 21 | + {
|
|
| 22 | + |
|
| 23 | + if (is_admin()): |
|
| 24 | + global $current_tab; |
|
| 25 | + geodir_redirect_to_admin_panel_on_installed(); |
|
| 26 | + $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
|
| 27 | + if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | + geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 29 | + /** |
|
| 30 | + * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
|
| 31 | + * |
|
| 32 | + * @since 1.0.0 |
|
| 33 | + */ |
|
| 34 | + do_action('admin_panel_init');
|
|
| 35 | + add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
|
|
| 36 | + |
|
| 37 | + |
|
| 38 | + endif; |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | function geodir_redirect_to_admin_panel_on_installed() |
| 49 | 49 | {
|
| 50 | - if (get_option('geodir_installation_redirect', false)) {
|
|
| 51 | - delete_option('geodir_installation_redirect');
|
|
| 52 | - wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
|
|
| 53 | - } |
|
| 50 | + if (get_option('geodir_installation_redirect', false)) {
|
|
| 51 | + delete_option('geodir_installation_redirect');
|
|
| 52 | + wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
|
|
| 53 | + } |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | function geodir_get_admin_option_form($current_tab) |
| 64 | 64 | {
|
| 65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
| 65 | + geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -86,24 +86,24 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function geodir_conditional_admin_script_load() |
| 88 | 88 | {
|
| 89 | - global $pagenow; |
|
| 89 | + global $pagenow; |
|
| 90 | 90 | |
| 91 | 91 | // Get the current post type |
| 92 | 92 | $post_type = geodir_admin_current_post_type(); |
| 93 | 93 | $geodir_post_types = geodir_get_posttypes(); |
| 94 | 94 | |
| 95 | 95 | if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'term.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
|
| 96 | - add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
|
|
| 97 | - add_action('admin_enqueue_scripts', 'geodir_admin_styles');
|
|
| 98 | - add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
|
|
| 96 | + add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
|
|
| 97 | + add_action('admin_enqueue_scripts', 'geodir_admin_styles');
|
|
| 98 | + add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
|
|
| 99 | 99 | |
| 100 | - // Disable VC editor for GD post types. |
|
| 101 | - if (class_exists('Vc_Role_Access_Controller')) {
|
|
| 102 | - add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 ); |
|
| 103 | - } |
|
| 104 | - } |
|
| 100 | + // Disable VC editor for GD post types. |
|
| 101 | + if (class_exists('Vc_Role_Access_Controller')) {
|
|
| 102 | + add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 ); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
|
|
| 106 | + add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
|
|
| 107 | 107 | |
| 108 | 108 | } |
| 109 | 109 | |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | function create_default_admin_main_nav() |
| 140 | 140 | {
|
| 141 | - add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
|
|
| 142 | - add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
|
|
| 143 | - add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
|
|
| 144 | - add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
|
|
| 145 | - add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
|
|
| 146 | - //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
|
|
| 141 | + add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
|
|
| 142 | + add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
|
|
| 143 | + add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
|
|
| 144 | + add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
|
|
| 145 | + add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
|
|
| 146 | + //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
|
|
| 147 | 147 | |
| 148 | 148 | } |
| 149 | 149 | |
@@ -156,16 +156,16 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | function geodir_admin_list_columns() |
| 158 | 158 | {
|
| 159 | - if ($post_types = geodir_get_posttypes()) {
|
|
| 159 | + if ($post_types = geodir_get_posttypes()) {
|
|
| 160 | 160 | |
| 161 | - foreach ($post_types as $post_type): |
|
| 162 | - add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
|
|
| 163 | - //Filter-Payment-Manager to show Package |
|
| 164 | - add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
|
|
| 161 | + foreach ($post_types as $post_type): |
|
| 162 | + add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
|
|
| 163 | + //Filter-Payment-Manager to show Package |
|
| 164 | + add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
|
|
| 165 | 165 | |
| 166 | - add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
|
|
| 167 | - endforeach; |
|
| 168 | - } |
|
| 166 | + add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
|
|
| 167 | + endforeach; |
|
| 168 | + } |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | function geodir_default_admin_main_tabs($tabs) |
| 180 | 180 | {
|
| 181 | - return $tabs = array( |
|
| 182 | - 'general_settings' => array('label' => __('General', 'geodirectory')),
|
|
| 183 | - 'design_settings' => array('label' => __('Design', 'geodirectory')),
|
|
| 184 | - 'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
|
|
| 185 | - 'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
|
|
| 186 | - 'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
|
|
| 187 | - 'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
|
|
| 188 | - |
|
| 189 | - ); |
|
| 181 | + return $tabs = array( |
|
| 182 | + 'general_settings' => array('label' => __('General', 'geodirectory')),
|
|
| 183 | + 'design_settings' => array('label' => __('Design', 'geodirectory')),
|
|
| 184 | + 'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
|
|
| 185 | + 'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
|
|
| 186 | + 'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
|
|
| 187 | + 'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
|
|
| 188 | + |
|
| 189 | + ); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | add_action('do_meta_boxes', 'geodir_remove_image_box');
|
@@ -199,16 +199,16 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | function geodir_remove_image_box() |
| 201 | 201 | {
|
| 202 | - global $post; |
|
| 202 | + global $post; |
|
| 203 | 203 | |
| 204 | - $geodir_posttypes = geodir_get_posttypes(); |
|
| 204 | + $geodir_posttypes = geodir_get_posttypes(); |
|
| 205 | 205 | |
| 206 | - if (isset($post) && in_array($post->post_type, $geodir_posttypes)): |
|
| 206 | + if (isset($post) && in_array($post->post_type, $geodir_posttypes)): |
|
| 207 | 207 | |
| 208 | - remove_meta_box('postimagediv', $post->post_type, 'side');
|
|
| 209 | - remove_meta_box('revisionsdiv', $post->post_type, 'normal');
|
|
| 208 | + remove_meta_box('postimagediv', $post->post_type, 'side');
|
|
| 209 | + remove_meta_box('revisionsdiv', $post->post_type, 'normal');
|
|
| 210 | 210 | |
| 211 | - endif; |
|
| 211 | + endif; |
|
| 212 | 212 | |
| 213 | 213 | } |
| 214 | 214 | |
@@ -223,27 +223,27 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | function geodir_meta_box_add() |
| 225 | 225 | {
|
| 226 | - global $post; |
|
| 226 | + global $post; |
|
| 227 | 227 | |
| 228 | - $geodir_post_types = geodir_get_posttypes('array');
|
|
| 229 | - $geodir_posttypes = array_keys($geodir_post_types); |
|
| 228 | + $geodir_post_types = geodir_get_posttypes('array');
|
|
| 229 | + $geodir_posttypes = array_keys($geodir_post_types); |
|
| 230 | 230 | |
| 231 | - if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)): |
|
| 231 | + if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)): |
|
| 232 | 232 | |
| 233 | - $geodir_posttype = $post->post_type; |
|
| 234 | - $post_typename = __($geodir_post_types[$geodir_posttype]['labels']['singular_name'], 'geodirectory'); |
|
| 235 | - $post_typename = geodir_ucwords($post_typename); |
|
| 233 | + $geodir_posttype = $post->post_type; |
|
| 234 | + $post_typename = __($geodir_post_types[$geodir_posttype]['labels']['singular_name'], 'geodirectory'); |
|
| 235 | + $post_typename = geodir_ucwords($post_typename); |
|
| 236 | 236 | |
| 237 | - // Filter-Payment-Manager |
|
| 237 | + // Filter-Payment-Manager |
|
| 238 | 238 | |
| 239 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 239 | + add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 240 | 240 | |
| 241 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 241 | + add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 242 | 242 | |
| 243 | - // no need of this box as all fields moved to main information box |
|
| 244 | - //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
|
| 243 | + // no need of this box as all fields moved to main information box |
|
| 244 | + //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
|
| 245 | 245 | |
| 246 | - endif; |
|
| 246 | + endif; |
|
| 247 | 247 | |
| 248 | 248 | } |
| 249 | 249 | |
@@ -267,23 +267,23 @@ discard block |
||
| 267 | 267 | function geodir_hide_post_taxonomy_meta_boxes() |
| 268 | 268 | {
|
| 269 | 269 | |
| 270 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 270 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 271 | 271 | |
| 272 | - if (!empty($geodir_post_types)) {
|
|
| 273 | - foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
|
|
| 272 | + if (!empty($geodir_post_types)) {
|
|
| 273 | + foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
|
|
| 274 | 274 | |
| 275 | - $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 275 | + $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 276 | 276 | |
| 277 | - if(!empty($gd_taxonomy)) {
|
|
| 278 | - foreach ($gd_taxonomy as $tax) {
|
|
| 277 | + if(!empty($gd_taxonomy)) {
|
|
| 278 | + foreach ($gd_taxonomy as $tax) {
|
|
| 279 | 279 | |
| 280 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 280 | + remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 281 | 281 | |
| 282 | - } |
|
| 283 | - } |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - } |
|
| 286 | - } |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | add_filter('geodir_add_listing_map_restrict', 'geodir_add_listing_map_restrict');
|
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | function geodir_add_listing_map_restrict($map_restirct) |
| 299 | 299 | {
|
| 300 | - if (is_admin()) {
|
|
| 301 | - if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
|
|
| 302 | - $map_restirct = false; |
|
| 303 | - } |
|
| 304 | - } |
|
| 305 | - return $map_restirct; |
|
| 300 | + if (is_admin()) {
|
|
| 301 | + if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
|
|
| 302 | + $map_restirct = false; |
|
| 303 | + } |
|
| 304 | + } |
|
| 305 | + return $map_restirct; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -321,16 +321,16 @@ discard block |
||
| 321 | 321 | function geodir_enable_editor_on_notifications($notification) |
| 322 | 322 | {
|
| 323 | 323 | |
| 324 | - if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
|
| 324 | + if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
|
| 325 | 325 | |
| 326 | - foreach ($notification as $key => $value) {
|
|
| 327 | - if ($value['type'] == 'textarea') |
|
| 328 | - $notification[$key]['type'] = 'editor'; |
|
| 329 | - } |
|
| 326 | + foreach ($notification as $key => $value) {
|
|
| 327 | + if ($value['type'] == 'textarea') |
|
| 328 | + $notification[$key]['type'] = 'editor'; |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - } |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - return $notification; |
|
| 333 | + return $notification; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | |
@@ -347,16 +347,16 @@ discard block |
||
| 347 | 347 | function geodir_enable_editor_on_design_settings($design_setting) |
| 348 | 348 | {
|
| 349 | 349 | |
| 350 | - if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
|
| 350 | + if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
|
| 351 | 351 | |
| 352 | - foreach ($design_setting as $key => $value) {
|
|
| 353 | - if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 354 | - $design_setting[$key]['type'] = 'editor'; |
|
| 355 | - } |
|
| 352 | + foreach ($design_setting as $key => $value) {
|
|
| 353 | + if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 354 | + $design_setting[$key]['type'] = 'editor'; |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | - } |
|
| 357 | + } |
|
| 358 | 358 | |
| 359 | - return $design_setting; |
|
| 359 | + return $design_setting; |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /* ----------- START MANAGE CUSTOM FIELDS ---------------- */ |
@@ -364,15 +364,15 @@ discard block |
||
| 364 | 364 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
|
| 365 | 365 | |
| 366 | 366 | function geodir_manage_available_fields_predefined($sub_tab){
|
| 367 | - if($sub_tab=='custom_fields'){
|
|
| 368 | - geodir_custom_available_fields('predefined');
|
|
| 369 | - } |
|
| 367 | + if($sub_tab=='custom_fields'){
|
|
| 368 | + geodir_custom_available_fields('predefined');
|
|
| 369 | + } |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | function geodir_manage_available_fields_custom($sub_tab){
|
| 373 | - if($sub_tab=='custom_fields'){
|
|
| 374 | - geodir_custom_available_fields('custom');
|
|
| 375 | - } |
|
| 373 | + if($sub_tab=='custom_fields'){
|
|
| 374 | + geodir_custom_available_fields('custom');
|
|
| 375 | + } |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | |
@@ -391,16 +391,16 @@ discard block |
||
| 391 | 391 | function geodir_manage_available_fields($sub_tab) |
| 392 | 392 | {
|
| 393 | 393 | |
| 394 | - switch ($sub_tab) {
|
|
| 395 | - case 'custom_fields': |
|
| 396 | - geodir_custom_available_fields(); |
|
| 397 | - break; |
|
| 394 | + switch ($sub_tab) {
|
|
| 395 | + case 'custom_fields': |
|
| 396 | + geodir_custom_available_fields(); |
|
| 397 | + break; |
|
| 398 | 398 | |
| 399 | - case 'sorting_options': |
|
| 400 | - geodir_sorting_options_available_fields(); |
|
| 401 | - break; |
|
| 399 | + case 'sorting_options': |
|
| 400 | + geodir_sorting_options_available_fields(); |
|
| 401 | + break; |
|
| 402 | 402 | |
| 403 | - } |
|
| 403 | + } |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | |
@@ -416,16 +416,16 @@ discard block |
||
| 416 | 416 | function geodir_manage_selected_fields($sub_tab) |
| 417 | 417 | {
|
| 418 | 418 | |
| 419 | - switch ($sub_tab) {
|
|
| 420 | - case 'custom_fields': |
|
| 421 | - geodir_custom_selected_fields(); |
|
| 422 | - break; |
|
| 419 | + switch ($sub_tab) {
|
|
| 420 | + case 'custom_fields': |
|
| 421 | + geodir_custom_selected_fields(); |
|
| 422 | + break; |
|
| 423 | 423 | |
| 424 | - case 'sorting_options': |
|
| 425 | - geodir_sorting_options_selected_fields(); |
|
| 426 | - break; |
|
| 424 | + case 'sorting_options': |
|
| 425 | + geodir_sorting_options_selected_fields(); |
|
| 426 | + break; |
|
| 427 | 427 | |
| 428 | - } |
|
| 428 | + } |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /** |
@@ -437,52 +437,52 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | function geodir_sorting_options_available_fields() |
| 439 | 439 | {
|
| 440 | - global $wpdb; |
|
| 441 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 442 | - ?> |
|
| 440 | + global $wpdb; |
|
| 441 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 442 | + ?> |
|
| 443 | 443 | <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
| 444 | 444 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 445 | 445 | <ul> |
| 446 | 446 | <?php |
| 447 | - $sort_options = geodir_get_custom_sort_options($listing_type); |
|
| 447 | + $sort_options = geodir_get_custom_sort_options($listing_type); |
|
| 448 | 448 | |
| 449 | - foreach ($sort_options as $key => $val) {
|
|
| 450 | - $val = stripslashes_deep($val); // strip slashes |
|
| 451 | - |
|
| 452 | - $check_html_variable = $wpdb->get_var( |
|
| 453 | - $wpdb->prepare( |
|
| 454 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 455 | - array($val['htmlvar_name'], $listing_type, $val['field_type']) |
|
| 456 | - ) |
|
| 457 | - ); |
|
| 449 | + foreach ($sort_options as $key => $val) {
|
|
| 450 | + $val = stripslashes_deep($val); // strip slashes |
|
| 451 | + |
|
| 452 | + $check_html_variable = $wpdb->get_var( |
|
| 453 | + $wpdb->prepare( |
|
| 454 | + "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 455 | + array($val['htmlvar_name'], $listing_type, $val['field_type']) |
|
| 456 | + ) |
|
| 457 | + ); |
|
| 458 | 458 | |
| 459 | - $display = $check_html_variable ? ' style="display:none;"' : ''; |
|
| 460 | - ?> |
|
| 459 | + $display = $check_html_variable ? ' style="display:none;"' : ''; |
|
| 460 | + ?> |
|
| 461 | 461 | |
| 462 | 462 | <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
| 463 | 463 | <?php |
| 464 | - if(isset($val['description']) && $val['description']){
|
|
| 465 | - echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
|
| 466 | - }?> |
|
| 464 | + if(isset($val['description']) && $val['description']){
|
|
| 465 | + echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
|
| 466 | + }?> |
|
| 467 | 467 | |
| 468 | 468 | <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>" data-field-type="<?php echo $val['field_type'];?>" |
| 469 | 469 | title="<?php echo $val['site_title'];?>" |
| 470 | 470 | class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
| 471 | 471 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
|
| 472 | - echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
|
| 473 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 474 | - echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
|
|
| 475 | - }else{
|
|
| 476 | - echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 477 | - }?> |
|
| 472 | + echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
|
| 473 | + }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 474 | + echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
|
|
| 475 | + }else{
|
|
| 476 | + echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 477 | + }?> |
|
| 478 | 478 | <?php echo $val['site_title'];?> |
| 479 | 479 | </a> |
| 480 | 480 | </li> |
| 481 | 481 | |
| 482 | 482 | |
| 483 | 483 | <?php |
| 484 | - } |
|
| 485 | - ?> |
|
| 484 | + } |
|
| 485 | + ?> |
|
| 486 | 486 | </ul> |
| 487 | 487 | <?php |
| 488 | 488 | } |
@@ -496,28 +496,28 @@ discard block |
||
| 496 | 496 | */ |
| 497 | 497 | function geodir_sorting_options_selected_fields() |
| 498 | 498 | {
|
| 499 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 500 | - ?> |
|
| 499 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 500 | + ?> |
|
| 501 | 501 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 502 | 502 | <ul class="core"> |
| 503 | 503 | <?php |
| 504 | - global $wpdb; |
|
| 504 | + global $wpdb; |
|
| 505 | 505 | |
| 506 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 506 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 507 | 507 | |
| 508 | - if (!empty($fields)) {
|
|
| 509 | - foreach ($fields as $field) {
|
|
| 510 | - //$result_str = $field->id; |
|
| 511 | - $result_str = $field; |
|
| 512 | - $field_type = $field->field_type; |
|
| 513 | - $field_ins_upd = 'display'; |
|
| 508 | + if (!empty($fields)) {
|
|
| 509 | + foreach ($fields as $field) {
|
|
| 510 | + //$result_str = $field->id; |
|
| 511 | + $result_str = $field; |
|
| 512 | + $field_type = $field->field_type; |
|
| 513 | + $field_ins_upd = 'display'; |
|
| 514 | 514 | |
| 515 | - $default = false; |
|
| 515 | + $default = false; |
|
| 516 | 516 | |
| 517 | - geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default); |
|
| 518 | - } |
|
| 519 | - } |
|
| 520 | - ?> |
|
| 517 | + geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default); |
|
| 518 | + } |
|
| 519 | + } |
|
| 520 | + ?> |
|
| 521 | 521 | </ul> |
| 522 | 522 | <?php |
| 523 | 523 | } |
@@ -530,12 +530,12 @@ discard block |
||
| 530 | 530 | */ |
| 531 | 531 | function geodir_custom_fields_custom($post_type=''){
|
| 532 | 532 | |
| 533 | - $custom_fields = array(); |
|
| 533 | + $custom_fields = array(); |
|
| 534 | 534 | |
| 535 | - /** |
|
| 536 | - * @see `geodir_custom_fields` |
|
| 537 | - */ |
|
| 538 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
|
|
| 535 | + /** |
|
| 536 | + * @see `geodir_custom_fields` |
|
| 537 | + */ |
|
| 538 | + return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
|
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | |
@@ -548,140 +548,140 @@ discard block |
||
| 548 | 548 | */ |
| 549 | 549 | function geodir_custom_fields($post_type=''){
|
| 550 | 550 | |
| 551 | - $custom_fields = array( |
|
| 552 | - 'text' => array( |
|
| 553 | - 'field_type' => 'text', |
|
| 554 | - 'class' => 'gd-text', |
|
| 555 | - 'icon' => 'fa fa-minus', |
|
| 556 | - 'name' => __('Text', 'geodirectory'),
|
|
| 557 | - 'description' => __('Add any sort of text field, text or numbers', 'geodirectory')
|
|
| 558 | - ), |
|
| 559 | - 'datepicker' => array( |
|
| 560 | - 'field_type' => 'datepicker', |
|
| 561 | - 'class' => 'gd-datepicker', |
|
| 562 | - 'icon' => 'fa fa-calendar', |
|
| 563 | - 'name' => __('Date', 'geodirectory'),
|
|
| 564 | - 'description' => __('Adds a date picker.', 'geodirectory')
|
|
| 565 | - ), |
|
| 566 | - 'textarea' => array( |
|
| 567 | - 'field_type' => 'textarea', |
|
| 568 | - 'class' => 'gd-textarea', |
|
| 569 | - 'icon' => 'fa fa-bars', |
|
| 570 | - 'name' => __('Textarea', 'geodirectory'),
|
|
| 571 | - 'description' => __('Adds a textarea', 'geodirectory')
|
|
| 572 | - ), |
|
| 573 | - 'time' => array( |
|
| 574 | - 'field_type' => 'time', |
|
| 575 | - 'class' => 'gd-time', |
|
| 576 | - 'icon' => 'fa fa-clock-o', |
|
| 577 | - 'name' => __('Time', 'geodirectory'),
|
|
| 578 | - 'description' => __('Adds a time picker', 'geodirectory')
|
|
| 579 | - ), |
|
| 580 | - 'checkbox' => array( |
|
| 581 | - 'field_type' => 'checkbox', |
|
| 582 | - 'class' => 'gd-checkbox', |
|
| 583 | - 'icon' => 'fa fa-check-square-o', |
|
| 584 | - 'name' => __('Checkbox', 'geodirectory'),
|
|
| 585 | - 'description' => __('Adds a checkbox', 'geodirectory')
|
|
| 586 | - ), |
|
| 587 | - 'phone' => array( |
|
| 588 | - 'field_type' => 'phone', |
|
| 589 | - 'class' => 'gd-phone', |
|
| 590 | - 'icon' => 'fa fa-phone', |
|
| 591 | - 'name' => __('Phone', 'geodirectory'),
|
|
| 592 | - 'description' => __('Adds a phone input', 'geodirectory')
|
|
| 593 | - ), |
|
| 594 | - 'radio' => array( |
|
| 595 | - 'field_type' => 'radio', |
|
| 596 | - 'class' => 'gd-radio', |
|
| 597 | - 'icon' => 'fa fa-dot-circle-o', |
|
| 598 | - 'name' => __('Radio', 'geodirectory'),
|
|
| 599 | - 'description' => __('Adds a radio input', 'geodirectory')
|
|
| 600 | - ), |
|
| 601 | - 'email' => array( |
|
| 602 | - 'field_type' => 'email', |
|
| 603 | - 'class' => 'gd-email', |
|
| 604 | - 'icon' => 'fa fa-envelope-o', |
|
| 605 | - 'name' => __('Email', 'geodirectory'),
|
|
| 606 | - 'description' => __('Adds a email input', 'geodirectory')
|
|
| 607 | - ), |
|
| 608 | - 'select' => array( |
|
| 609 | - 'field_type' => 'select', |
|
| 610 | - 'class' => 'gd-select', |
|
| 611 | - 'icon' => 'fa fa-caret-square-o-down', |
|
| 612 | - 'name' => __('Select', 'geodirectory'),
|
|
| 613 | - 'description' => __('Adds a select input', 'geodirectory')
|
|
| 614 | - ), |
|
| 615 | - 'multiselect' => array( |
|
| 616 | - 'field_type' => 'multiselect', |
|
| 617 | - 'class' => 'gd-multiselect', |
|
| 618 | - 'icon' => 'fa fa-caret-square-o-down', |
|
| 619 | - 'name' => __('Multi Select', 'geodirectory'),
|
|
| 620 | - 'description' => __('Adds a multiselect input', 'geodirectory')
|
|
| 621 | - ), |
|
| 622 | - 'url' => array( |
|
| 623 | - 'field_type' => 'url', |
|
| 624 | - 'class' => 'gd-url', |
|
| 625 | - 'icon' => 'fa fa-link', |
|
| 626 | - 'name' => __('URL', 'geodirectory'),
|
|
| 627 | - 'description' => __('Adds a url input', 'geodirectory')
|
|
| 628 | - ), |
|
| 629 | - 'html' => array( |
|
| 630 | - 'field_type' => 'html', |
|
| 631 | - 'class' => 'gd-html', |
|
| 632 | - 'icon' => 'fa fa-code', |
|
| 633 | - 'name' => __('HTML', 'geodirectory'),
|
|
| 634 | - 'description' => __('Adds a html input textarea', 'geodirectory')
|
|
| 635 | - ), |
|
| 636 | - 'file' => array( |
|
| 637 | - 'field_type' => 'file', |
|
| 638 | - 'class' => 'gd-file', |
|
| 639 | - 'icon' => 'fa fa-file', |
|
| 640 | - 'name' => __('File Upload', 'geodirectory'),
|
|
| 641 | - 'description' => __('Adds a file input', 'geodirectory')
|
|
| 642 | - ) |
|
| 643 | - ); |
|
| 644 | - |
|
| 645 | - /** |
|
| 646 | - * Filter the custom fields array to be able to add or remove items. |
|
| 647 | - * |
|
| 648 | - * @since 1.6.6 |
|
| 649 | - * |
|
| 650 | - * @param array $custom_fields {
|
|
| 651 | - * The custom fields array to be filtered. |
|
| 652 | - * |
|
| 653 | - * @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file. |
|
| 654 | - * @type string $class The class for the field in backend. |
|
| 655 | - * @type string $icon Can be font-awesome class name or icon image url. |
|
| 656 | - * @type string $name The name of the field. |
|
| 657 | - * @type string $description A short description about the field. |
|
| 658 | - * @type array $defaults {
|
|
| 659 | - * Optional. Used to set the default value of the field. |
|
| 660 | - * |
|
| 661 | - * @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE |
|
| 662 | - * @type int decimal_point limit if using FLOAT data_type |
|
| 663 | - * @type string admin_title The admin title for the field. |
|
| 664 | - * @type string site_title This will be the title for the field on the frontend. |
|
| 665 | - * @type string admin_desc This will be shown below the field on the add listing form. |
|
| 666 | - * @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters. |
|
| 667 | - * @type bool is_active If false the field will not be displayed anywhere. |
|
| 668 | - * @type bool for_admin_use If true then only site admin can see and edit this field. |
|
| 669 | - * @type string default_value The default value for the input on the add listing page. |
|
| 670 | - * @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble] |
|
| 671 | - * @type bool is_required If true the field will be required on the add listing page. |
|
| 672 | - * @type string option_values The option values for select and multiselect only |
|
| 673 | - * @type string validation_pattern HTML5 validation pattern (text input only by default). |
|
| 674 | - * @type string validation_msg HTML5 validation message (text input only by default). |
|
| 675 | - * @type string required_msg Required warning message. |
|
| 676 | - * @type string field_icon Icon url or font awesome class. |
|
| 677 | - * @type string css_class Field custom css class for field custom style. |
|
| 678 | - * @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option. |
|
| 679 | - * @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required) |
|
| 680 | - * } |
|
| 681 | - * } |
|
| 682 | - * @param string $post_type The post type requested. |
|
| 683 | - */ |
|
| 684 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 551 | + $custom_fields = array( |
|
| 552 | + 'text' => array( |
|
| 553 | + 'field_type' => 'text', |
|
| 554 | + 'class' => 'gd-text', |
|
| 555 | + 'icon' => 'fa fa-minus', |
|
| 556 | + 'name' => __('Text', 'geodirectory'),
|
|
| 557 | + 'description' => __('Add any sort of text field, text or numbers', 'geodirectory')
|
|
| 558 | + ), |
|
| 559 | + 'datepicker' => array( |
|
| 560 | + 'field_type' => 'datepicker', |
|
| 561 | + 'class' => 'gd-datepicker', |
|
| 562 | + 'icon' => 'fa fa-calendar', |
|
| 563 | + 'name' => __('Date', 'geodirectory'),
|
|
| 564 | + 'description' => __('Adds a date picker.', 'geodirectory')
|
|
| 565 | + ), |
|
| 566 | + 'textarea' => array( |
|
| 567 | + 'field_type' => 'textarea', |
|
| 568 | + 'class' => 'gd-textarea', |
|
| 569 | + 'icon' => 'fa fa-bars', |
|
| 570 | + 'name' => __('Textarea', 'geodirectory'),
|
|
| 571 | + 'description' => __('Adds a textarea', 'geodirectory')
|
|
| 572 | + ), |
|
| 573 | + 'time' => array( |
|
| 574 | + 'field_type' => 'time', |
|
| 575 | + 'class' => 'gd-time', |
|
| 576 | + 'icon' => 'fa fa-clock-o', |
|
| 577 | + 'name' => __('Time', 'geodirectory'),
|
|
| 578 | + 'description' => __('Adds a time picker', 'geodirectory')
|
|
| 579 | + ), |
|
| 580 | + 'checkbox' => array( |
|
| 581 | + 'field_type' => 'checkbox', |
|
| 582 | + 'class' => 'gd-checkbox', |
|
| 583 | + 'icon' => 'fa fa-check-square-o', |
|
| 584 | + 'name' => __('Checkbox', 'geodirectory'),
|
|
| 585 | + 'description' => __('Adds a checkbox', 'geodirectory')
|
|
| 586 | + ), |
|
| 587 | + 'phone' => array( |
|
| 588 | + 'field_type' => 'phone', |
|
| 589 | + 'class' => 'gd-phone', |
|
| 590 | + 'icon' => 'fa fa-phone', |
|
| 591 | + 'name' => __('Phone', 'geodirectory'),
|
|
| 592 | + 'description' => __('Adds a phone input', 'geodirectory')
|
|
| 593 | + ), |
|
| 594 | + 'radio' => array( |
|
| 595 | + 'field_type' => 'radio', |
|
| 596 | + 'class' => 'gd-radio', |
|
| 597 | + 'icon' => 'fa fa-dot-circle-o', |
|
| 598 | + 'name' => __('Radio', 'geodirectory'),
|
|
| 599 | + 'description' => __('Adds a radio input', 'geodirectory')
|
|
| 600 | + ), |
|
| 601 | + 'email' => array( |
|
| 602 | + 'field_type' => 'email', |
|
| 603 | + 'class' => 'gd-email', |
|
| 604 | + 'icon' => 'fa fa-envelope-o', |
|
| 605 | + 'name' => __('Email', 'geodirectory'),
|
|
| 606 | + 'description' => __('Adds a email input', 'geodirectory')
|
|
| 607 | + ), |
|
| 608 | + 'select' => array( |
|
| 609 | + 'field_type' => 'select', |
|
| 610 | + 'class' => 'gd-select', |
|
| 611 | + 'icon' => 'fa fa-caret-square-o-down', |
|
| 612 | + 'name' => __('Select', 'geodirectory'),
|
|
| 613 | + 'description' => __('Adds a select input', 'geodirectory')
|
|
| 614 | + ), |
|
| 615 | + 'multiselect' => array( |
|
| 616 | + 'field_type' => 'multiselect', |
|
| 617 | + 'class' => 'gd-multiselect', |
|
| 618 | + 'icon' => 'fa fa-caret-square-o-down', |
|
| 619 | + 'name' => __('Multi Select', 'geodirectory'),
|
|
| 620 | + 'description' => __('Adds a multiselect input', 'geodirectory')
|
|
| 621 | + ), |
|
| 622 | + 'url' => array( |
|
| 623 | + 'field_type' => 'url', |
|
| 624 | + 'class' => 'gd-url', |
|
| 625 | + 'icon' => 'fa fa-link', |
|
| 626 | + 'name' => __('URL', 'geodirectory'),
|
|
| 627 | + 'description' => __('Adds a url input', 'geodirectory')
|
|
| 628 | + ), |
|
| 629 | + 'html' => array( |
|
| 630 | + 'field_type' => 'html', |
|
| 631 | + 'class' => 'gd-html', |
|
| 632 | + 'icon' => 'fa fa-code', |
|
| 633 | + 'name' => __('HTML', 'geodirectory'),
|
|
| 634 | + 'description' => __('Adds a html input textarea', 'geodirectory')
|
|
| 635 | + ), |
|
| 636 | + 'file' => array( |
|
| 637 | + 'field_type' => 'file', |
|
| 638 | + 'class' => 'gd-file', |
|
| 639 | + 'icon' => 'fa fa-file', |
|
| 640 | + 'name' => __('File Upload', 'geodirectory'),
|
|
| 641 | + 'description' => __('Adds a file input', 'geodirectory')
|
|
| 642 | + ) |
|
| 643 | + ); |
|
| 644 | + |
|
| 645 | + /** |
|
| 646 | + * Filter the custom fields array to be able to add or remove items. |
|
| 647 | + * |
|
| 648 | + * @since 1.6.6 |
|
| 649 | + * |
|
| 650 | + * @param array $custom_fields {
|
|
| 651 | + * The custom fields array to be filtered. |
|
| 652 | + * |
|
| 653 | + * @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file. |
|
| 654 | + * @type string $class The class for the field in backend. |
|
| 655 | + * @type string $icon Can be font-awesome class name or icon image url. |
|
| 656 | + * @type string $name The name of the field. |
|
| 657 | + * @type string $description A short description about the field. |
|
| 658 | + * @type array $defaults {
|
|
| 659 | + * Optional. Used to set the default value of the field. |
|
| 660 | + * |
|
| 661 | + * @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE |
|
| 662 | + * @type int decimal_point limit if using FLOAT data_type |
|
| 663 | + * @type string admin_title The admin title for the field. |
|
| 664 | + * @type string site_title This will be the title for the field on the frontend. |
|
| 665 | + * @type string admin_desc This will be shown below the field on the add listing form. |
|
| 666 | + * @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters. |
|
| 667 | + * @type bool is_active If false the field will not be displayed anywhere. |
|
| 668 | + * @type bool for_admin_use If true then only site admin can see and edit this field. |
|
| 669 | + * @type string default_value The default value for the input on the add listing page. |
|
| 670 | + * @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble] |
|
| 671 | + * @type bool is_required If true the field will be required on the add listing page. |
|
| 672 | + * @type string option_values The option values for select and multiselect only |
|
| 673 | + * @type string validation_pattern HTML5 validation pattern (text input only by default). |
|
| 674 | + * @type string validation_msg HTML5 validation message (text input only by default). |
|
| 675 | + * @type string required_msg Required warning message. |
|
| 676 | + * @type string field_icon Icon url or font awesome class. |
|
| 677 | + * @type string css_class Field custom css class for field custom style. |
|
| 678 | + * @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option. |
|
| 679 | + * @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required) |
|
| 680 | + * } |
|
| 681 | + * } |
|
| 682 | + * @param string $post_type The post type requested. |
|
| 683 | + */ |
|
| 684 | + return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /** |
@@ -694,19 +694,19 @@ discard block |
||
| 694 | 694 | */ |
| 695 | 695 | function geodir_custom_available_fields($type='') |
| 696 | 696 | {
|
| 697 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 698 | - ?> |
|
| 697 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 698 | + ?> |
|
| 699 | 699 | <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
| 700 | 700 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
| 701 | 701 | |
| 702 | 702 | <?php |
| 703 | - if($type=='predefined'){
|
|
| 704 | - $cfs = geodir_custom_fields_predefined($listing_type); |
|
| 705 | - }elseif($type=='custom'){
|
|
| 706 | - $cfs = geodir_custom_fields_custom($listing_type); |
|
| 707 | - }else{
|
|
| 708 | - $cfs = geodir_custom_fields($listing_type); |
|
| 709 | - ?> |
|
| 703 | + if($type=='predefined'){
|
|
| 704 | + $cfs = geodir_custom_fields_predefined($listing_type); |
|
| 705 | + }elseif($type=='custom'){
|
|
| 706 | + $cfs = geodir_custom_fields_custom($listing_type); |
|
| 707 | + }else{
|
|
| 708 | + $cfs = geodir_custom_fields($listing_type); |
|
| 709 | + ?> |
|
| 710 | 710 | <ul class="full gd-cf-tooltip-wrap"> |
| 711 | 711 | <li> |
| 712 | 712 | <div class="gdcf-tooltip"> |
@@ -727,18 +727,18 @@ discard block |
||
| 727 | 727 | </ul> |
| 728 | 728 | |
| 729 | 729 | <?php |
| 730 | - } |
|
| 730 | + } |
|
| 731 | 731 | |
| 732 | - if(!empty($cfs)) {
|
|
| 733 | - echo '<ul>'; |
|
| 734 | - foreach ( $cfs as $id => $cf ) {
|
|
| 735 | - ?> |
|
| 732 | + if(!empty($cfs)) {
|
|
| 733 | + echo '<ul>'; |
|
| 734 | + foreach ( $cfs as $id => $cf ) {
|
|
| 735 | + ?> |
|
| 736 | 736 | |
| 737 | 737 | <li class="gd-cf-tooltip-wrap"> |
| 738 | 738 | <?php |
| 739 | - if ( isset( $cf['description'] ) && $cf['description'] ) {
|
|
| 740 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
| 741 | - } ?> |
|
| 739 | + if ( isset( $cf['description'] ) && $cf['description'] ) {
|
|
| 740 | + echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
| 741 | + } ?> |
|
| 742 | 742 | |
| 743 | 743 | <a id="gd-<?php echo $id; ?>" |
| 744 | 744 | data-field-custom-type="<?php echo $type; ?>" |
@@ -748,21 +748,21 @@ discard block |
||
| 748 | 748 | href="javascript:void(0);"> |
| 749 | 749 | |
| 750 | 750 | <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
|
| 751 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
| 752 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
|
|
| 753 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
|
|
| 754 | - } else {
|
|
| 755 | - echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 756 | - } ?> |
|
| 751 | + echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
| 752 | + } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
|
|
| 753 | + echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
|
|
| 754 | + } else {
|
|
| 755 | + echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 756 | + } ?> |
|
| 757 | 757 | <?php echo $cf['name']; ?> |
| 758 | 758 | </a> |
| 759 | 759 | </li> |
| 760 | 760 | <?php |
| 761 | - } |
|
| 762 | - }else{
|
|
| 763 | - _e('There are no custom fields here yet.', 'geodirectory');
|
|
| 764 | - } |
|
| 765 | - ?> |
|
| 761 | + } |
|
| 762 | + }else{
|
|
| 763 | + _e('There are no custom fields here yet.', 'geodirectory');
|
|
| 764 | + } |
|
| 765 | + ?> |
|
| 766 | 766 | |
| 767 | 767 | |
| 768 | 768 | </ul> |
@@ -781,26 +781,26 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | function geodir_custom_selected_fields() |
| 783 | 783 | {
|
| 784 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 785 | - ?> |
|
| 784 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 785 | + ?> |
|
| 786 | 786 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 787 | 787 | <ul class="core"> |
| 788 | 788 | <?php |
| 789 | - global $wpdb; |
|
| 790 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 791 | - |
|
| 792 | - if (!empty($fields)) {
|
|
| 793 | - foreach ($fields as $field) {
|
|
| 794 | - //$result_str = $field->id; |
|
| 795 | - $result_str = $field; |
|
| 796 | - $field_type = $field->field_type; |
|
| 797 | - $field_type_key = $field->field_type_key; |
|
| 798 | - $field_ins_upd = 'display'; |
|
| 799 | - |
|
| 800 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 801 | - } |
|
| 802 | - } |
|
| 803 | - ?></ul> |
|
| 789 | + global $wpdb; |
|
| 790 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 791 | + |
|
| 792 | + if (!empty($fields)) {
|
|
| 793 | + foreach ($fields as $field) {
|
|
| 794 | + //$result_str = $field->id; |
|
| 795 | + $result_str = $field; |
|
| 796 | + $field_type = $field->field_type; |
|
| 797 | + $field_type_key = $field->field_type_key; |
|
| 798 | + $field_ins_upd = 'display'; |
|
| 799 | + |
|
| 800 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 801 | + } |
|
| 802 | + } |
|
| 803 | + ?></ul> |
|
| 804 | 804 | <?php |
| 805 | 805 | |
| 806 | 806 | } |
@@ -819,16 +819,16 @@ discard block |
||
| 819 | 819 | function geodir_custom_fields_panel_head($heading, $sub_tab, $listing_type) |
| 820 | 820 | {
|
| 821 | 821 | |
| 822 | - switch ($sub_tab) {
|
|
| 823 | - case 'custom_fields': |
|
| 824 | - $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 825 | - break; |
|
| 822 | + switch ($sub_tab) {
|
|
| 823 | + case 'custom_fields': |
|
| 824 | + $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 825 | + break; |
|
| 826 | 826 | |
| 827 | - case 'sorting_options': |
|
| 828 | - $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 829 | - break; |
|
| 830 | - } |
|
| 831 | - return $heading; |
|
| 827 | + case 'sorting_options': |
|
| 828 | + $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 829 | + break; |
|
| 830 | + } |
|
| 831 | + return $heading; |
|
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | |
@@ -846,16 +846,16 @@ discard block |
||
| 846 | 846 | function geodir_cf_panel_available_fields_head($heading, $sub_tab, $listing_type) |
| 847 | 847 | {
|
| 848 | 848 | |
| 849 | - switch ($sub_tab) {
|
|
| 850 | - case 'custom_fields': |
|
| 851 | - $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 852 | - break; |
|
| 849 | + switch ($sub_tab) {
|
|
| 850 | + case 'custom_fields': |
|
| 851 | + $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 852 | + break; |
|
| 853 | 853 | |
| 854 | - case 'sorting_options': |
|
| 855 | - $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 856 | - break; |
|
| 857 | - } |
|
| 858 | - return $heading; |
|
| 854 | + case 'sorting_options': |
|
| 855 | + $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 856 | + break; |
|
| 857 | + } |
|
| 858 | + return $heading; |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | |
@@ -873,16 +873,16 @@ discard block |
||
| 873 | 873 | function geodir_cf_panel_available_fields_note($note, $sub_tab, $listing_type) |
| 874 | 874 | {
|
| 875 | 875 | |
| 876 | - switch ($sub_tab) {
|
|
| 877 | - case 'custom_fields': |
|
| 878 | - $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 879 | - break; |
|
| 876 | + switch ($sub_tab) {
|
|
| 877 | + case 'custom_fields': |
|
| 878 | + $note = sprintf(__('Click on any box below to add a field of that type to the add %s listing form. You can use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 879 | + break; |
|
| 880 | 880 | |
| 881 | - case 'sorting_options': |
|
| 882 | - $note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 883 | - break; |
|
| 884 | - } |
|
| 885 | - return $note; |
|
| 881 | + case 'sorting_options': |
|
| 882 | + $note = sprintf(__('Click on any box below to make it appear in the sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 883 | + break; |
|
| 884 | + } |
|
| 885 | + return $note; |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | |
@@ -900,16 +900,16 @@ discard block |
||
| 900 | 900 | function geodir_cf_panel_selected_fields_head($heading, $sub_tab, $listing_type) |
| 901 | 901 | {
|
| 902 | 902 | |
| 903 | - switch ($sub_tab) {
|
|
| 904 | - case 'custom_fields': |
|
| 905 | - $heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 906 | - break; |
|
| 903 | + switch ($sub_tab) {
|
|
| 904 | + case 'custom_fields': |
|
| 905 | + $heading = sprintf(__('List of fields that will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 906 | + break; |
|
| 907 | 907 | |
| 908 | - case 'sorting_options': |
|
| 909 | - $heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 910 | - break; |
|
| 911 | - } |
|
| 912 | - return $heading; |
|
| 908 | + case 'sorting_options': |
|
| 909 | + $heading = sprintf(__('List of fields that will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 910 | + break; |
|
| 911 | + } |
|
| 912 | + return $heading; |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | |
@@ -927,16 +927,16 @@ discard block |
||
| 927 | 927 | function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type) |
| 928 | 928 | {
|
| 929 | 929 | |
| 930 | - switch ($sub_tab) {
|
|
| 931 | - case 'custom_fields': |
|
| 932 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 933 | - break; |
|
| 930 | + switch ($sub_tab) {
|
|
| 931 | + case 'custom_fields': |
|
| 932 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 933 | + break; |
|
| 934 | 934 | |
| 935 | - case 'sorting_options': |
|
| 936 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 937 | - break; |
|
| 938 | - } |
|
| 939 | - return $note; |
|
| 935 | + case 'sorting_options': |
|
| 936 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type, false, true));
|
|
| 937 | + break; |
|
| 938 | + } |
|
| 939 | + return $note; |
|
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | |
@@ -952,16 +952,16 @@ discard block |
||
| 952 | 952 | */ |
| 953 | 953 | function geodir_remove_unnecessary_fields() |
| 954 | 954 | {
|
| 955 | - global $wpdb, $plugin_prefix; |
|
| 955 | + global $wpdb, $plugin_prefix; |
|
| 956 | 956 | |
| 957 | - if (!get_option('geodir_remove_unnecessary_fields')) {
|
|
| 957 | + if (!get_option('geodir_remove_unnecessary_fields')) {
|
|
| 958 | 958 | |
| 959 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 959 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 961 | 961 | |
| 962 | - update_option('geodir_remove_unnecessary_fields', '1');
|
|
| 962 | + update_option('geodir_remove_unnecessary_fields', '1');
|
|
| 963 | 963 | |
| 964 | - } |
|
| 964 | + } |
|
| 965 | 965 | |
| 966 | 966 | } |
| 967 | 967 | |
@@ -979,28 +979,28 @@ discard block |
||
| 979 | 979 | */ |
| 980 | 980 | function geodir_admin_ajax_handler() |
| 981 | 981 | {
|
| 982 | - if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
|
|
| 983 | - $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
|
| 984 | - $diagnose_this = ""; |
|
| 985 | - switch ($geodir_admin_ajax_action) {
|
|
| 986 | - case 'diagnosis' : |
|
| 987 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
|
| 988 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 989 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 990 | - |
|
| 991 | - } |
|
| 992 | - exit(); |
|
| 993 | - break; |
|
| 994 | - |
|
| 995 | - case 'diagnosis-fix' : |
|
| 996 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 997 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 998 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 999 | - exit(); |
|
| 1000 | - break; |
|
| 1001 | - } |
|
| 1002 | - } |
|
| 1003 | - exit(); |
|
| 982 | + if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
|
|
| 983 | + $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
|
| 984 | + $diagnose_this = ""; |
|
| 985 | + switch ($geodir_admin_ajax_action) {
|
|
| 986 | + case 'diagnosis' : |
|
| 987 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
|
| 988 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 989 | + call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 990 | + |
|
| 991 | + } |
|
| 992 | + exit(); |
|
| 993 | + break; |
|
| 994 | + |
|
| 995 | + case 'diagnosis-fix' : |
|
| 996 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 997 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 998 | + call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 999 | + exit(); |
|
| 1000 | + break; |
|
| 1001 | + } |
|
| 1002 | + } |
|
| 1003 | + exit(); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | |
@@ -1018,127 +1018,127 @@ discard block |
||
| 1018 | 1018 | */ |
| 1019 | 1019 | function geodir_diagnose_multisite_table($filter_arr, $table, $tabel_name, $fix) |
| 1020 | 1020 | {
|
| 1021 | - global $wpdb; |
|
| 1022 | - //$filter_arr['output_str'] .='###'.$table.'###'; |
|
| 1023 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 1024 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 1025 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1026 | - |
|
| 1027 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1028 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1029 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1030 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
|
|
| 1031 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1032 | - |
|
| 1033 | - if ($fix) {
|
|
| 1034 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 1035 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 1036 | - |
|
| 1037 | - if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
|
| 1038 | - //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
|
| 1039 | - |
|
| 1040 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 1041 | - |
|
| 1042 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1043 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 1044 | - } else {
|
|
| 1045 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1046 | - } |
|
| 1047 | - |
|
| 1048 | - } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
|
| 1049 | - |
|
| 1050 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 1051 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 1052 | - |
|
| 1053 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1055 | - } else {
|
|
| 1056 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1057 | - } |
|
| 1058 | - |
|
| 1059 | - } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
|
| 1060 | - |
|
| 1061 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 1062 | - |
|
| 1063 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1064 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 1065 | - } else {
|
|
| 1066 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1067 | - } |
|
| 1068 | - |
|
| 1069 | - } |
|
| 1070 | - |
|
| 1071 | - } |
|
| 1072 | - |
|
| 1073 | - |
|
| 1074 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1075 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1076 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1077 | - |
|
| 1078 | - if ($fix) {
|
|
| 1079 | - if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
|
| 1080 | - if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
|
| 1081 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1082 | - } else {
|
|
| 1083 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1084 | - } |
|
| 1085 | - |
|
| 1086 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1088 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1089 | - } else {
|
|
| 1090 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1091 | - } |
|
| 1092 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1094 | - } else {
|
|
| 1095 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1096 | - } |
|
| 1097 | - } else {// else rename the original table to _ms_bak
|
|
| 1098 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1100 | - } else {
|
|
| 1101 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1102 | - } |
|
| 1103 | - } |
|
| 1104 | - } |
|
| 1105 | - |
|
| 1106 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1107 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1108 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1109 | - |
|
| 1110 | - if ($fix) {
|
|
| 1111 | - // if original table exists but new does not, rename |
|
| 1112 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1114 | - } else {
|
|
| 1115 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1116 | - } |
|
| 1117 | - |
|
| 1118 | - } |
|
| 1119 | - |
|
| 1120 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1121 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1122 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1123 | - |
|
| 1124 | - if ($fix) {
|
|
| 1125 | - // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run; |
|
| 1126 | - delete_option('geodirlocation_db_version');
|
|
| 1127 | - delete_option('geodirevents_db_version');
|
|
| 1128 | - delete_option('geodir_reviewrating_db_version');
|
|
| 1129 | - delete_option('gdevents_db_version');
|
|
| 1130 | - delete_option('geodirectory_db_version');
|
|
| 1131 | - delete_option('geodirclaim_db_version');
|
|
| 1132 | - delete_option('geodir_custom_posts_db_version');
|
|
| 1133 | - delete_option('geodir_reviewratings_db_version');
|
|
| 1134 | - delete_option('geodiradvancesearch_db_version');
|
|
| 1135 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1136 | - } |
|
| 1137 | - |
|
| 1138 | - } else {
|
|
| 1139 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1140 | - } |
|
| 1141 | - return $filter_arr; |
|
| 1021 | + global $wpdb; |
|
| 1022 | + //$filter_arr['output_str'] .='###'.$table.'###'; |
|
| 1023 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 1024 | + $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 1025 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1026 | + |
|
| 1027 | + } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1028 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1029 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1030 | + $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
|
|
| 1031 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1032 | + |
|
| 1033 | + if ($fix) {
|
|
| 1034 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 1035 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 1036 | + |
|
| 1037 | + if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
|
| 1038 | + //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
|
| 1039 | + |
|
| 1040 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 1041 | + |
|
| 1042 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1043 | + $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 1044 | + } else {
|
|
| 1045 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1046 | + } |
|
| 1047 | + |
|
| 1048 | + } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
|
| 1049 | + |
|
| 1050 | + $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 1051 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 1052 | + |
|
| 1053 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1055 | + } else {
|
|
| 1056 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1057 | + } |
|
| 1058 | + |
|
| 1059 | + } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
|
| 1060 | + |
|
| 1061 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 1062 | + |
|
| 1063 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1064 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 1065 | + } else {
|
|
| 1066 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1067 | + } |
|
| 1068 | + |
|
| 1069 | + } |
|
| 1070 | + |
|
| 1071 | + } |
|
| 1072 | + |
|
| 1073 | + |
|
| 1074 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1075 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1076 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1077 | + |
|
| 1078 | + if ($fix) {
|
|
| 1079 | + if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
|
| 1080 | + if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
|
| 1081 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1082 | + } else {
|
|
| 1083 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1084 | + } |
|
| 1085 | + |
|
| 1086 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | + if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1088 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1089 | + } else {
|
|
| 1090 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1091 | + } |
|
| 1092 | + if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1094 | + } else {
|
|
| 1095 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1096 | + } |
|
| 1097 | + } else {// else rename the original table to _ms_bak
|
|
| 1098 | + if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1100 | + } else {
|
|
| 1101 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1102 | + } |
|
| 1103 | + } |
|
| 1104 | + } |
|
| 1105 | + |
|
| 1106 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1107 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1108 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1109 | + |
|
| 1110 | + if ($fix) {
|
|
| 1111 | + // if original table exists but new does not, rename |
|
| 1112 | + if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1114 | + } else {
|
|
| 1115 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1116 | + } |
|
| 1117 | + |
|
| 1118 | + } |
|
| 1119 | + |
|
| 1120 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1121 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1122 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1123 | + |
|
| 1124 | + if ($fix) {
|
|
| 1125 | + // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run; |
|
| 1126 | + delete_option('geodirlocation_db_version');
|
|
| 1127 | + delete_option('geodirevents_db_version');
|
|
| 1128 | + delete_option('geodir_reviewrating_db_version');
|
|
| 1129 | + delete_option('gdevents_db_version');
|
|
| 1130 | + delete_option('geodirectory_db_version');
|
|
| 1131 | + delete_option('geodirclaim_db_version');
|
|
| 1132 | + delete_option('geodir_custom_posts_db_version');
|
|
| 1133 | + delete_option('geodir_reviewratings_db_version');
|
|
| 1134 | + delete_option('geodiradvancesearch_db_version');
|
|
| 1135 | + $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1136 | + } |
|
| 1137 | + |
|
| 1138 | + } else {
|
|
| 1139 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1140 | + } |
|
| 1141 | + return $filter_arr; |
|
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | 1144 | |
@@ -1152,111 +1152,111 @@ discard block |
||
| 1152 | 1152 | */ |
| 1153 | 1153 | function geodir_diagnose_tags_sync() |
| 1154 | 1154 | {
|
| 1155 | - global $wpdb, $plugin_prefix; |
|
| 1156 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1157 | - $step = isset($_POST['step']) ? strip_tags(esc_sql($_POST['step'])) : 0; |
|
| 1158 | - $step_max_items = geodir_get_diagnose_step_max_items(); |
|
| 1159 | - $offset = (int) $step * $step_max_items; |
|
| 1160 | - $ptype = isset($_POST['ptype']) ? strip_tags(esc_sql($_POST['ptype'])) : false; |
|
| 1161 | - |
|
| 1162 | - $total_listings = geodir_total_listings_count(); |
|
| 1163 | - $total_ptype_listings = 0; |
|
| 1164 | - if ($ptype) {
|
|
| 1165 | - $total_ptype_listings = geodir_total_listings_count($ptype); |
|
| 1166 | - } |
|
| 1167 | - $max_step = ceil($total_ptype_listings / $step_max_items) - 1; |
|
| 1155 | + global $wpdb, $plugin_prefix; |
|
| 1156 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1157 | + $step = isset($_POST['step']) ? strip_tags(esc_sql($_POST['step'])) : 0; |
|
| 1158 | + $step_max_items = geodir_get_diagnose_step_max_items(); |
|
| 1159 | + $offset = (int) $step * $step_max_items; |
|
| 1160 | + $ptype = isset($_POST['ptype']) ? strip_tags(esc_sql($_POST['ptype'])) : false; |
|
| 1161 | + |
|
| 1162 | + $total_listings = geodir_total_listings_count(); |
|
| 1163 | + $total_ptype_listings = 0; |
|
| 1164 | + if ($ptype) {
|
|
| 1165 | + $total_ptype_listings = geodir_total_listings_count($ptype); |
|
| 1166 | + } |
|
| 1167 | + $max_step = ceil($total_ptype_listings / $step_max_items) - 1; |
|
| 1168 | 1168 | |
| 1169 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1170 | - $is_error_during_diagnose = false; |
|
| 1171 | - $output_str = ''; |
|
| 1169 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1170 | + $is_error_during_diagnose = false; |
|
| 1171 | + $output_str = ''; |
|
| 1172 | 1172 | |
| 1173 | - if ($ptype && !empty($ptype) && $total_listings > $step_max_items) {
|
|
| 1174 | - $stepped_process = true; |
|
| 1175 | - } else {
|
|
| 1176 | - $stepped_process = false; |
|
| 1177 | - } |
|
| 1178 | - |
|
| 1179 | - if ($stepped_process) {
|
|
| 1180 | - $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset ); |
|
| 1181 | - $posts = $wpdb->get_results( $sql ); |
|
| 1182 | - |
|
| 1183 | - if (!empty($posts)) {
|
|
| 1184 | - |
|
| 1185 | - foreach ($posts as $p) {
|
|
| 1186 | - $p->post_type = $ptype; |
|
| 1187 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1188 | - if (empty($raw_tags)) {
|
|
| 1189 | - $post_tags = ''; |
|
| 1190 | - } else {
|
|
| 1191 | - $post_tags = implode(",", $raw_tags);
|
|
| 1192 | - } |
|
| 1193 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1194 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1195 | - |
|
| 1196 | - } |
|
| 1197 | - if ($step >= $max_step) {
|
|
| 1198 | - $output_str = "done"; |
|
| 1199 | - } else {
|
|
| 1200 | - $output_str = $step + 1; |
|
| 1201 | - } |
|
| 1202 | - } |
|
| 1203 | - |
|
| 1204 | - } else {
|
|
| 1205 | - $all_postypes = geodir_get_posttypes(); |
|
| 1206 | - |
|
| 1207 | - if (!empty($all_postypes)) {
|
|
| 1208 | - foreach ($all_postypes as $key) {
|
|
| 1209 | - // update each GD CPT |
|
| 1210 | - $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1211 | - |
|
| 1212 | - if (!empty($posts)) {
|
|
| 1213 | - |
|
| 1214 | - foreach ($posts as $p) {
|
|
| 1215 | - $p->post_type = $key; |
|
| 1216 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1217 | - if (empty($raw_tags)) {
|
|
| 1218 | - $post_tags = ''; |
|
| 1219 | - } else {
|
|
| 1220 | - $post_tags = implode(",", $raw_tags);
|
|
| 1221 | - } |
|
| 1222 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1223 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1224 | - |
|
| 1225 | - } |
|
| 1226 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1227 | - } |
|
| 1228 | - |
|
| 1229 | - } |
|
| 1230 | - |
|
| 1231 | - } |
|
| 1232 | - } |
|
| 1233 | - |
|
| 1234 | - |
|
| 1235 | - if ($is_error_during_diagnose) {
|
|
| 1236 | - $info_div_class = "geodir_problem_info"; |
|
| 1237 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1238 | - } else {
|
|
| 1239 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1240 | - $fix_button_txt = ''; |
|
| 1241 | - } |
|
| 1242 | - |
|
| 1243 | - if ($stepped_process) {
|
|
| 1244 | - $percent = ($step/$max_step) * 100; |
|
| 1245 | - if ($output_str == 'done') {
|
|
| 1246 | - echo $output_str; |
|
| 1247 | - } else {
|
|
| 1248 | - $output = array( |
|
| 1249 | - 'step' => $output_str, |
|
| 1250 | - 'percent' => $percent |
|
| 1251 | - ); |
|
| 1252 | - echo json_encode($output); |
|
| 1253 | - } |
|
| 1254 | - } else {
|
|
| 1255 | - echo "<ul class='$info_div_class'>"; |
|
| 1256 | - echo $output_str; |
|
| 1257 | - echo $fix_button_txt; |
|
| 1258 | - echo "</ul>"; |
|
| 1259 | - } |
|
| 1173 | + if ($ptype && !empty($ptype) && $total_listings > $step_max_items) {
|
|
| 1174 | + $stepped_process = true; |
|
| 1175 | + } else {
|
|
| 1176 | + $stepped_process = false; |
|
| 1177 | + } |
|
| 1178 | + |
|
| 1179 | + if ($stepped_process) {
|
|
| 1180 | + $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset ); |
|
| 1181 | + $posts = $wpdb->get_results( $sql ); |
|
| 1182 | + |
|
| 1183 | + if (!empty($posts)) {
|
|
| 1184 | + |
|
| 1185 | + foreach ($posts as $p) {
|
|
| 1186 | + $p->post_type = $ptype; |
|
| 1187 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1188 | + if (empty($raw_tags)) {
|
|
| 1189 | + $post_tags = ''; |
|
| 1190 | + } else {
|
|
| 1191 | + $post_tags = implode(",", $raw_tags);
|
|
| 1192 | + } |
|
| 1193 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1194 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1195 | + |
|
| 1196 | + } |
|
| 1197 | + if ($step >= $max_step) {
|
|
| 1198 | + $output_str = "done"; |
|
| 1199 | + } else {
|
|
| 1200 | + $output_str = $step + 1; |
|
| 1201 | + } |
|
| 1202 | + } |
|
| 1203 | + |
|
| 1204 | + } else {
|
|
| 1205 | + $all_postypes = geodir_get_posttypes(); |
|
| 1206 | + |
|
| 1207 | + if (!empty($all_postypes)) {
|
|
| 1208 | + foreach ($all_postypes as $key) {
|
|
| 1209 | + // update each GD CPT |
|
| 1210 | + $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1211 | + |
|
| 1212 | + if (!empty($posts)) {
|
|
| 1213 | + |
|
| 1214 | + foreach ($posts as $p) {
|
|
| 1215 | + $p->post_type = $key; |
|
| 1216 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1217 | + if (empty($raw_tags)) {
|
|
| 1218 | + $post_tags = ''; |
|
| 1219 | + } else {
|
|
| 1220 | + $post_tags = implode(",", $raw_tags);
|
|
| 1221 | + } |
|
| 1222 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1223 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1224 | + |
|
| 1225 | + } |
|
| 1226 | + $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1227 | + } |
|
| 1228 | + |
|
| 1229 | + } |
|
| 1230 | + |
|
| 1231 | + } |
|
| 1232 | + } |
|
| 1233 | + |
|
| 1234 | + |
|
| 1235 | + if ($is_error_during_diagnose) {
|
|
| 1236 | + $info_div_class = "geodir_problem_info"; |
|
| 1237 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1238 | + } else {
|
|
| 1239 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1240 | + $fix_button_txt = ''; |
|
| 1241 | + } |
|
| 1242 | + |
|
| 1243 | + if ($stepped_process) {
|
|
| 1244 | + $percent = ($step/$max_step) * 100; |
|
| 1245 | + if ($output_str == 'done') {
|
|
| 1246 | + echo $output_str; |
|
| 1247 | + } else {
|
|
| 1248 | + $output = array( |
|
| 1249 | + 'step' => $output_str, |
|
| 1250 | + 'percent' => $percent |
|
| 1251 | + ); |
|
| 1252 | + echo json_encode($output); |
|
| 1253 | + } |
|
| 1254 | + } else {
|
|
| 1255 | + echo "<ul class='$info_div_class'>"; |
|
| 1256 | + echo $output_str; |
|
| 1257 | + echo $fix_button_txt; |
|
| 1258 | + echo "</ul>"; |
|
| 1259 | + } |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | /** |
@@ -1271,75 +1271,75 @@ discard block |
||
| 1271 | 1271 | */ |
| 1272 | 1272 | function geodir_diagnose_cats_sync() |
| 1273 | 1273 | {
|
| 1274 | - global $wpdb, $plugin_prefix; |
|
| 1275 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1274 | + global $wpdb, $plugin_prefix; |
|
| 1275 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1276 | 1276 | |
| 1277 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1278 | - $is_error_during_diagnose = false; |
|
| 1279 | - $output_str = ''; |
|
| 1277 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1278 | + $is_error_during_diagnose = false; |
|
| 1279 | + $output_str = ''; |
|
| 1280 | 1280 | |
| 1281 | 1281 | |
| 1282 | - $all_postypes = geodir_get_posttypes(); |
|
| 1282 | + $all_postypes = geodir_get_posttypes(); |
|
| 1283 | 1283 | |
| 1284 | - if (!empty($all_postypes)) {
|
|
| 1285 | - foreach ($all_postypes as $key) {
|
|
| 1286 | - // update each GD CTP |
|
| 1287 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1284 | + if (!empty($all_postypes)) {
|
|
| 1285 | + foreach ($all_postypes as $key) {
|
|
| 1286 | + // update each GD CTP |
|
| 1287 | + $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1288 | 1288 | |
| 1289 | - if (!empty($posts)) {
|
|
| 1289 | + if (!empty($posts)) {
|
|
| 1290 | 1290 | |
| 1291 | - foreach ($posts as $p) {
|
|
| 1292 | - $p->post_type = $key; |
|
| 1293 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1291 | + foreach ($posts as $p) {
|
|
| 1292 | + $p->post_type = $key; |
|
| 1293 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1294 | 1294 | |
| 1295 | - if (empty($raw_cats)) {
|
|
| 1296 | - $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
|
| 1295 | + if (empty($raw_cats)) {
|
|
| 1296 | + $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
|
| 1297 | 1297 | |
| 1298 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1299 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1300 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1301 | - if (is_numeric($cat_part)) {
|
|
| 1302 | - $raw_cats[] = (int)$cat_part; |
|
| 1303 | - } |
|
| 1304 | - } |
|
| 1298 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1299 | + $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1300 | + foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1301 | + if (is_numeric($cat_part)) {
|
|
| 1302 | + $raw_cats[] = (int)$cat_part; |
|
| 1303 | + } |
|
| 1304 | + } |
|
| 1305 | 1305 | |
| 1306 | - } |
|
| 1306 | + } |
|
| 1307 | 1307 | |
| 1308 | - if (!empty($raw_cats)) {
|
|
| 1309 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1308 | + if (!empty($raw_cats)) {
|
|
| 1309 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1310 | 1310 | |
| 1311 | - } |
|
| 1311 | + } |
|
| 1312 | 1312 | |
| 1313 | - } |
|
| 1313 | + } |
|
| 1314 | 1314 | |
| 1315 | 1315 | |
| 1316 | - if (empty($raw_cats)) {
|
|
| 1317 | - $post_cats = ''; |
|
| 1318 | - } else {
|
|
| 1319 | - $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1320 | - } |
|
| 1321 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1322 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1323 | - } |
|
| 1316 | + if (empty($raw_cats)) {
|
|
| 1317 | + $post_cats = ''; |
|
| 1318 | + } else {
|
|
| 1319 | + $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1320 | + } |
|
| 1321 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1322 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1323 | + } |
|
| 1324 | 1324 | |
| 1325 | - } |
|
| 1326 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1325 | + } |
|
| 1326 | + $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1327 | 1327 | |
| 1328 | - } |
|
| 1328 | + } |
|
| 1329 | 1329 | |
| 1330 | - } |
|
| 1330 | + } |
|
| 1331 | 1331 | |
| 1332 | - if ($is_error_during_diagnose) {
|
|
| 1333 | - $info_div_class = "geodir_problem_info"; |
|
| 1334 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1335 | - } else {
|
|
| 1336 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1337 | - $fix_button_txt = ''; |
|
| 1338 | - } |
|
| 1339 | - echo "<ul class='$info_div_class'>"; |
|
| 1340 | - echo $output_str; |
|
| 1341 | - echo $fix_button_txt; |
|
| 1342 | - echo "</ul>"; |
|
| 1332 | + if ($is_error_during_diagnose) {
|
|
| 1333 | + $info_div_class = "geodir_problem_info"; |
|
| 1334 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1335 | + } else {
|
|
| 1336 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1337 | + $fix_button_txt = ''; |
|
| 1338 | + } |
|
| 1339 | + echo "<ul class='$info_div_class'>"; |
|
| 1340 | + echo $output_str; |
|
| 1341 | + echo $fix_button_txt; |
|
| 1342 | + echo "</ul>"; |
|
| 1343 | 1343 | |
| 1344 | 1344 | } |
| 1345 | 1345 | |
@@ -1353,61 +1353,61 @@ discard block |
||
| 1353 | 1353 | */ |
| 1354 | 1354 | function geodir_diagnose_version_clear() |
| 1355 | 1355 | {
|
| 1356 | - global $wpdb, $plugin_prefix; |
|
| 1357 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1358 | - |
|
| 1359 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1360 | - $is_error_during_diagnose = false; |
|
| 1361 | - $output_str = ''; |
|
| 1362 | - |
|
| 1363 | - |
|
| 1364 | - $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
|
|
| 1365 | - 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1366 | - 'GeoDirectory Framework' => 'gdf_db_version', |
|
| 1367 | - 'Advanced Search' => 'geodiradvancesearch_db_version', |
|
| 1368 | - 'Review Rating Manager' => 'geodir_reviewratings_db_version', |
|
| 1369 | - 'Claim Manager' => 'geodirclaim_db_version', |
|
| 1370 | - 'CPT Manager' => 'geodir_custom_posts_db_version', |
|
| 1371 | - 'Location Manager' => 'geodirlocation_db_version', |
|
| 1372 | - 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1373 | - 'Events Manager' => 'geodirevents_db_version', |
|
| 1374 | - ); |
|
| 1375 | - |
|
| 1376 | - /** |
|
| 1377 | - * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers. |
|
| 1378 | - * |
|
| 1379 | - * @since 1.0.0 |
|
| 1380 | - * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
|
|
| 1381 | - */ |
|
| 1382 | - $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
|
|
| 1383 | - |
|
| 1384 | - if (!empty($ver_arr)) {
|
|
| 1385 | - foreach ($ver_arr as $key => $val) {
|
|
| 1386 | - if (delete_option($val)) {
|
|
| 1387 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1388 | - } else {
|
|
| 1389 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1390 | - } |
|
| 1391 | - |
|
| 1392 | - } |
|
| 1393 | - |
|
| 1394 | - if ($output_str) {
|
|
| 1395 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1396 | - } |
|
| 1397 | - |
|
| 1398 | - } |
|
| 1399 | - |
|
| 1400 | - if ($is_error_during_diagnose) {
|
|
| 1401 | - $info_div_class = "geodir_problem_info"; |
|
| 1402 | - $fix_button_txt = ""; |
|
| 1403 | - } else {
|
|
| 1404 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1405 | - $fix_button_txt = ''; |
|
| 1406 | - } |
|
| 1407 | - echo "<ul class='$info_div_class'>"; |
|
| 1408 | - echo $output_str; |
|
| 1409 | - echo $fix_button_txt; |
|
| 1410 | - echo "</ul>"; |
|
| 1356 | + global $wpdb, $plugin_prefix; |
|
| 1357 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1358 | + |
|
| 1359 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1360 | + $is_error_during_diagnose = false; |
|
| 1361 | + $output_str = ''; |
|
| 1362 | + |
|
| 1363 | + |
|
| 1364 | + $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
|
|
| 1365 | + 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1366 | + 'GeoDirectory Framework' => 'gdf_db_version', |
|
| 1367 | + 'Advanced Search' => 'geodiradvancesearch_db_version', |
|
| 1368 | + 'Review Rating Manager' => 'geodir_reviewratings_db_version', |
|
| 1369 | + 'Claim Manager' => 'geodirclaim_db_version', |
|
| 1370 | + 'CPT Manager' => 'geodir_custom_posts_db_version', |
|
| 1371 | + 'Location Manager' => 'geodirlocation_db_version', |
|
| 1372 | + 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1373 | + 'Events Manager' => 'geodirevents_db_version', |
|
| 1374 | + ); |
|
| 1375 | + |
|
| 1376 | + /** |
|
| 1377 | + * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers. |
|
| 1378 | + * |
|
| 1379 | + * @since 1.0.0 |
|
| 1380 | + * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
|
|
| 1381 | + */ |
|
| 1382 | + $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
|
|
| 1383 | + |
|
| 1384 | + if (!empty($ver_arr)) {
|
|
| 1385 | + foreach ($ver_arr as $key => $val) {
|
|
| 1386 | + if (delete_option($val)) {
|
|
| 1387 | + $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1388 | + } else {
|
|
| 1389 | + $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1390 | + } |
|
| 1391 | + |
|
| 1392 | + } |
|
| 1393 | + |
|
| 1394 | + if ($output_str) {
|
|
| 1395 | + $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1396 | + } |
|
| 1397 | + |
|
| 1398 | + } |
|
| 1399 | + |
|
| 1400 | + if ($is_error_during_diagnose) {
|
|
| 1401 | + $info_div_class = "geodir_problem_info"; |
|
| 1402 | + $fix_button_txt = ""; |
|
| 1403 | + } else {
|
|
| 1404 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1405 | + $fix_button_txt = ''; |
|
| 1406 | + } |
|
| 1407 | + echo "<ul class='$info_div_class'>"; |
|
| 1408 | + echo $output_str; |
|
| 1409 | + echo $fix_button_txt; |
|
| 1410 | + echo "</ul>"; |
|
| 1411 | 1411 | |
| 1412 | 1412 | } |
| 1413 | 1413 | |
@@ -1421,59 +1421,59 @@ discard block |
||
| 1421 | 1421 | */ |
| 1422 | 1422 | function geodir_diagnose_ratings() |
| 1423 | 1423 | {
|
| 1424 | - global $wpdb; |
|
| 1425 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1426 | - |
|
| 1427 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1428 | - $is_error_during_diagnose = false; |
|
| 1429 | - $output_str = ''; |
|
| 1430 | - |
|
| 1431 | - // check review locations |
|
| 1432 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1434 | - $is_error_during_diagnose = true; |
|
| 1435 | - |
|
| 1436 | - if ($fix) {
|
|
| 1437 | - if (geodir_fix_review_location()) {
|
|
| 1438 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1439 | - } else {
|
|
| 1440 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1441 | - } |
|
| 1442 | - } |
|
| 1443 | - |
|
| 1444 | - } else {
|
|
| 1445 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1446 | - } |
|
| 1447 | - |
|
| 1448 | - // check review content |
|
| 1449 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1450 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1451 | - $is_error_during_diagnose = true; |
|
| 1452 | - |
|
| 1453 | - if ($fix) {
|
|
| 1454 | - if (geodir_fix_review_content()) {
|
|
| 1455 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1456 | - } else {
|
|
| 1457 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1458 | - } |
|
| 1459 | - } |
|
| 1460 | - |
|
| 1461 | - } else {
|
|
| 1462 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1463 | - } |
|
| 1464 | - |
|
| 1465 | - |
|
| 1466 | - if ($is_error_during_diagnose) {
|
|
| 1467 | - $info_div_class = "geodir_problem_info"; |
|
| 1468 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1469 | - } else {
|
|
| 1470 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1471 | - $fix_button_txt = ''; |
|
| 1472 | - } |
|
| 1473 | - echo "<ul class='$info_div_class'>"; |
|
| 1474 | - echo $output_str; |
|
| 1475 | - echo $fix_button_txt; |
|
| 1476 | - echo "</ul>"; |
|
| 1424 | + global $wpdb; |
|
| 1425 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1426 | + |
|
| 1427 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1428 | + $is_error_during_diagnose = false; |
|
| 1429 | + $output_str = ''; |
|
| 1430 | + |
|
| 1431 | + // check review locations |
|
| 1432 | + if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | + $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1434 | + $is_error_during_diagnose = true; |
|
| 1435 | + |
|
| 1436 | + if ($fix) {
|
|
| 1437 | + if (geodir_fix_review_location()) {
|
|
| 1438 | + $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1439 | + } else {
|
|
| 1440 | + $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1441 | + } |
|
| 1442 | + } |
|
| 1443 | + |
|
| 1444 | + } else {
|
|
| 1445 | + $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1446 | + } |
|
| 1447 | + |
|
| 1448 | + // check review content |
|
| 1449 | + if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1450 | + $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1451 | + $is_error_during_diagnose = true; |
|
| 1452 | + |
|
| 1453 | + if ($fix) {
|
|
| 1454 | + if (geodir_fix_review_content()) {
|
|
| 1455 | + $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1456 | + } else {
|
|
| 1457 | + $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1458 | + } |
|
| 1459 | + } |
|
| 1460 | + |
|
| 1461 | + } else {
|
|
| 1462 | + $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1463 | + } |
|
| 1464 | + |
|
| 1465 | + |
|
| 1466 | + if ($is_error_during_diagnose) {
|
|
| 1467 | + $info_div_class = "geodir_problem_info"; |
|
| 1468 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1469 | + } else {
|
|
| 1470 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1471 | + $fix_button_txt = ''; |
|
| 1472 | + } |
|
| 1473 | + echo "<ul class='$info_div_class'>"; |
|
| 1474 | + echo $output_str; |
|
| 1475 | + echo $fix_button_txt; |
|
| 1476 | + echo "</ul>"; |
|
| 1477 | 1477 | |
| 1478 | 1478 | } |
| 1479 | 1479 | |
@@ -1487,57 +1487,57 @@ discard block |
||
| 1487 | 1487 | */ |
| 1488 | 1488 | function geodir_diagnose_multisite_conversion() |
| 1489 | 1489 | {
|
| 1490 | - global $wpdb; |
|
| 1491 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1492 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1493 | - $is_error_during_diagnose = false; |
|
| 1494 | - $output_str = ''; |
|
| 1495 | - |
|
| 1496 | - $filter_arr = array(); |
|
| 1497 | - $filter_arr['output_str'] = $output_str; |
|
| 1498 | - $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose; |
|
| 1499 | - $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
|
|
| 1500 | - 'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
|
|
| 1501 | - 'geodir_post_icon' => __('Post icon', 'geodirectory'),
|
|
| 1502 | - 'geodir_attachments' => __('Attachments', 'geodirectory'),
|
|
| 1503 | - 'geodir_post_review' => __('Reviews', 'geodirectory'),
|
|
| 1504 | - 'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
|
|
| 1505 | - 'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
|
|
| 1506 | - ); |
|
| 1507 | - |
|
| 1508 | - // allow other addons to hook in and add their checks |
|
| 1509 | - |
|
| 1510 | - /** |
|
| 1511 | - * Filter the array of tables. |
|
| 1512 | - * |
|
| 1513 | - * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks. |
|
| 1514 | - * |
|
| 1515 | - * @since 1.0.0 |
|
| 1516 | - * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
|
|
| 1517 | - */ |
|
| 1518 | - $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
|
|
| 1519 | - |
|
| 1520 | - foreach ($table_arr as $table => $table_name) {
|
|
| 1521 | - // Diagnose table |
|
| 1522 | - $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix); |
|
| 1523 | - } |
|
| 1524 | - |
|
| 1525 | - |
|
| 1526 | - $output_str = $filter_arr['output_str']; |
|
| 1527 | - $is_error_during_diagnose = $filter_arr['is_error_during_diagnose']; |
|
| 1528 | - |
|
| 1529 | - |
|
| 1530 | - if ($is_error_during_diagnose) {
|
|
| 1531 | - $info_div_class = "geodir_problem_info"; |
|
| 1532 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1533 | - } else {
|
|
| 1534 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1535 | - $fix_button_txt = ''; |
|
| 1536 | - } |
|
| 1537 | - echo "<ul class='$info_div_class'>"; |
|
| 1538 | - echo $output_str; |
|
| 1539 | - echo $fix_button_txt; |
|
| 1540 | - echo "</ul>"; |
|
| 1490 | + global $wpdb; |
|
| 1491 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1492 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1493 | + $is_error_during_diagnose = false; |
|
| 1494 | + $output_str = ''; |
|
| 1495 | + |
|
| 1496 | + $filter_arr = array(); |
|
| 1497 | + $filter_arr['output_str'] = $output_str; |
|
| 1498 | + $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose; |
|
| 1499 | + $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
|
|
| 1500 | + 'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
|
|
| 1501 | + 'geodir_post_icon' => __('Post icon', 'geodirectory'),
|
|
| 1502 | + 'geodir_attachments' => __('Attachments', 'geodirectory'),
|
|
| 1503 | + 'geodir_post_review' => __('Reviews', 'geodirectory'),
|
|
| 1504 | + 'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
|
|
| 1505 | + 'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
|
|
| 1506 | + ); |
|
| 1507 | + |
|
| 1508 | + // allow other addons to hook in and add their checks |
|
| 1509 | + |
|
| 1510 | + /** |
|
| 1511 | + * Filter the array of tables. |
|
| 1512 | + * |
|
| 1513 | + * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks. |
|
| 1514 | + * |
|
| 1515 | + * @since 1.0.0 |
|
| 1516 | + * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
|
|
| 1517 | + */ |
|
| 1518 | + $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
|
|
| 1519 | + |
|
| 1520 | + foreach ($table_arr as $table => $table_name) {
|
|
| 1521 | + // Diagnose table |
|
| 1522 | + $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix); |
|
| 1523 | + } |
|
| 1524 | + |
|
| 1525 | + |
|
| 1526 | + $output_str = $filter_arr['output_str']; |
|
| 1527 | + $is_error_during_diagnose = $filter_arr['is_error_during_diagnose']; |
|
| 1528 | + |
|
| 1529 | + |
|
| 1530 | + if ($is_error_during_diagnose) {
|
|
| 1531 | + $info_div_class = "geodir_problem_info"; |
|
| 1532 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1533 | + } else {
|
|
| 1534 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1535 | + $fix_button_txt = ''; |
|
| 1536 | + } |
|
| 1537 | + echo "<ul class='$info_div_class'>"; |
|
| 1538 | + echo $output_str; |
|
| 1539 | + echo $fix_button_txt; |
|
| 1540 | + echo "</ul>"; |
|
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | 1543 | /** |
@@ -1555,39 +1555,39 @@ discard block |
||
| 1555 | 1555 | */ |
| 1556 | 1556 | function geodir_fix_virtual_page($slug, $page_title, $old_id, $option) |
| 1557 | 1557 | {
|
| 1558 | - global $wpdb, $current_user; |
|
| 1559 | - |
|
| 1560 | - if (!empty($old_id)) {
|
|
| 1561 | - wp_delete_post($old_id, true); |
|
| 1562 | - }//delete post if already there |
|
| 1563 | - else {
|
|
| 1564 | - $page_found = $wpdb->get_var( |
|
| 1565 | - $wpdb->prepare( |
|
| 1566 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1567 | - array($slug) |
|
| 1568 | - ) |
|
| 1569 | - ); |
|
| 1570 | - wp_delete_post($page_found, true); |
|
| 1571 | - |
|
| 1572 | - } |
|
| 1573 | - |
|
| 1574 | - $page_data = array( |
|
| 1575 | - 'post_status' => 'publish', |
|
| 1576 | - 'post_type' => 'page', |
|
| 1577 | - 'post_author' => $current_user->ID, |
|
| 1578 | - 'post_name' => $slug, |
|
| 1579 | - 'post_title' => $page_title, |
|
| 1580 | - 'post_content' => '', |
|
| 1581 | - 'post_parent' => 0, |
|
| 1582 | - 'comment_status' => 'closed' |
|
| 1583 | - ); |
|
| 1584 | - $page_id = wp_insert_post($page_data); |
|
| 1585 | - update_option($option, $page_id); |
|
| 1586 | - if ($page_id) {
|
|
| 1587 | - return true; |
|
| 1588 | - } else {
|
|
| 1589 | - return false; |
|
| 1590 | - } |
|
| 1558 | + global $wpdb, $current_user; |
|
| 1559 | + |
|
| 1560 | + if (!empty($old_id)) {
|
|
| 1561 | + wp_delete_post($old_id, true); |
|
| 1562 | + }//delete post if already there |
|
| 1563 | + else {
|
|
| 1564 | + $page_found = $wpdb->get_var( |
|
| 1565 | + $wpdb->prepare( |
|
| 1566 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1567 | + array($slug) |
|
| 1568 | + ) |
|
| 1569 | + ); |
|
| 1570 | + wp_delete_post($page_found, true); |
|
| 1571 | + |
|
| 1572 | + } |
|
| 1573 | + |
|
| 1574 | + $page_data = array( |
|
| 1575 | + 'post_status' => 'publish', |
|
| 1576 | + 'post_type' => 'page', |
|
| 1577 | + 'post_author' => $current_user->ID, |
|
| 1578 | + 'post_name' => $slug, |
|
| 1579 | + 'post_title' => $page_title, |
|
| 1580 | + 'post_content' => '', |
|
| 1581 | + 'post_parent' => 0, |
|
| 1582 | + 'comment_status' => 'closed' |
|
| 1583 | + ); |
|
| 1584 | + $page_id = wp_insert_post($page_data); |
|
| 1585 | + update_option($option, $page_id); |
|
| 1586 | + if ($page_id) {
|
|
| 1587 | + return true; |
|
| 1588 | + } else {
|
|
| 1589 | + return false; |
|
| 1590 | + } |
|
| 1591 | 1591 | } |
| 1592 | 1592 | |
| 1593 | 1593 | /** |
@@ -1599,212 +1599,212 @@ discard block |
||
| 1599 | 1599 | */ |
| 1600 | 1600 | function geodir_diagnose_default_pages() |
| 1601 | 1601 | {
|
| 1602 | - global $wpdb; |
|
| 1603 | - $is_error_during_diagnose = false; |
|
| 1604 | - $output_str = ''; |
|
| 1605 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1606 | - |
|
| 1607 | - ////////////////////////////////// |
|
| 1608 | - /* Diagnose GD Home Page Starts */ |
|
| 1609 | - ////////////////////////////////// |
|
| 1610 | - $option_value = get_option('geodir_home_page');
|
|
| 1611 | - $page = get_post($option_value); |
|
| 1612 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1613 | - |
|
| 1614 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1615 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1616 | - else {
|
|
| 1617 | - $is_error_during_diagnose = true; |
|
| 1618 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1619 | - if ($fix) {
|
|
| 1620 | - if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
|
| 1621 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1622 | - } else {
|
|
| 1623 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1624 | - } |
|
| 1625 | - } |
|
| 1626 | - } |
|
| 1627 | - |
|
| 1628 | - //////////////////////////////// |
|
| 1629 | - /* Diagnose GD Home Page Ends */ |
|
| 1630 | - //////////////////////////////// |
|
| 1631 | - |
|
| 1632 | - ////////////////////////////////// |
|
| 1633 | - /* Diagnose Add Listing Page Starts */ |
|
| 1634 | - ////////////////////////////////// |
|
| 1635 | - $option_value = get_option('geodir_add_listing_page');
|
|
| 1636 | - $page = get_post($option_value); |
|
| 1637 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1638 | - |
|
| 1639 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1640 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1641 | - else {
|
|
| 1642 | - $is_error_during_diagnose = true; |
|
| 1643 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1644 | - if ($fix) {
|
|
| 1645 | - if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
|
| 1646 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1647 | - } else {
|
|
| 1648 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1649 | - } |
|
| 1650 | - } |
|
| 1651 | - } |
|
| 1652 | - |
|
| 1653 | - //////////////////////////////// |
|
| 1654 | - /* Diagnose Add Listing Page Ends */ |
|
| 1655 | - //////////////////////////////// |
|
| 1656 | - |
|
| 1657 | - |
|
| 1658 | - ////////////////////////////////// |
|
| 1659 | - /* Diagnose Listing Preview Page Starts */ |
|
| 1660 | - ////////////////////////////////// |
|
| 1661 | - $option_value = get_option('geodir_preview_page');
|
|
| 1662 | - $page = get_post($option_value); |
|
| 1663 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1664 | - |
|
| 1665 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1666 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1667 | - else {
|
|
| 1668 | - $is_error_during_diagnose = true; |
|
| 1669 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1670 | - if ($fix) {
|
|
| 1671 | - if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
|
| 1672 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1673 | - } else {
|
|
| 1674 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1675 | - } |
|
| 1676 | - } |
|
| 1677 | - } |
|
| 1678 | - |
|
| 1679 | - //////////////////////////////// |
|
| 1680 | - /* Diagnose Listing Preview Page Ends */ |
|
| 1681 | - //////////////////////////////// |
|
| 1682 | - |
|
| 1683 | - ////////////////////////////////// |
|
| 1684 | - /* Diagnose Listing Success Page Starts */ |
|
| 1685 | - ////////////////////////////////// |
|
| 1686 | - $option_value = get_option('geodir_success_page');
|
|
| 1687 | - $page = get_post($option_value); |
|
| 1688 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1689 | - |
|
| 1690 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1691 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1692 | - else {
|
|
| 1693 | - $is_error_during_diagnose = true; |
|
| 1694 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1695 | - if ($fix) {
|
|
| 1696 | - if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
|
| 1697 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1698 | - } else {
|
|
| 1699 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1700 | - } |
|
| 1701 | - } |
|
| 1702 | - } |
|
| 1703 | - |
|
| 1704 | - //////////////////////////////// |
|
| 1705 | - /* Diagnose Listing Sucess Page Ends */ |
|
| 1706 | - //////////////////////////////// |
|
| 1707 | - |
|
| 1708 | - ////////////////////////////////// |
|
| 1709 | - /* Diagnose Info Page Starts */ |
|
| 1710 | - ////////////////////////////////// |
|
| 1711 | - $option_value = get_option('geodir_info_page');
|
|
| 1712 | - $page = get_post($option_value); |
|
| 1713 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1714 | - |
|
| 1715 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1716 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1717 | - else {
|
|
| 1718 | - $is_error_during_diagnose = true; |
|
| 1719 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1720 | - if ($fix) {
|
|
| 1721 | - if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
|
| 1722 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1723 | - } else {
|
|
| 1724 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1725 | - } |
|
| 1726 | - } |
|
| 1727 | - } |
|
| 1728 | - |
|
| 1729 | - //////////////////////////////// |
|
| 1730 | - /* Diagnose Info Page Ends */ |
|
| 1731 | - //////////////////////////////// |
|
| 1732 | - |
|
| 1733 | - ////////////////////////////////// |
|
| 1734 | - /* Diagnose Login Page Starts */ |
|
| 1735 | - ////////////////////////////////// |
|
| 1736 | - $option_value = get_option('geodir_login_page');
|
|
| 1737 | - $page = get_post($option_value); |
|
| 1738 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1739 | - |
|
| 1740 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1741 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1742 | - else {
|
|
| 1743 | - $is_error_during_diagnose = true; |
|
| 1744 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1745 | - if ($fix) {
|
|
| 1746 | - if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
|
| 1747 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1748 | - } else {
|
|
| 1749 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1750 | - } |
|
| 1751 | - } |
|
| 1752 | - } |
|
| 1753 | - |
|
| 1754 | - //////////////////////////////// |
|
| 1755 | - /* Diagnose Info Page Ends */ |
|
| 1756 | - //////////////////////////////// |
|
| 1757 | - |
|
| 1758 | - ////////////////////////////////// |
|
| 1759 | - /* Diagnose Location Page Starts */ |
|
| 1760 | - ////////////////////////////////// |
|
| 1761 | - $option_value = get_option('geodir_location_page');
|
|
| 1762 | - $page = get_post($option_value); |
|
| 1763 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1764 | - |
|
| 1765 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1766 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1767 | - else {
|
|
| 1768 | - $is_error_during_diagnose = true; |
|
| 1769 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1770 | - if ($fix) {
|
|
| 1771 | - if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
|
| 1772 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1773 | - } else {
|
|
| 1774 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1775 | - } |
|
| 1776 | - } |
|
| 1777 | - } |
|
| 1778 | - |
|
| 1779 | - //////////////////////////////// |
|
| 1780 | - /* Diagnose Location Page Ends */ |
|
| 1781 | - //////////////////////////////// |
|
| 1782 | - |
|
| 1783 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1784 | - /** |
|
| 1785 | - * This action is called at the end of the GD Tools page check function. |
|
| 1786 | - * |
|
| 1787 | - * @since 1.5.2 |
|
| 1788 | - */ |
|
| 1789 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1790 | - |
|
| 1791 | - $output_str = $page_chk_arr['output_str']; |
|
| 1792 | - $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
|
| 1793 | - |
|
| 1794 | - if ($is_error_during_diagnose) {
|
|
| 1795 | - if ($fix) {
|
|
| 1796 | - flush_rewrite_rules(); |
|
| 1797 | - } |
|
| 1798 | - $info_div_class = "geodir_problem_info"; |
|
| 1799 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1800 | - } else {
|
|
| 1801 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1802 | - $fix_button_txt = ''; |
|
| 1803 | - } |
|
| 1804 | - echo "<ul class='$info_div_class'>"; |
|
| 1805 | - echo $output_str; |
|
| 1806 | - echo $fix_button_txt; |
|
| 1807 | - echo "</ul>"; |
|
| 1602 | + global $wpdb; |
|
| 1603 | + $is_error_during_diagnose = false; |
|
| 1604 | + $output_str = ''; |
|
| 1605 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1606 | + |
|
| 1607 | + ////////////////////////////////// |
|
| 1608 | + /* Diagnose GD Home Page Starts */ |
|
| 1609 | + ////////////////////////////////// |
|
| 1610 | + $option_value = get_option('geodir_home_page');
|
|
| 1611 | + $page = get_post($option_value); |
|
| 1612 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1613 | + |
|
| 1614 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1615 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1616 | + else {
|
|
| 1617 | + $is_error_during_diagnose = true; |
|
| 1618 | + $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1619 | + if ($fix) {
|
|
| 1620 | + if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
|
| 1621 | + $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1622 | + } else {
|
|
| 1623 | + $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1624 | + } |
|
| 1625 | + } |
|
| 1626 | + } |
|
| 1627 | + |
|
| 1628 | + //////////////////////////////// |
|
| 1629 | + /* Diagnose GD Home Page Ends */ |
|
| 1630 | + //////////////////////////////// |
|
| 1631 | + |
|
| 1632 | + ////////////////////////////////// |
|
| 1633 | + /* Diagnose Add Listing Page Starts */ |
|
| 1634 | + ////////////////////////////////// |
|
| 1635 | + $option_value = get_option('geodir_add_listing_page');
|
|
| 1636 | + $page = get_post($option_value); |
|
| 1637 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1638 | + |
|
| 1639 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1640 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1641 | + else {
|
|
| 1642 | + $is_error_during_diagnose = true; |
|
| 1643 | + $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1644 | + if ($fix) {
|
|
| 1645 | + if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
|
| 1646 | + $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1647 | + } else {
|
|
| 1648 | + $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1649 | + } |
|
| 1650 | + } |
|
| 1651 | + } |
|
| 1652 | + |
|
| 1653 | + //////////////////////////////// |
|
| 1654 | + /* Diagnose Add Listing Page Ends */ |
|
| 1655 | + //////////////////////////////// |
|
| 1656 | + |
|
| 1657 | + |
|
| 1658 | + ////////////////////////////////// |
|
| 1659 | + /* Diagnose Listing Preview Page Starts */ |
|
| 1660 | + ////////////////////////////////// |
|
| 1661 | + $option_value = get_option('geodir_preview_page');
|
|
| 1662 | + $page = get_post($option_value); |
|
| 1663 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1664 | + |
|
| 1665 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1666 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1667 | + else {
|
|
| 1668 | + $is_error_during_diagnose = true; |
|
| 1669 | + $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1670 | + if ($fix) {
|
|
| 1671 | + if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
|
| 1672 | + $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1673 | + } else {
|
|
| 1674 | + $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1675 | + } |
|
| 1676 | + } |
|
| 1677 | + } |
|
| 1678 | + |
|
| 1679 | + //////////////////////////////// |
|
| 1680 | + /* Diagnose Listing Preview Page Ends */ |
|
| 1681 | + //////////////////////////////// |
|
| 1682 | + |
|
| 1683 | + ////////////////////////////////// |
|
| 1684 | + /* Diagnose Listing Success Page Starts */ |
|
| 1685 | + ////////////////////////////////// |
|
| 1686 | + $option_value = get_option('geodir_success_page');
|
|
| 1687 | + $page = get_post($option_value); |
|
| 1688 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1689 | + |
|
| 1690 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1691 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1692 | + else {
|
|
| 1693 | + $is_error_during_diagnose = true; |
|
| 1694 | + $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1695 | + if ($fix) {
|
|
| 1696 | + if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
|
| 1697 | + $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1698 | + } else {
|
|
| 1699 | + $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1700 | + } |
|
| 1701 | + } |
|
| 1702 | + } |
|
| 1703 | + |
|
| 1704 | + //////////////////////////////// |
|
| 1705 | + /* Diagnose Listing Sucess Page Ends */ |
|
| 1706 | + //////////////////////////////// |
|
| 1707 | + |
|
| 1708 | + ////////////////////////////////// |
|
| 1709 | + /* Diagnose Info Page Starts */ |
|
| 1710 | + ////////////////////////////////// |
|
| 1711 | + $option_value = get_option('geodir_info_page');
|
|
| 1712 | + $page = get_post($option_value); |
|
| 1713 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1714 | + |
|
| 1715 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1716 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1717 | + else {
|
|
| 1718 | + $is_error_during_diagnose = true; |
|
| 1719 | + $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1720 | + if ($fix) {
|
|
| 1721 | + if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
|
| 1722 | + $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1723 | + } else {
|
|
| 1724 | + $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1725 | + } |
|
| 1726 | + } |
|
| 1727 | + } |
|
| 1728 | + |
|
| 1729 | + //////////////////////////////// |
|
| 1730 | + /* Diagnose Info Page Ends */ |
|
| 1731 | + //////////////////////////////// |
|
| 1732 | + |
|
| 1733 | + ////////////////////////////////// |
|
| 1734 | + /* Diagnose Login Page Starts */ |
|
| 1735 | + ////////////////////////////////// |
|
| 1736 | + $option_value = get_option('geodir_login_page');
|
|
| 1737 | + $page = get_post($option_value); |
|
| 1738 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1739 | + |
|
| 1740 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1741 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1742 | + else {
|
|
| 1743 | + $is_error_during_diagnose = true; |
|
| 1744 | + $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1745 | + if ($fix) {
|
|
| 1746 | + if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
|
| 1747 | + $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1748 | + } else {
|
|
| 1749 | + $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1750 | + } |
|
| 1751 | + } |
|
| 1752 | + } |
|
| 1753 | + |
|
| 1754 | + //////////////////////////////// |
|
| 1755 | + /* Diagnose Info Page Ends */ |
|
| 1756 | + //////////////////////////////// |
|
| 1757 | + |
|
| 1758 | + ////////////////////////////////// |
|
| 1759 | + /* Diagnose Location Page Starts */ |
|
| 1760 | + ////////////////////////////////// |
|
| 1761 | + $option_value = get_option('geodir_location_page');
|
|
| 1762 | + $page = get_post($option_value); |
|
| 1763 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1764 | + |
|
| 1765 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1766 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1767 | + else {
|
|
| 1768 | + $is_error_during_diagnose = true; |
|
| 1769 | + $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1770 | + if ($fix) {
|
|
| 1771 | + if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
|
| 1772 | + $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1773 | + } else {
|
|
| 1774 | + $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1775 | + } |
|
| 1776 | + } |
|
| 1777 | + } |
|
| 1778 | + |
|
| 1779 | + //////////////////////////////// |
|
| 1780 | + /* Diagnose Location Page Ends */ |
|
| 1781 | + //////////////////////////////// |
|
| 1782 | + |
|
| 1783 | + $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1784 | + /** |
|
| 1785 | + * This action is called at the end of the GD Tools page check function. |
|
| 1786 | + * |
|
| 1787 | + * @since 1.5.2 |
|
| 1788 | + */ |
|
| 1789 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1790 | + |
|
| 1791 | + $output_str = $page_chk_arr['output_str']; |
|
| 1792 | + $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
|
| 1793 | + |
|
| 1794 | + if ($is_error_during_diagnose) {
|
|
| 1795 | + if ($fix) {
|
|
| 1796 | + flush_rewrite_rules(); |
|
| 1797 | + } |
|
| 1798 | + $info_div_class = "geodir_problem_info"; |
|
| 1799 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1800 | + } else {
|
|
| 1801 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1802 | + $fix_button_txt = ''; |
|
| 1803 | + } |
|
| 1804 | + echo "<ul class='$info_div_class'>"; |
|
| 1805 | + echo $output_str; |
|
| 1806 | + echo $fix_button_txt; |
|
| 1807 | + echo "</ul>"; |
|
| 1808 | 1808 | |
| 1809 | 1809 | } |
| 1810 | 1810 | |
@@ -1816,26 +1816,26 @@ discard block |
||
| 1816 | 1816 | * @global object $wpdb WordPress Database object. |
| 1817 | 1817 | */ |
| 1818 | 1818 | function geodir_diagnose_load_db_language() {
|
| 1819 | - global $wpdb; |
|
| 1819 | + global $wpdb; |
|
| 1820 | 1820 | |
| 1821 | 1821 | $is_error_during_diagnose = geodirectory_load_db_language(); |
| 1822 | 1822 | |
| 1823 | - $output_str = ''; |
|
| 1824 | - $fix_button_txt = ''; |
|
| 1823 | + $output_str = ''; |
|
| 1824 | + $fix_button_txt = ''; |
|
| 1825 | 1825 | |
| 1826 | - if ($is_error_during_diagnose) {
|
|
| 1827 | - $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>";
|
|
| 1826 | + if ($is_error_during_diagnose) {
|
|
| 1827 | + $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>";
|
|
| 1828 | 1828 | $info_div_class = "geodir_problem_info"; |
| 1829 | - } else {
|
|
| 1830 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1829 | + } else {
|
|
| 1830 | + $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1831 | 1831 | $info_div_class = "geodir_noproblem_info"; |
| 1832 | - $fix_button_txt = ''; |
|
| 1833 | - } |
|
| 1832 | + $fix_button_txt = ''; |
|
| 1833 | + } |
|
| 1834 | 1834 | |
| 1835 | 1835 | echo "<ul class='$info_div_class'>"; |
| 1836 | - echo $output_str; |
|
| 1837 | - echo $fix_button_txt; |
|
| 1838 | - echo "</ul>"; |
|
| 1836 | + echo $output_str; |
|
| 1837 | + echo $fix_button_txt; |
|
| 1838 | + echo "</ul>"; |
|
| 1839 | 1839 | |
| 1840 | 1840 | } |
| 1841 | 1841 | |
@@ -1866,23 +1866,23 @@ discard block |
||
| 1866 | 1866 | */ |
| 1867 | 1867 | function geodir_posts_clauses_request($clauses) |
| 1868 | 1868 | {
|
| 1869 | - global $wpdb, $wp_query, $plugin_prefix; |
|
| 1869 | + global $wpdb, $wp_query, $plugin_prefix; |
|
| 1870 | 1870 | |
| 1871 | - if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
|
|
| 1872 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1871 | + if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
|
|
| 1872 | + $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1873 | 1873 | |
| 1874 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1875 | - $clauses['join'] = $join; |
|
| 1874 | + $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1875 | + $clauses['join'] = $join; |
|
| 1876 | 1876 | |
| 1877 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1878 | - $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
|
| 1879 | - $clauses['fields'] = $fields; |
|
| 1877 | + $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1878 | + $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
|
| 1879 | + $clauses['fields'] = $fields; |
|
| 1880 | 1880 | |
| 1881 | - $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
|
| 1882 | - $orderby = 'gd_expire ' . $order; |
|
| 1883 | - $clauses['orderby'] = $orderby; |
|
| 1884 | - } |
|
| 1885 | - return $clauses; |
|
| 1881 | + $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
|
| 1882 | + $orderby = 'gd_expire ' . $order; |
|
| 1883 | + $clauses['orderby'] = $orderby; |
|
| 1884 | + } |
|
| 1885 | + return $clauses; |
|
| 1886 | 1886 | } |
| 1887 | 1887 | |
| 1888 | 1888 | |
@@ -1903,7 +1903,7 @@ discard block |
||
| 1903 | 1903 | */ |
| 1904 | 1904 | function gd_theme_switch_compat_check() |
| 1905 | 1905 | {
|
| 1906 | - gd_set_theme_compat(); |
|
| 1906 | + gd_set_theme_compat(); |
|
| 1907 | 1907 | } |
| 1908 | 1908 | |
| 1909 | 1909 | /** |
@@ -1916,27 +1916,27 @@ discard block |
||
| 1916 | 1916 | */ |
| 1917 | 1917 | function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") |
| 1918 | 1918 | {
|
| 1919 | - if (function_exists('str_getcsv')) {
|
|
| 1920 | - $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape); |
|
| 1921 | - } else {
|
|
| 1922 | - global $current_user; |
|
| 1923 | - $upload_dir = wp_upload_dir(); |
|
| 1924 | - |
|
| 1925 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1926 | - $handle = fopen($file, 'w'); |
|
| 1927 | - |
|
| 1928 | - fwrite($handle, $input); |
|
| 1929 | - fclose($handle); |
|
| 1930 | - |
|
| 1931 | - $handle = fopen($file, 'rt'); |
|
| 1932 | - if (PHP_VERSION >= '5.3.0') {
|
|
| 1933 | - $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape); |
|
| 1934 | - } else {
|
|
| 1935 | - $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure); |
|
| 1936 | - } |
|
| 1937 | - fclose($handle); |
|
| 1938 | - } |
|
| 1939 | - return $fgetcsv; |
|
| 1919 | + if (function_exists('str_getcsv')) {
|
|
| 1920 | + $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape); |
|
| 1921 | + } else {
|
|
| 1922 | + global $current_user; |
|
| 1923 | + $upload_dir = wp_upload_dir(); |
|
| 1924 | + |
|
| 1925 | + $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1926 | + $handle = fopen($file, 'w'); |
|
| 1927 | + |
|
| 1928 | + fwrite($handle, $input); |
|
| 1929 | + fclose($handle); |
|
| 1930 | + |
|
| 1931 | + $handle = fopen($file, 'rt'); |
|
| 1932 | + if (PHP_VERSION >= '5.3.0') {
|
|
| 1933 | + $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape); |
|
| 1934 | + } else {
|
|
| 1935 | + $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure); |
|
| 1936 | + } |
|
| 1937 | + fclose($handle); |
|
| 1938 | + } |
|
| 1939 | + return $fgetcsv; |
|
| 1940 | 1940 | } |
| 1941 | 1941 | |
| 1942 | 1942 | add_action('wp_ajax_gdImportCsv', 'geodir_ajax_import_csv');
|
@@ -1951,375 +1951,375 @@ discard block |
||
| 1951 | 1951 | */ |
| 1952 | 1952 | function geodir_ajax_import_csv() |
| 1953 | 1953 | {
|
| 1954 | - error_reporting(0); // hide error to get clean json response |
|
| 1954 | + error_reporting(0); // hide error to get clean json response |
|
| 1955 | 1955 | |
| 1956 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 1957 | - $uploads = wp_upload_dir(); |
|
| 1958 | - ini_set('auto_detect_line_endings', true);
|
|
| 1956 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 1957 | + $uploads = wp_upload_dir(); |
|
| 1958 | + ini_set('auto_detect_line_endings', true);
|
|
| 1959 | 1959 | |
| 1960 | 1960 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
| 1961 | 1961 | |
| 1962 | - $task = isset($_POST['task']) ? $_POST['task'] : ''; |
|
| 1963 | - $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
|
| 1964 | - $filename = $uploadedFile; |
|
| 1965 | - |
|
| 1966 | - $uploads = wp_upload_dir(); |
|
| 1967 | - $uploads_dir = $uploads['path']; |
|
| 1968 | - $image_name_arr = explode('/', $filename);
|
|
| 1969 | - $filename = end($image_name_arr); |
|
| 1970 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1971 | - $return = array(); |
|
| 1972 | - $return['file'] = $uploadedFile; |
|
| 1973 | - $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 1974 | - |
|
| 1975 | - if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
|
|
| 1976 | - $wp_filetype = wp_check_filetype_and_ext($target_path, $filename); |
|
| 1977 | - |
|
| 1978 | - if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 1979 | - $return['error'] = NULL; |
|
| 1980 | - |
|
| 1981 | - $return['rows'] = 0; |
|
| 1982 | - |
|
| 1983 | - |
|
| 1984 | - |
|
| 1985 | - if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 1986 | - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
|
| 1987 | - if(is_array($data) && !empty($data)) {
|
|
| 1988 | - $file[] = '"' . implode('","', $data) . '"';
|
|
| 1989 | - } |
|
| 1990 | - } |
|
| 1991 | - fclose($handle); |
|
| 1992 | - $file = $file; |
|
| 1993 | - } |
|
| 1994 | - |
|
| 1995 | - |
|
| 1996 | - |
|
| 1997 | - $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 1998 | - |
|
| 1999 | - |
|
| 2000 | - if (!$return['rows'] > 0) {
|
|
| 2001 | - $return['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 2002 | - } |
|
| 2003 | - } |
|
| 2004 | - } |
|
| 2005 | - if ($task == 'prepare' || !empty($return['error'])) {
|
|
| 2006 | - echo json_encode($return); |
|
| 2007 | - exit; |
|
| 2008 | - } |
|
| 2009 | - |
|
| 2010 | - $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL; |
|
| 2011 | - $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1; |
|
| 2012 | - $count = $importlimit; |
|
| 2013 | - $requested_limit = $importlimit; |
|
| 2014 | - $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0; |
|
| 2015 | - |
|
| 2016 | - if ($count < $totRecords) {
|
|
| 2017 | - $count = $tmpCnt + $count; |
|
| 2018 | - if ($count > $totRecords) {
|
|
| 2019 | - $count = $totRecords; |
|
| 2020 | - } |
|
| 2021 | - } else {
|
|
| 2022 | - $count = $totRecords; |
|
| 2023 | - } |
|
| 2024 | - |
|
| 2025 | - $total_records = 0; |
|
| 2026 | - $rowcount = 0; |
|
| 2027 | - $address_invalid = 0; |
|
| 2028 | - $blank_address = 0; |
|
| 2029 | - $upload_files = 0; |
|
| 2030 | - $invalid_post_type = 0; |
|
| 2031 | - $invalid_title = 0; |
|
| 2032 | - $customKeyarray = array(); |
|
| 2033 | - $gd_post_info = array(); |
|
| 2034 | - $post_location = array(); |
|
| 2035 | - $countpost = 0; |
|
| 2036 | - |
|
| 2037 | - if (!empty($file)) {
|
|
| 2038 | - $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL; |
|
| 2039 | - $customKeyarray = $columns; |
|
| 2040 | - |
|
| 2041 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 2042 | - $return['error'] = CSV_INVAILD_FILE; |
|
| 2043 | - echo json_encode($return); |
|
| 2044 | - exit; |
|
| 2045 | - } |
|
| 2046 | - |
|
| 2047 | - for ($i = 1; $i <= $importlimit; $i++) {
|
|
| 2048 | - $current_index = $tmpCnt + $i; |
|
| 2049 | - if (isset($file[$current_index])) {
|
|
| 2050 | - $total_records++; |
|
| 2051 | - |
|
| 2052 | - $buffer = geodir_str_getcsv($file[$current_index]); |
|
| 2053 | - $post_title = addslashes($buffer[0]); |
|
| 2054 | - $current_post_author = $buffer[1]; |
|
| 2055 | - $post_desc = addslashes($buffer[2]); |
|
| 2056 | - $post_cat = array(); |
|
| 2057 | - $catids_arr = array(); |
|
| 2058 | - $post_cat = trim($buffer[3]); // comma seperated category name |
|
| 2059 | - |
|
| 2060 | - if ($post_cat) {
|
|
| 2061 | - $post_cat_arr = explode(',', $post_cat);
|
|
| 2062 | - |
|
| 2063 | - for ($c = 0; $c < count($post_cat_arr); $c++) {
|
|
| 2064 | - $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c])); |
|
| 2065 | - |
|
| 2066 | - if (!empty($buffer[5])) {
|
|
| 2067 | - if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2068 | - |
|
| 2069 | - $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5])); |
|
| 2070 | - |
|
| 2071 | - if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 2072 | - $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 2073 | - $catids_arr[] = $cat->slug; |
|
| 2074 | - } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 2075 | - $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 2076 | - $catids_arr[] = $cat->slug; |
|
| 2077 | - } else {
|
|
| 2078 | - $ret = wp_insert_term($catid, $p_taxonomy[0]); |
|
| 2079 | - if ($ret && !is_wp_error($ret)) {
|
|
| 2080 | - if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 2081 | - $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 2082 | - $catids_arr[] = $cat->slug; |
|
| 2083 | - } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 2084 | - $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 2085 | - $catids_arr[] = $cat->slug; |
|
| 2086 | - } |
|
| 2087 | - } |
|
| 2088 | - } |
|
| 2089 | - } |
|
| 2090 | - } |
|
| 2091 | - } |
|
| 2092 | - } |
|
| 2093 | - |
|
| 2094 | - if (!$catids_arr) {
|
|
| 2095 | - $catids_arr[] = 1; |
|
| 2096 | - } |
|
| 2097 | - |
|
| 2098 | - $post_tags = trim($buffer[4]); // comma seperated tags |
|
| 2099 | - |
|
| 2100 | - $tag_arr = ''; |
|
| 2101 | - if ($post_tags) {
|
|
| 2102 | - $tag_arr = explode(',', $post_tags);
|
|
| 2103 | - } |
|
| 2104 | - |
|
| 2105 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 2106 | - |
|
| 2107 | - $error = ''; |
|
| 2108 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 2109 | - $invalid_post_type++; |
|
| 2110 | - continue; |
|
| 2111 | - } |
|
| 2112 | - |
|
| 2113 | - if ($post_title != '') {
|
|
| 2114 | - $menu_order = 0; |
|
| 2115 | - $image_folder_name = 'uplaod/'; |
|
| 2116 | - |
|
| 2117 | - $image_names = array(); |
|
| 2118 | - |
|
| 2119 | - for ($c = 5; $c < count($customKeyarray); $c++) {
|
|
| 2120 | - $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]); |
|
| 2121 | - |
|
| 2122 | - if ($customKeyarray[$c] == 'IMAGE') {
|
|
| 2123 | - $buffer[$c] = trim($buffer[$c]); |
|
| 2124 | - |
|
| 2125 | - if (!empty($buffer[$c])) {
|
|
| 2126 | - $image_names[] = $buffer[$c]; |
|
| 2127 | - } |
|
| 2128 | - } |
|
| 2129 | - |
|
| 2130 | - if ($customKeyarray[$c] == 'alive_days') {
|
|
| 2131 | - if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
|
| 2132 | - $submitdata = date('Y-m-d');
|
|
| 2133 | - |
|
| 2134 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 2135 | - } else {
|
|
| 2136 | - $gd_post_info['expire_date'] = 'Never'; |
|
| 2137 | - } |
|
| 2138 | - } |
|
| 2139 | - |
|
| 2140 | - if ($customKeyarray[$c] == 'post_city') {
|
|
| 2141 | - $post_city = addslashes($buffer[$c]); |
|
| 2142 | - } |
|
| 2143 | - |
|
| 2144 | - if ($customKeyarray[$c] == 'post_region') {
|
|
| 2145 | - $post_region = addslashes($buffer[$c]); |
|
| 2146 | - } |
|
| 2147 | - |
|
| 2148 | - if ($customKeyarray[$c] == 'post_country') {
|
|
| 2149 | - $post_country = addslashes($buffer[$c]); |
|
| 2150 | - } |
|
| 2151 | - |
|
| 2152 | - if ($customKeyarray[$c] == 'post_latitude') {
|
|
| 2153 | - $post_latitude = addslashes($buffer[$c]); |
|
| 2154 | - } |
|
| 2155 | - |
|
| 2156 | - if ($customKeyarray[$c] == 'post_longitude') {
|
|
| 2157 | - $post_longitude = addslashes($buffer[$c]); |
|
| 2158 | - } |
|
| 1962 | + $task = isset($_POST['task']) ? $_POST['task'] : ''; |
|
| 1963 | + $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
|
| 1964 | + $filename = $uploadedFile; |
|
| 1965 | + |
|
| 1966 | + $uploads = wp_upload_dir(); |
|
| 1967 | + $uploads_dir = $uploads['path']; |
|
| 1968 | + $image_name_arr = explode('/', $filename);
|
|
| 1969 | + $filename = end($image_name_arr); |
|
| 1970 | + $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1971 | + $return = array(); |
|
| 1972 | + $return['file'] = $uploadedFile; |
|
| 1973 | + $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 1974 | + |
|
| 1975 | + if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
|
|
| 1976 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $filename); |
|
| 1977 | + |
|
| 1978 | + if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 1979 | + $return['error'] = NULL; |
|
| 1980 | + |
|
| 1981 | + $return['rows'] = 0; |
|
| 1982 | + |
|
| 1983 | + |
|
| 1984 | + |
|
| 1985 | + if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 1986 | + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
|
| 1987 | + if(is_array($data) && !empty($data)) {
|
|
| 1988 | + $file[] = '"' . implode('","', $data) . '"';
|
|
| 1989 | + } |
|
| 1990 | + } |
|
| 1991 | + fclose($handle); |
|
| 1992 | + $file = $file; |
|
| 1993 | + } |
|
| 1994 | + |
|
| 1995 | + |
|
| 1996 | + |
|
| 1997 | + $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 1998 | + |
|
| 1999 | + |
|
| 2000 | + if (!$return['rows'] > 0) {
|
|
| 2001 | + $return['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 2002 | + } |
|
| 2003 | + } |
|
| 2004 | + } |
|
| 2005 | + if ($task == 'prepare' || !empty($return['error'])) {
|
|
| 2006 | + echo json_encode($return); |
|
| 2007 | + exit; |
|
| 2008 | + } |
|
| 2009 | + |
|
| 2010 | + $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL; |
|
| 2011 | + $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1; |
|
| 2012 | + $count = $importlimit; |
|
| 2013 | + $requested_limit = $importlimit; |
|
| 2014 | + $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0; |
|
| 2015 | + |
|
| 2016 | + if ($count < $totRecords) {
|
|
| 2017 | + $count = $tmpCnt + $count; |
|
| 2018 | + if ($count > $totRecords) {
|
|
| 2019 | + $count = $totRecords; |
|
| 2020 | + } |
|
| 2021 | + } else {
|
|
| 2022 | + $count = $totRecords; |
|
| 2023 | + } |
|
| 2024 | + |
|
| 2025 | + $total_records = 0; |
|
| 2026 | + $rowcount = 0; |
|
| 2027 | + $address_invalid = 0; |
|
| 2028 | + $blank_address = 0; |
|
| 2029 | + $upload_files = 0; |
|
| 2030 | + $invalid_post_type = 0; |
|
| 2031 | + $invalid_title = 0; |
|
| 2032 | + $customKeyarray = array(); |
|
| 2033 | + $gd_post_info = array(); |
|
| 2034 | + $post_location = array(); |
|
| 2035 | + $countpost = 0; |
|
| 2036 | + |
|
| 2037 | + if (!empty($file)) {
|
|
| 2038 | + $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL; |
|
| 2039 | + $customKeyarray = $columns; |
|
| 2040 | + |
|
| 2041 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 2042 | + $return['error'] = CSV_INVAILD_FILE; |
|
| 2043 | + echo json_encode($return); |
|
| 2044 | + exit; |
|
| 2045 | + } |
|
| 2046 | + |
|
| 2047 | + for ($i = 1; $i <= $importlimit; $i++) {
|
|
| 2048 | + $current_index = $tmpCnt + $i; |
|
| 2049 | + if (isset($file[$current_index])) {
|
|
| 2050 | + $total_records++; |
|
| 2051 | + |
|
| 2052 | + $buffer = geodir_str_getcsv($file[$current_index]); |
|
| 2053 | + $post_title = addslashes($buffer[0]); |
|
| 2054 | + $current_post_author = $buffer[1]; |
|
| 2055 | + $post_desc = addslashes($buffer[2]); |
|
| 2056 | + $post_cat = array(); |
|
| 2057 | + $catids_arr = array(); |
|
| 2058 | + $post_cat = trim($buffer[3]); // comma seperated category name |
|
| 2059 | + |
|
| 2060 | + if ($post_cat) {
|
|
| 2061 | + $post_cat_arr = explode(',', $post_cat);
|
|
| 2062 | + |
|
| 2063 | + for ($c = 0; $c < count($post_cat_arr); $c++) {
|
|
| 2064 | + $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c])); |
|
| 2065 | + |
|
| 2066 | + if (!empty($buffer[5])) {
|
|
| 2067 | + if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2068 | + |
|
| 2069 | + $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5])); |
|
| 2070 | + |
|
| 2071 | + if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 2072 | + $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 2073 | + $catids_arr[] = $cat->slug; |
|
| 2074 | + } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 2075 | + $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 2076 | + $catids_arr[] = $cat->slug; |
|
| 2077 | + } else {
|
|
| 2078 | + $ret = wp_insert_term($catid, $p_taxonomy[0]); |
|
| 2079 | + if ($ret && !is_wp_error($ret)) {
|
|
| 2080 | + if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 2081 | + $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 2082 | + $catids_arr[] = $cat->slug; |
|
| 2083 | + } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 2084 | + $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 2085 | + $catids_arr[] = $cat->slug; |
|
| 2086 | + } |
|
| 2087 | + } |
|
| 2088 | + } |
|
| 2089 | + } |
|
| 2090 | + } |
|
| 2091 | + } |
|
| 2092 | + } |
|
| 2093 | + |
|
| 2094 | + if (!$catids_arr) {
|
|
| 2095 | + $catids_arr[] = 1; |
|
| 2096 | + } |
|
| 2097 | + |
|
| 2098 | + $post_tags = trim($buffer[4]); // comma seperated tags |
|
| 2099 | + |
|
| 2100 | + $tag_arr = ''; |
|
| 2101 | + if ($post_tags) {
|
|
| 2102 | + $tag_arr = explode(',', $post_tags);
|
|
| 2103 | + } |
|
| 2104 | + |
|
| 2105 | + $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 2106 | + |
|
| 2107 | + $error = ''; |
|
| 2108 | + if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 2109 | + $invalid_post_type++; |
|
| 2110 | + continue; |
|
| 2111 | + } |
|
| 2112 | + |
|
| 2113 | + if ($post_title != '') {
|
|
| 2114 | + $menu_order = 0; |
|
| 2115 | + $image_folder_name = 'uplaod/'; |
|
| 2116 | + |
|
| 2117 | + $image_names = array(); |
|
| 2118 | + |
|
| 2119 | + for ($c = 5; $c < count($customKeyarray); $c++) {
|
|
| 2120 | + $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]); |
|
| 2121 | + |
|
| 2122 | + if ($customKeyarray[$c] == 'IMAGE') {
|
|
| 2123 | + $buffer[$c] = trim($buffer[$c]); |
|
| 2124 | + |
|
| 2125 | + if (!empty($buffer[$c])) {
|
|
| 2126 | + $image_names[] = $buffer[$c]; |
|
| 2127 | + } |
|
| 2128 | + } |
|
| 2129 | + |
|
| 2130 | + if ($customKeyarray[$c] == 'alive_days') {
|
|
| 2131 | + if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
|
| 2132 | + $submitdata = date('Y-m-d');
|
|
| 2133 | + |
|
| 2134 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 2135 | + } else {
|
|
| 2136 | + $gd_post_info['expire_date'] = 'Never'; |
|
| 2137 | + } |
|
| 2138 | + } |
|
| 2139 | + |
|
| 2140 | + if ($customKeyarray[$c] == 'post_city') {
|
|
| 2141 | + $post_city = addslashes($buffer[$c]); |
|
| 2142 | + } |
|
| 2143 | + |
|
| 2144 | + if ($customKeyarray[$c] == 'post_region') {
|
|
| 2145 | + $post_region = addslashes($buffer[$c]); |
|
| 2146 | + } |
|
| 2147 | + |
|
| 2148 | + if ($customKeyarray[$c] == 'post_country') {
|
|
| 2149 | + $post_country = addslashes($buffer[$c]); |
|
| 2150 | + } |
|
| 2151 | + |
|
| 2152 | + if ($customKeyarray[$c] == 'post_latitude') {
|
|
| 2153 | + $post_latitude = addslashes($buffer[$c]); |
|
| 2154 | + } |
|
| 2155 | + |
|
| 2156 | + if ($customKeyarray[$c] == 'post_longitude') {
|
|
| 2157 | + $post_longitude = addslashes($buffer[$c]); |
|
| 2158 | + } |
|
| 2159 | 2159 | |
| 2160 | 2160 | // Post status |
| 2161 | 2161 | if ($customKeyarray[$c] == 'post_status') {
|
| 2162 | - $post_status = sanitize_key( $buffer[$c] ); |
|
| 2163 | - } |
|
| 2164 | - } |
|
| 2165 | - |
|
| 2166 | - /* ================ before array create ============== */ |
|
| 2167 | - $location_result = geodir_get_default_location(); |
|
| 2168 | - if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
|
|
| 2169 | - $blank_address++; |
|
| 2170 | - continue; |
|
| 2171 | - } else if ($location_result->location_id == 0) {
|
|
| 2172 | - if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
|
|
| 2173 | - $address_invalid++; |
|
| 2174 | - continue; |
|
| 2175 | - } |
|
| 2176 | - } |
|
| 2162 | + $post_status = sanitize_key( $buffer[$c] ); |
|
| 2163 | + } |
|
| 2164 | + } |
|
| 2165 | + |
|
| 2166 | + /* ================ before array create ============== */ |
|
| 2167 | + $location_result = geodir_get_default_location(); |
|
| 2168 | + if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
|
|
| 2169 | + $blank_address++; |
|
| 2170 | + continue; |
|
| 2171 | + } else if ($location_result->location_id == 0) {
|
|
| 2172 | + if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
|
|
| 2173 | + $address_invalid++; |
|
| 2174 | + continue; |
|
| 2175 | + } |
|
| 2176 | + } |
|
| 2177 | 2177 | |
| 2178 | 2178 | // Default post status |
| 2179 | 2179 | $default_status = 'publish'; |
| 2180 | 2180 | $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
| 2181 | 2181 | $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
| 2182 | 2182 | |
| 2183 | - $my_post['post_title'] = $post_title; |
|
| 2184 | - $my_post['post_content'] = $post_desc; |
|
| 2185 | - $my_post['post_type'] = addslashes($buffer[5]); |
|
| 2186 | - $my_post['post_author'] = $current_post_author; |
|
| 2187 | - $my_post['post_status'] = $post_status; |
|
| 2188 | - $my_post['post_category'] = $catids_arr; |
|
| 2189 | - $my_post['post_tags'] = $tag_arr; |
|
| 2190 | - |
|
| 2191 | - $gd_post_info['post_tags'] = $tag_arr; |
|
| 2192 | - $gd_post_info['post_title'] = $post_title; |
|
| 2193 | - $gd_post_info['post_status'] = $post_status; |
|
| 2194 | - $gd_post_info['submit_time'] = time(); |
|
| 2195 | - $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 2196 | - |
|
| 2197 | - $last_postid = wp_insert_post($my_post); |
|
| 2198 | - $countpost++; |
|
| 2199 | - |
|
| 2200 | - // Check if we need to save post location as new location |
|
| 2201 | - if ($location_result->location_id > 0) {
|
|
| 2202 | - if (isset($post_city) && isset($post_region)) {
|
|
| 2203 | - $request_info['post_location'] = array( |
|
| 2204 | - 'city' => $post_city, |
|
| 2205 | - 'region' => $post_region, |
|
| 2206 | - 'country' => $post_country, |
|
| 2207 | - 'geo_lat' => $post_latitude, |
|
| 2208 | - 'geo_lng' => $post_longitude |
|
| 2209 | - ); |
|
| 2210 | - |
|
| 2211 | - $post_location_info = $request_info['post_location']; |
|
| 2212 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 2213 | - $post_location_id = $location_id; |
|
| 2214 | - } else {
|
|
| 2215 | - $post_location_id = 0; |
|
| 2216 | - } |
|
| 2217 | - } else {
|
|
| 2218 | - $post_location_id = 0; |
|
| 2219 | - } |
|
| 2220 | - |
|
| 2221 | - /* ------- get default package info ----- */ |
|
| 2222 | - $payment_info = array(); |
|
| 2223 | - $package_info = array(); |
|
| 2224 | - |
|
| 2225 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2226 | - $package_id = ''; |
|
| 2227 | - if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
|
| 2228 | - $package_id = $gd_post_info['package_id']; |
|
| 2229 | - } |
|
| 2230 | - |
|
| 2231 | - if (!empty($package_info)) {
|
|
| 2232 | - $payment_info['package_id'] = $package_info['pid']; |
|
| 2233 | - |
|
| 2234 | - if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
|
| 2235 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2236 | - } else {
|
|
| 2237 | - $payment_info['expire_date'] = 'Never'; |
|
| 2238 | - } |
|
| 2239 | - |
|
| 2240 | - $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
| 2241 | - } |
|
| 2242 | - |
|
| 2243 | - $gd_post_info['post_location_id'] = $post_location_id; |
|
| 2244 | - |
|
| 2245 | - $post_type = get_post_type($last_postid); |
|
| 2246 | - |
|
| 2247 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2248 | - |
|
| 2249 | - geodir_save_post_info($last_postid, $gd_post_info); |
|
| 2250 | - |
|
| 2251 | - if (!empty($image_names)) {
|
|
| 2252 | - $upload_files++; |
|
| 2253 | - $menu_order = 1; |
|
| 2254 | - |
|
| 2255 | - foreach ($image_names as $image_name) {
|
|
| 2256 | - $img_name_arr = explode('.', $image_name);
|
|
| 2257 | - |
|
| 2258 | - $uploads = wp_upload_dir(); |
|
| 2259 | - $sub_dir = $uploads['subdir']; |
|
| 2260 | - |
|
| 2261 | - $arr_file_type = wp_check_filetype($image_name); |
|
| 2262 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 2263 | - |
|
| 2264 | - $attachment = array(); |
|
| 2265 | - $attachment['post_id'] = $last_postid; |
|
| 2266 | - $attachment['title'] = $img_name_arr[0]; |
|
| 2267 | - $attachment['content'] = ''; |
|
| 2268 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2269 | - $attachment['mime_type'] = $uploaded_file_type; |
|
| 2270 | - $attachment['menu_order'] = $menu_order; |
|
| 2271 | - $attachment['is_featured'] = 0; |
|
| 2272 | - |
|
| 2273 | - $attachment_set = ''; |
|
| 2274 | - |
|
| 2275 | - foreach ($attachment as $key => $val) {
|
|
| 2276 | - if ($val != '') |
|
| 2277 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2278 | - } |
|
| 2279 | - $attachment_set = trim($attachment_set, ", "); |
|
| 2280 | - |
|
| 2281 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2282 | - |
|
| 2283 | - if ($menu_order == 1) {
|
|
| 2284 | - $post_type = get_post_type($last_postid); |
|
| 2285 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2286 | - } |
|
| 2287 | - $menu_order++; |
|
| 2288 | - } |
|
| 2289 | - } |
|
| 2290 | - |
|
| 2291 | - $gd_post_info['package_id'] = $package_id; |
|
| 2292 | - |
|
| 2293 | - /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 2294 | - do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
|
|
| 2295 | - |
|
| 2296 | - if (!empty($buffer[5])) {
|
|
| 2297 | - if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2298 | - $taxonomies = geodir_get_posttype_info(addslashes($buffer[5])); |
|
| 2299 | - wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]); |
|
| 2300 | - wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]); |
|
| 2301 | - |
|
| 2302 | - $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : ''; |
|
| 2303 | - $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : ''; |
|
| 2304 | - geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str); |
|
| 2305 | - } |
|
| 2306 | - } |
|
| 2307 | - } else {
|
|
| 2308 | - $invalid_title++; |
|
| 2309 | - } |
|
| 2310 | - } |
|
| 2311 | - } |
|
| 2312 | - } |
|
| 2313 | - $return['rowcount'] = $countpost; |
|
| 2314 | - $return['invalidcount'] = $address_invalid; |
|
| 2315 | - $return['blank_address'] = $blank_address; |
|
| 2316 | - $return['upload_files'] = $upload_files; |
|
| 2317 | - $return['invalid_post_type'] = $invalid_post_type; |
|
| 2318 | - $return['invalid_title'] = $invalid_title; |
|
| 2319 | - $return['total_records'] = $total_records; |
|
| 2320 | - |
|
| 2321 | - echo json_encode($return); |
|
| 2322 | - exit; |
|
| 2183 | + $my_post['post_title'] = $post_title; |
|
| 2184 | + $my_post['post_content'] = $post_desc; |
|
| 2185 | + $my_post['post_type'] = addslashes($buffer[5]); |
|
| 2186 | + $my_post['post_author'] = $current_post_author; |
|
| 2187 | + $my_post['post_status'] = $post_status; |
|
| 2188 | + $my_post['post_category'] = $catids_arr; |
|
| 2189 | + $my_post['post_tags'] = $tag_arr; |
|
| 2190 | + |
|
| 2191 | + $gd_post_info['post_tags'] = $tag_arr; |
|
| 2192 | + $gd_post_info['post_title'] = $post_title; |
|
| 2193 | + $gd_post_info['post_status'] = $post_status; |
|
| 2194 | + $gd_post_info['submit_time'] = time(); |
|
| 2195 | + $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 2196 | + |
|
| 2197 | + $last_postid = wp_insert_post($my_post); |
|
| 2198 | + $countpost++; |
|
| 2199 | + |
|
| 2200 | + // Check if we need to save post location as new location |
|
| 2201 | + if ($location_result->location_id > 0) {
|
|
| 2202 | + if (isset($post_city) && isset($post_region)) {
|
|
| 2203 | + $request_info['post_location'] = array( |
|
| 2204 | + 'city' => $post_city, |
|
| 2205 | + 'region' => $post_region, |
|
| 2206 | + 'country' => $post_country, |
|
| 2207 | + 'geo_lat' => $post_latitude, |
|
| 2208 | + 'geo_lng' => $post_longitude |
|
| 2209 | + ); |
|
| 2210 | + |
|
| 2211 | + $post_location_info = $request_info['post_location']; |
|
| 2212 | + if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 2213 | + $post_location_id = $location_id; |
|
| 2214 | + } else {
|
|
| 2215 | + $post_location_id = 0; |
|
| 2216 | + } |
|
| 2217 | + } else {
|
|
| 2218 | + $post_location_id = 0; |
|
| 2219 | + } |
|
| 2220 | + |
|
| 2221 | + /* ------- get default package info ----- */ |
|
| 2222 | + $payment_info = array(); |
|
| 2223 | + $package_info = array(); |
|
| 2224 | + |
|
| 2225 | + $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2226 | + $package_id = ''; |
|
| 2227 | + if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
|
| 2228 | + $package_id = $gd_post_info['package_id']; |
|
| 2229 | + } |
|
| 2230 | + |
|
| 2231 | + if (!empty($package_info)) {
|
|
| 2232 | + $payment_info['package_id'] = $package_info['pid']; |
|
| 2233 | + |
|
| 2234 | + if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
|
| 2235 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2236 | + } else {
|
|
| 2237 | + $payment_info['expire_date'] = 'Never'; |
|
| 2238 | + } |
|
| 2239 | + |
|
| 2240 | + $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
| 2241 | + } |
|
| 2242 | + |
|
| 2243 | + $gd_post_info['post_location_id'] = $post_location_id; |
|
| 2244 | + |
|
| 2245 | + $post_type = get_post_type($last_postid); |
|
| 2246 | + |
|
| 2247 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2248 | + |
|
| 2249 | + geodir_save_post_info($last_postid, $gd_post_info); |
|
| 2250 | + |
|
| 2251 | + if (!empty($image_names)) {
|
|
| 2252 | + $upload_files++; |
|
| 2253 | + $menu_order = 1; |
|
| 2254 | + |
|
| 2255 | + foreach ($image_names as $image_name) {
|
|
| 2256 | + $img_name_arr = explode('.', $image_name);
|
|
| 2257 | + |
|
| 2258 | + $uploads = wp_upload_dir(); |
|
| 2259 | + $sub_dir = $uploads['subdir']; |
|
| 2260 | + |
|
| 2261 | + $arr_file_type = wp_check_filetype($image_name); |
|
| 2262 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 2263 | + |
|
| 2264 | + $attachment = array(); |
|
| 2265 | + $attachment['post_id'] = $last_postid; |
|
| 2266 | + $attachment['title'] = $img_name_arr[0]; |
|
| 2267 | + $attachment['content'] = ''; |
|
| 2268 | + $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2269 | + $attachment['mime_type'] = $uploaded_file_type; |
|
| 2270 | + $attachment['menu_order'] = $menu_order; |
|
| 2271 | + $attachment['is_featured'] = 0; |
|
| 2272 | + |
|
| 2273 | + $attachment_set = ''; |
|
| 2274 | + |
|
| 2275 | + foreach ($attachment as $key => $val) {
|
|
| 2276 | + if ($val != '') |
|
| 2277 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2278 | + } |
|
| 2279 | + $attachment_set = trim($attachment_set, ", "); |
|
| 2280 | + |
|
| 2281 | + $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2282 | + |
|
| 2283 | + if ($menu_order == 1) {
|
|
| 2284 | + $post_type = get_post_type($last_postid); |
|
| 2285 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2286 | + } |
|
| 2287 | + $menu_order++; |
|
| 2288 | + } |
|
| 2289 | + } |
|
| 2290 | + |
|
| 2291 | + $gd_post_info['package_id'] = $package_id; |
|
| 2292 | + |
|
| 2293 | + /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 2294 | + do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
|
|
| 2295 | + |
|
| 2296 | + if (!empty($buffer[5])) {
|
|
| 2297 | + if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2298 | + $taxonomies = geodir_get_posttype_info(addslashes($buffer[5])); |
|
| 2299 | + wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]); |
|
| 2300 | + wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]); |
|
| 2301 | + |
|
| 2302 | + $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : ''; |
|
| 2303 | + $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : ''; |
|
| 2304 | + geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str); |
|
| 2305 | + } |
|
| 2306 | + } |
|
| 2307 | + } else {
|
|
| 2308 | + $invalid_title++; |
|
| 2309 | + } |
|
| 2310 | + } |
|
| 2311 | + } |
|
| 2312 | + } |
|
| 2313 | + $return['rowcount'] = $countpost; |
|
| 2314 | + $return['invalidcount'] = $address_invalid; |
|
| 2315 | + $return['blank_address'] = $blank_address; |
|
| 2316 | + $return['upload_files'] = $upload_files; |
|
| 2317 | + $return['invalid_post_type'] = $invalid_post_type; |
|
| 2318 | + $return['invalid_title'] = $invalid_title; |
|
| 2319 | + $return['total_records'] = $total_records; |
|
| 2320 | + |
|
| 2321 | + echo json_encode($return); |
|
| 2322 | + exit; |
|
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | 2325 | // Add the tab in left sidebar menu fro import & export page. |
@@ -2339,9 +2339,9 @@ discard block |
||
| 2339 | 2339 | * @param $post object $post The post object of the post being saved. |
| 2340 | 2340 | */ |
| 2341 | 2341 | function geodir_update_location_prefix($post_id,$post){
|
| 2342 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2343 | - update_option('geodir_location_prefix',$post->post_name);
|
|
| 2344 | - } |
|
| 2342 | + if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2343 | + update_option('geodir_location_prefix',$post->post_name);
|
|
| 2344 | + } |
|
| 2345 | 2345 | |
| 2346 | 2346 | } |
| 2347 | 2347 | |
@@ -2352,50 +2352,50 @@ discard block |
||
| 2352 | 2352 | function geodir_ga_callback(){
|
| 2353 | 2353 | |
| 2354 | 2354 | if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
| 2355 | - $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
|
| 2356 | - $code = "code=".$_REQUEST['code']; |
|
| 2357 | - $grant_type = "&grant_type=authorization_code"; |
|
| 2358 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2359 | - $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 2360 | - $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
| 2355 | + $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
|
| 2356 | + $code = "code=".$_REQUEST['code']; |
|
| 2357 | + $grant_type = "&grant_type=authorization_code"; |
|
| 2358 | + $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2359 | + $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 2360 | + $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
| 2361 | 2361 | |
| 2362 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2362 | + $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2363 | 2363 | |
| 2364 | - $response = wp_remote_post($auth_url, array('timeout' => 15));
|
|
| 2364 | + $response = wp_remote_post($auth_url, array('timeout' => 15));
|
|
| 2365 | 2365 | |
| 2366 | - //print_r($response); |
|
| 2366 | + //print_r($response); |
|
| 2367 | 2367 | |
| 2368 | - $error_msg = __('Something went wrong','geodirectory');
|
|
| 2369 | - if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2368 | + $error_msg = __('Something went wrong','geodirectory');
|
|
| 2369 | + if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2370 | 2370 | |
| 2371 | - $parts = json_decode($response['body']); |
|
| 2372 | - //print_r($parts); |
|
| 2373 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2374 | - else{
|
|
| 2371 | + $parts = json_decode($response['body']); |
|
| 2372 | + //print_r($parts); |
|
| 2373 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2374 | + else{
|
|
| 2375 | 2375 | |
| 2376 | - update_option('gd_ga_access_token', $parts->access_token);
|
|
| 2377 | - update_option('gd_ga_refresh_token', $parts->refresh_token);
|
|
| 2378 | - ?><script>window.close();</script><?php |
|
| 2379 | - } |
|
| 2376 | + update_option('gd_ga_access_token', $parts->access_token);
|
|
| 2377 | + update_option('gd_ga_refresh_token', $parts->refresh_token);
|
|
| 2378 | + ?><script>window.close();</script><?php |
|
| 2379 | + } |
|
| 2380 | 2380 | |
| 2381 | 2381 | |
| 2382 | - } |
|
| 2383 | - elseif(!empty($response['response']['code'])) {
|
|
| 2384 | - $parts = json_decode($response['body']); |
|
| 2382 | + } |
|
| 2383 | + elseif(!empty($response['response']['code'])) {
|
|
| 2384 | + $parts = json_decode($response['body']); |
|
| 2385 | 2385 | |
| 2386 | - if(isset($parts->error)){
|
|
| 2387 | - echo $parts->error.": ".$parts->error_description;exit; |
|
| 2388 | - }else{
|
|
| 2389 | - echo $error_msg." - #2";exit; |
|
| 2390 | - } |
|
| 2386 | + if(isset($parts->error)){
|
|
| 2387 | + echo $parts->error.": ".$parts->error_description;exit; |
|
| 2388 | + }else{
|
|
| 2389 | + echo $error_msg." - #2";exit; |
|
| 2390 | + } |
|
| 2391 | 2391 | |
| 2392 | - }else{
|
|
| 2392 | + }else{
|
|
| 2393 | 2393 | |
| 2394 | - echo $error_msg." - #3";exit; |
|
| 2394 | + echo $error_msg." - #3";exit; |
|
| 2395 | 2395 | |
| 2396 | - } |
|
| 2396 | + } |
|
| 2397 | 2397 | } |
| 2398 | - exit; |
|
| 2398 | + exit; |
|
| 2399 | 2399 | } |
| 2400 | 2400 | |
| 2401 | 2401 | if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
|
@@ -2411,45 +2411,45 @@ discard block |
||
| 2411 | 2411 | * @return array Array of settings. |
| 2412 | 2412 | */ |
| 2413 | 2413 | function geodir_uninstall_settings($general_settings) {
|
| 2414 | - $settings = array(); |
|
| 2415 | - $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
|
| 2416 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
| 2414 | + $settings = array(); |
|
| 2415 | + $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
|
| 2416 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
| 2417 | 2417 | |
| 2418 | - $plugins = get_plugins(); |
|
| 2419 | - $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
|
| 2418 | + $plugins = get_plugins(); |
|
| 2419 | + $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
|
| 2420 | 2420 | |
| 2421 | - if (!empty($plugins) && !empty($un_plugins)) {
|
|
| 2422 | - foreach ($plugins as $plugin => $data) {
|
|
| 2423 | - $plugin_name = plugin_basename(dirname($plugin)); |
|
| 2421 | + if (!empty($plugins) && !empty($un_plugins)) {
|
|
| 2422 | + foreach ($plugins as $plugin => $data) {
|
|
| 2423 | + $plugin_name = plugin_basename(dirname($plugin)); |
|
| 2424 | 2424 | |
| 2425 | - if (in_array($plugin_name, $un_plugins)) {
|
|
| 2426 | - $settings[] = array( |
|
| 2427 | - 'type' => 'checkbox', |
|
| 2428 | - 'id' => 'geodir_un_' . $plugin_name, |
|
| 2429 | - 'name' => $data['Name'], |
|
| 2430 | - 'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
|
| 2431 | - 'std' => '0' |
|
| 2432 | - ); |
|
| 2433 | - } |
|
| 2434 | - } |
|
| 2435 | - } |
|
| 2425 | + if (in_array($plugin_name, $un_plugins)) {
|
|
| 2426 | + $settings[] = array( |
|
| 2427 | + 'type' => 'checkbox', |
|
| 2428 | + 'id' => 'geodir_un_' . $plugin_name, |
|
| 2429 | + 'name' => $data['Name'], |
|
| 2430 | + 'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
|
| 2431 | + 'std' => '0' |
|
| 2432 | + ); |
|
| 2433 | + } |
|
| 2434 | + } |
|
| 2435 | + } |
|
| 2436 | 2436 | |
| 2437 | - $settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main');
|
|
| 2437 | + $settings[] = array('type' => 'sectionend', 'id' => 'uninstall_settings_main');
|
|
| 2438 | 2438 | |
| 2439 | - /** |
|
| 2440 | - * Filter the uninstall settings array. |
|
| 2441 | - * |
|
| 2442 | - * @since 1.6.9 |
|
| 2443 | - * |
|
| 2444 | - * @param array $settings The settings array. |
|
| 2445 | - */ |
|
| 2446 | - $settings = apply_filters('geodir_uninstall_settings', $settings);
|
|
| 2439 | + /** |
|
| 2440 | + * Filter the uninstall settings array. |
|
| 2441 | + * |
|
| 2442 | + * @since 1.6.9 |
|
| 2443 | + * |
|
| 2444 | + * @param array $settings The settings array. |
|
| 2445 | + */ |
|
| 2446 | + $settings = apply_filters('geodir_uninstall_settings', $settings);
|
|
| 2447 | 2447 | |
| 2448 | - if (!empty($settings) && count($settings) > 3) {
|
|
| 2449 | - return array_merge($general_settings, $settings); |
|
| 2450 | - } |
|
| 2448 | + if (!empty($settings) && count($settings) > 3) {
|
|
| 2449 | + return array_merge($general_settings, $settings); |
|
| 2450 | + } |
|
| 2451 | 2451 | |
| 2452 | - return $general_settings; |
|
| 2452 | + return $general_settings; |
|
| 2453 | 2453 | } |
| 2454 | 2454 | add_filter('geodir_general_settings', 'geodir_uninstall_settings', 100, 1);
|
| 2455 | 2455 | |
@@ -2459,7 +2459,7 @@ discard block |
||
| 2459 | 2459 | * @since 1.6.9 |
| 2460 | 2460 | */ |
| 2461 | 2461 | function geodir_uninstall_settings_desc() {
|
| 2462 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory') . '</p>';
|
|
| 2462 | + echo '<p class="gd-un-settings-desc">' . __('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory') . '</p>';
|
|
| 2463 | 2463 | } |
| 2464 | 2464 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
|
| 2465 | 2465 | |
@@ -2475,18 +2475,18 @@ discard block |
||
| 2475 | 2475 | * @return array The settings array. |
| 2476 | 2476 | */ |
| 2477 | 2477 | function geodir_resave_settings($settings = array()) {
|
| 2478 | - if (!empty($settings) && is_array($settings)) {
|
|
| 2479 | - $c = 0; |
|
| 2478 | + if (!empty($settings) && is_array($settings)) {
|
|
| 2479 | + $c = 0; |
|
| 2480 | 2480 | |
| 2481 | - foreach ($settings as $setting) {
|
|
| 2482 | - if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) {
|
|
| 2483 | - $settings[$c]['std'] = $value; |
|
| 2484 | - } |
|
| 2485 | - $c++; |
|
| 2486 | - } |
|
| 2487 | - } |
|
| 2488 | - |
|
| 2489 | - return $settings; |
|
| 2481 | + foreach ($settings as $setting) {
|
|
| 2482 | + if (!empty($setting['id']) && false !== ($value = get_option($setting['id']))) {
|
|
| 2483 | + $settings[$c]['std'] = $value; |
|
| 2484 | + } |
|
| 2485 | + $c++; |
|
| 2486 | + } |
|
| 2487 | + } |
|
| 2488 | + |
|
| 2489 | + return $settings; |
|
| 2490 | 2490 | } |
| 2491 | 2491 | |
| 2492 | 2492 | /** |
@@ -2498,9 +2498,9 @@ discard block |
||
| 2498 | 2498 | * @return array The modified settings. |
| 2499 | 2499 | */ |
| 2500 | 2500 | function geodir_core_uninstall_settings($settings) {
|
| 2501 | - $settings[] = plugin_basename(dirname(dirname(__FILE__))); |
|
| 2501 | + $settings[] = plugin_basename(dirname(dirname(__FILE__))); |
|
| 2502 | 2502 | |
| 2503 | - return $settings; |
|
| 2503 | + return $settings; |
|
| 2504 | 2504 | } |
| 2505 | 2505 | add_filter('geodir_plugins_uninstall_settings', 'geodir_core_uninstall_settings', 10, 1);
|
| 2506 | 2506 | |
@@ -2514,34 +2514,34 @@ discard block |
||
| 2514 | 2514 | */ |
| 2515 | 2515 | function geodir_diagnose_reload_db_countries() |
| 2516 | 2516 | {
|
| 2517 | - global $wpdb, $plugin_prefix; |
|
| 2518 | - |
|
| 2519 | - $is_error_during_diagnose = false; |
|
| 2520 | - $output_str = ''; |
|
| 2521 | - |
|
| 2522 | - $delete = $wpdb->query("TRUNCATE TABLE ".GEODIR_COUNTRIES_TABLE);
|
|
| 2523 | - |
|
| 2524 | - |
|
| 2525 | - if ($delete) {
|
|
| 2526 | - $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
| 2527 | - ob_start(); |
|
| 2528 | - geodir_diagnose_version_clear(); |
|
| 2529 | - ob_end_clean(); |
|
| 2530 | - }else{
|
|
| 2531 | - $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
|
|
| 2532 | - } |
|
| 2533 | - |
|
| 2534 | - if ($is_error_during_diagnose) {
|
|
| 2535 | - $info_div_class = "geodir_problem_info"; |
|
| 2536 | - $fix_button_txt = ""; |
|
| 2537 | - } else {
|
|
| 2538 | - $info_div_class = "geodir_noproblem_info"; |
|
| 2539 | - $fix_button_txt = ''; |
|
| 2540 | - } |
|
| 2541 | - echo "<ul class='$info_div_class'>"; |
|
| 2542 | - echo $output_str; |
|
| 2543 | - echo $fix_button_txt; |
|
| 2544 | - echo "</ul>"; |
|
| 2517 | + global $wpdb, $plugin_prefix; |
|
| 2518 | + |
|
| 2519 | + $is_error_during_diagnose = false; |
|
| 2520 | + $output_str = ''; |
|
| 2521 | + |
|
| 2522 | + $delete = $wpdb->query("TRUNCATE TABLE ".GEODIR_COUNTRIES_TABLE);
|
|
| 2523 | + |
|
| 2524 | + |
|
| 2525 | + if ($delete) {
|
|
| 2526 | + $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
| 2527 | + ob_start(); |
|
| 2528 | + geodir_diagnose_version_clear(); |
|
| 2529 | + ob_end_clean(); |
|
| 2530 | + }else{
|
|
| 2531 | + $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
|
|
| 2532 | + } |
|
| 2533 | + |
|
| 2534 | + if ($is_error_during_diagnose) {
|
|
| 2535 | + $info_div_class = "geodir_problem_info"; |
|
| 2536 | + $fix_button_txt = ""; |
|
| 2537 | + } else {
|
|
| 2538 | + $info_div_class = "geodir_noproblem_info"; |
|
| 2539 | + $fix_button_txt = ''; |
|
| 2540 | + } |
|
| 2541 | + echo "<ul class='$info_div_class'>"; |
|
| 2542 | + echo $output_str; |
|
| 2543 | + echo $fix_button_txt; |
|
| 2544 | + echo "</ul>"; |
|
| 2545 | 2545 | } |
| 2546 | 2546 | |
| 2547 | 2547 | /** |
@@ -2554,11 +2554,11 @@ discard block |
||
| 2554 | 2554 | * @return array Filtered actions. |
| 2555 | 2555 | */ |
| 2556 | 2556 | function geodir_disable_quick_edit( $actions = array(), $row = null ) {
|
| 2557 | - if ( isset( $actions['inline hide-if-no-js'] ) ) {
|
|
| 2558 | - unset( $actions['inline hide-if-no-js'] ); |
|
| 2559 | - } |
|
| 2557 | + if ( isset( $actions['inline hide-if-no-js'] ) ) {
|
|
| 2558 | + unset( $actions['inline hide-if-no-js'] ); |
|
| 2559 | + } |
|
| 2560 | 2560 | |
| 2561 | - return $actions; |
|
| 2561 | + return $actions; |
|
| 2562 | 2562 | } |
| 2563 | 2563 | |
| 2564 | 2564 | /** |
@@ -2572,26 +2572,26 @@ discard block |
||
| 2572 | 2572 | * @global bool $gd_cpt_screen True if current scrrrn has GD post type. |
| 2573 | 2573 | */ |
| 2574 | 2574 | function geodir_check_quick_edit() {
|
| 2575 | - global $pagenow, $current_screen, $gd_cpt_screen; |
|
| 2576 | - |
|
| 2577 | - if ( ( $pagenow == 'edit.php' || $pagenow == 'edit-tags.php' ) && !empty( $current_screen->post_type ) ) {
|
|
| 2578 | - if ( empty( $gd_cpt_screen ) ) {
|
|
| 2579 | - if ( in_array( $current_screen->post_type, geodir_get_posttypes() ) ) {
|
|
| 2580 | - $gd_cpt_screen = 'y'; |
|
| 2581 | - } else {
|
|
| 2582 | - $gd_cpt_screen = 'n'; |
|
| 2583 | - } |
|
| 2584 | - } |
|
| 2585 | - |
|
| 2586 | - if ( $gd_cpt_screen == 'y' ) {
|
|
| 2587 | - if ( $pagenow == 'edit.php' ) {
|
|
| 2588 | - add_filter( 'post_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2589 | - add_filter( 'page_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2590 | - } elseif ( $pagenow == 'edit-tags.php' && !empty( $current_screen->taxonomy ) ) {
|
|
| 2591 | - add_filter( $current_screen->taxonomy . '_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2592 | - } |
|
| 2593 | - } |
|
| 2594 | - } |
|
| 2575 | + global $pagenow, $current_screen, $gd_cpt_screen; |
|
| 2576 | + |
|
| 2577 | + if ( ( $pagenow == 'edit.php' || $pagenow == 'edit-tags.php' ) && !empty( $current_screen->post_type ) ) {
|
|
| 2578 | + if ( empty( $gd_cpt_screen ) ) {
|
|
| 2579 | + if ( in_array( $current_screen->post_type, geodir_get_posttypes() ) ) {
|
|
| 2580 | + $gd_cpt_screen = 'y'; |
|
| 2581 | + } else {
|
|
| 2582 | + $gd_cpt_screen = 'n'; |
|
| 2583 | + } |
|
| 2584 | + } |
|
| 2585 | + |
|
| 2586 | + if ( $gd_cpt_screen == 'y' ) {
|
|
| 2587 | + if ( $pagenow == 'edit.php' ) {
|
|
| 2588 | + add_filter( 'post_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2589 | + add_filter( 'page_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2590 | + } elseif ( $pagenow == 'edit-tags.php' && !empty( $current_screen->taxonomy ) ) {
|
|
| 2591 | + add_filter( $current_screen->taxonomy . '_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2592 | + } |
|
| 2593 | + } |
|
| 2594 | + } |
|
| 2595 | 2595 | } |
| 2596 | 2596 | add_action( 'admin_head', 'geodir_check_quick_edit', 10 ); |
| 2597 | 2597 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | function geodir_get_admin_option_form($current_tab) |
| 64 | 64 | {
|
| 65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
| 65 | + geodir_admin_option_form($current_tab); // defined in admin template tags.php |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
|
| 71 | 71 | add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
|
| 72 | 72 | add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
|
| 73 | -add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
|
|
| 73 | +add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
|
|
| 74 | 74 | |
| 75 | 75 | //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
|
| 76 | 76 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // Disable VC editor for GD post types. |
| 101 | 101 | if (class_exists('Vc_Role_Access_Controller')) {
|
| 102 | - add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 ); |
|
| 102 | + add_filter('vc_role_access_with_post_types_can', '__return_false', 100);
|
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | add_action('admin_panel_init', 'geodir_admin_list_columns', 2);
|
| 127 | 127 | |
| 128 | 128 | /* --- insert dummy post action ---*/ |
| 129 | -add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3);
|
|
| 130 | -add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3);
|
|
| 129 | +add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3);
|
|
| 130 | +add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3);
|
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | // Filter-Payment-Manager |
| 238 | 238 | |
| 239 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 239 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 240 | 240 | |
| 241 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 241 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 242 | 242 | |
| 243 | 243 | // no need of this box as all fields moved to main information box |
| 244 | 244 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | -add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 250 | +add_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
| 276 | 276 | |
| 277 | - if(!empty($gd_taxonomy)) {
|
|
| 277 | + if (!empty($gd_taxonomy)) {
|
|
| 278 | 278 | foreach ($gd_taxonomy as $tax) {
|
| 279 | 279 | |
| 280 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 280 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
| 281 | 281 | |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -363,14 +363,14 @@ discard block |
||
| 363 | 363 | add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined');
|
| 364 | 364 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
|
| 365 | 365 | |
| 366 | -function geodir_manage_available_fields_predefined($sub_tab){
|
|
| 367 | - if($sub_tab=='custom_fields'){
|
|
| 366 | +function geodir_manage_available_fields_predefined($sub_tab) {
|
|
| 367 | + if ($sub_tab == 'custom_fields') {
|
|
| 368 | 368 | geodir_custom_available_fields('predefined');
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | -function geodir_manage_available_fields_custom($sub_tab){
|
|
| 373 | - if($sub_tab=='custom_fields'){
|
|
| 372 | +function geodir_manage_available_fields_custom($sub_tab) {
|
|
| 373 | + if ($sub_tab == 'custom_fields') {
|
|
| 374 | 374 | geodir_custom_available_fields('custom');
|
| 375 | 375 | } |
| 376 | 376 | } |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | global $wpdb; |
| 441 | 441 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 442 | 442 | ?> |
| 443 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 443 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 444 | 444 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 445 | 445 | <ul> |
| 446 | 446 | <?php |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | $check_html_variable = $wpdb->get_var( |
| 453 | 453 | $wpdb->prepare( |
| 454 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 454 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 455 | 455 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
| 456 | 456 | ) |
| 457 | 457 | ); |
@@ -459,23 +459,23 @@ discard block |
||
| 459 | 459 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
| 460 | 460 | ?> |
| 461 | 461 | |
| 462 | - <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
|
| 462 | + <li class="gd-cf-tooltip-wrap" <?php echo $display; ?>> |
|
| 463 | 463 | <?php |
| 464 | - if(isset($val['description']) && $val['description']){
|
|
| 464 | + if (isset($val['description']) && $val['description']) {
|
|
| 465 | 465 | echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
| 466 | 466 | }?> |
| 467 | 467 | |
| 468 | - <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>" data-field-type="<?php echo $val['field_type'];?>" |
|
| 469 | - title="<?php echo $val['site_title'];?>" |
|
| 470 | - class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
|
| 468 | + <a id="gd-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" data-field-type-key="<?php echo $val['htmlvar_name']; ?>" data-field-type="<?php echo $val['field_type']; ?>" |
|
| 469 | + title="<?php echo $val['site_title']; ?>" |
|
| 470 | + class="gd-draggable-form-items gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);"> |
|
| 471 | 471 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
|
| 472 | 472 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
| 473 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 473 | + }elseif (isset($val['field_icon']) && $val['field_icon']) {
|
|
| 474 | 474 | echo '<b style="background-image: url("'.$val['field_icon'].'")"></b>';
|
| 475 | - }else{
|
|
| 475 | + } else {
|
|
| 476 | 476 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 477 | 477 | }?> |
| 478 | - <?php echo $val['site_title'];?> |
|
| 478 | + <?php echo $val['site_title']; ?> |
|
| 479 | 479 | </a> |
| 480 | 480 | </li> |
| 481 | 481 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | <?php |
| 504 | 504 | global $wpdb; |
| 505 | 505 | |
| 506 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 506 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 507 | 507 | |
| 508 | 508 | if (!empty($fields)) {
|
| 509 | 509 | foreach ($fields as $field) {
|
@@ -528,14 +528,14 @@ discard block |
||
| 528 | 528 | * @since 1.6.9 |
| 529 | 529 | * @package GeoDirectory |
| 530 | 530 | */ |
| 531 | -function geodir_custom_fields_custom($post_type=''){
|
|
| 531 | +function geodir_custom_fields_custom($post_type = '') {
|
|
| 532 | 532 | |
| 533 | 533 | $custom_fields = array(); |
| 534 | 534 | |
| 535 | 535 | /** |
| 536 | 536 | * @see `geodir_custom_fields` |
| 537 | 537 | */ |
| 538 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
|
|
| 538 | + return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type);
|
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | * @since 1.6.6 |
| 547 | 547 | * @package GeoDirectory |
| 548 | 548 | */ |
| 549 | -function geodir_custom_fields($post_type=''){
|
|
| 549 | +function geodir_custom_fields($post_type = '') {
|
|
| 550 | 550 | |
| 551 | 551 | $custom_fields = array( |
| 552 | 552 | 'text' => array( |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | * } |
| 682 | 682 | * @param string $post_type The post type requested. |
| 683 | 683 | */ |
| 684 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 684 | + return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
|
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /** |
@@ -692,25 +692,25 @@ discard block |
||
| 692 | 692 | * @param string $type The custom field type, predefined, custom or blank for default |
| 693 | 693 | * @package GeoDirectory |
| 694 | 694 | */ |
| 695 | -function geodir_custom_available_fields($type='') |
|
| 695 | +function geodir_custom_available_fields($type = '') |
|
| 696 | 696 | {
|
| 697 | 697 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 698 | 698 | ?> |
| 699 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 699 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 700 | 700 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
| 701 | 701 | |
| 702 | 702 | <?php |
| 703 | - if($type=='predefined'){
|
|
| 703 | + if ($type == 'predefined') {
|
|
| 704 | 704 | $cfs = geodir_custom_fields_predefined($listing_type); |
| 705 | - }elseif($type=='custom'){
|
|
| 705 | + }elseif ($type == 'custom') {
|
|
| 706 | 706 | $cfs = geodir_custom_fields_custom($listing_type); |
| 707 | - }else{
|
|
| 707 | + } else {
|
|
| 708 | 708 | $cfs = geodir_custom_fields($listing_type); |
| 709 | 709 | ?> |
| 710 | 710 | <ul class="full gd-cf-tooltip-wrap"> |
| 711 | 711 | <li> |
| 712 | 712 | <div class="gdcf-tooltip"> |
| 713 | - <?php _e('This adds a section separator with a title.', 'geodirectory');?>
|
|
| 713 | + <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
|
|
| 714 | 714 | </div> |
| 715 | 715 | <a id="gt-fieldset" |
| 716 | 716 | class="gd-draggable-form-items gt-fieldset" |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | |
| 722 | 722 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 723 | 723 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 724 | - <?php _e('Fieldset (section separator)', 'geodirectory');?>
|
|
| 724 | + <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
|
|
| 725 | 725 | </a> |
| 726 | 726 | </li> |
| 727 | 727 | </ul> |
@@ -729,15 +729,15 @@ discard block |
||
| 729 | 729 | <?php |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - if(!empty($cfs)) {
|
|
| 732 | + if (!empty($cfs)) {
|
|
| 733 | 733 | echo '<ul>'; |
| 734 | - foreach ( $cfs as $id => $cf ) {
|
|
| 734 | + foreach ($cfs as $id => $cf) {
|
|
| 735 | 735 | ?> |
| 736 | 736 | |
| 737 | 737 | <li class="gd-cf-tooltip-wrap"> |
| 738 | 738 | <?php |
| 739 | - if ( isset( $cf['description'] ) && $cf['description'] ) {
|
|
| 740 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
| 739 | + if (isset($cf['description']) && $cf['description']) {
|
|
| 740 | + echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
| 741 | 741 | } ?> |
| 742 | 742 | |
| 743 | 743 | <a id="gd-<?php echo $id; ?>" |
@@ -747,10 +747,10 @@ discard block |
||
| 747 | 747 | class="gd-draggable-form-items <?php echo $cf['class']; ?>" |
| 748 | 748 | href="javascript:void(0);"> |
| 749 | 749 | |
| 750 | - <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
|
|
| 751 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
| 752 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
|
|
| 753 | - echo '<b style="background-image: url("' . $cf['icon'] . '")"></b>';
|
|
| 750 | + <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
|
| 751 | + echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 752 | + } elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 753 | + echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 754 | 754 | } else {
|
| 755 | 755 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 756 | 756 | } ?> |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | </li> |
| 760 | 760 | <?php |
| 761 | 761 | } |
| 762 | - }else{
|
|
| 762 | + } else {
|
|
| 763 | 763 | _e('There are no custom fields here yet.', 'geodirectory');
|
| 764 | 764 | } |
| 765 | 765 | ?> |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | <ul class="core"> |
| 788 | 788 | <?php |
| 789 | 789 | global $wpdb; |
| 790 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 790 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 791 | 791 | |
| 792 | 792 | if (!empty($fields)) {
|
| 793 | 793 | foreach ($fields as $field) {
|
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | $field_type_key = $field->field_type_key; |
| 798 | 798 | $field_ins_upd = 'display'; |
| 799 | 799 | |
| 800 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 800 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key); |
|
| 801 | 801 | } |
| 802 | 802 | } |
| 803 | 803 | ?></ul> |
@@ -956,8 +956,8 @@ discard block |
||
| 956 | 956 | |
| 957 | 957 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 958 | 958 | |
| 959 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 959 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
|
|
| 960 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
|
|
| 961 | 961 | |
| 962 | 962 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 963 | 963 | |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | case 'diagnosis' : |
| 987 | 987 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
| 988 | 988 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 989 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 989 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 990 | 990 | |
| 991 | 991 | } |
| 992 | 992 | exit(); |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | case 'diagnosis-fix' : |
| 996 | 996 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
| 997 | 997 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 998 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 998 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 999 | 999 | exit(); |
| 1000 | 1000 | break; |
| 1001 | 1001 | } |
@@ -1020,50 +1020,50 @@ discard block |
||
| 1020 | 1020 | {
|
| 1021 | 1021 | global $wpdb; |
| 1022 | 1022 | //$filter_arr['output_str'] .='###'.$table.'###'; |
| 1023 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 1024 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 1023 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
|
|
| 1024 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
|
|
| 1025 | 1025 | $filter_arr['is_error_during_diagnose'] = true; |
| 1026 | 1026 | |
| 1027 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1028 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1027 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 1028 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1029 | 1029 | $filter_arr['is_error_during_diagnose'] = true; |
| 1030 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
|
|
| 1030 | + $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>";
|
|
| 1031 | 1031 | $filter_arr['is_error_during_diagnose'] = true; |
| 1032 | 1032 | |
| 1033 | 1033 | if ($fix) {
|
| 1034 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 1035 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 1034 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
|
|
| 1035 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
|
|
| 1036 | 1036 | |
| 1037 | 1037 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
| 1038 | 1038 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
| 1039 | 1039 | |
| 1040 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 1040 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
|
|
| 1041 | 1041 | |
| 1042 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1043 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 1042 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 1043 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
|
|
| 1044 | 1044 | } else {
|
| 1045 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1045 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
| 1049 | 1049 | |
| 1050 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 1051 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 1050 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
|
|
| 1051 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
|
|
| 1052 | 1052 | |
| 1053 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1053 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1054 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
|
|
| 1055 | 1055 | } else {
|
| 1056 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1056 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
| 1060 | 1060 | |
| 1061 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 1061 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
|
|
| 1062 | 1062 | |
| 1063 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1064 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 1063 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 1064 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
|
|
| 1065 | 1065 | } else {
|
| 1066 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1066 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | } |
@@ -1071,54 +1071,54 @@ discard block |
||
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | |
| 1074 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1075 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1074 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 1075 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1076 | 1076 | $filter_arr['is_error_during_diagnose'] = true; |
| 1077 | 1077 | |
| 1078 | 1078 | if ($fix) {
|
| 1079 | 1079 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
| 1080 | 1080 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
| 1081 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1081 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
|
|
| 1082 | 1082 | } else {
|
| 1083 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1083 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
|
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1088 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1086 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1087 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
|
|
| 1088 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1089 | 1089 | } else {
|
| 1090 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1090 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1091 | 1091 | } |
| 1092 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1092 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1093 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1094 | 1094 | } else {
|
| 1095 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1095 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1096 | 1096 | } |
| 1097 | 1097 | } else {// else rename the original table to _ms_bak
|
| 1098 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1098 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1099 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>";
|
|
| 1100 | 1100 | } else {
|
| 1101 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1101 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>";
|
|
| 1102 | 1102 | } |
| 1103 | 1103 | } |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1107 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1106 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1107 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1108 | 1108 | $filter_arr['is_error_during_diagnose'] = true; |
| 1109 | 1109 | |
| 1110 | 1110 | if ($fix) {
|
| 1111 | 1111 | // if original table exists but new does not, rename |
| 1112 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1112 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1113 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1114 | 1114 | } else {
|
| 1115 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1115 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1121 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1120 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1121 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1122 | 1122 | $filter_arr['is_error_during_diagnose'] = true; |
| 1123 | 1123 | |
| 1124 | 1124 | if ($fix) {
|
@@ -1132,11 +1132,11 @@ discard block |
||
| 1132 | 1132 | delete_option('geodir_custom_posts_db_version');
|
| 1133 | 1133 | delete_option('geodir_reviewratings_db_version');
|
| 1134 | 1134 | delete_option('geodiradvancesearch_db_version');
|
| 1135 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1135 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
|
|
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | } else {
|
| 1139 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1139 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1140 | 1140 | } |
| 1141 | 1141 | return $filter_arr; |
| 1142 | 1142 | } |
@@ -1177,21 +1177,21 @@ discard block |
||
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | if ($stepped_process) {
|
| 1180 | - $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset ); |
|
| 1181 | - $posts = $wpdb->get_results( $sql ); |
|
| 1180 | + $sql = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."geodir_".$ptype."_detail LIMIT %d OFFSET %d", $step_max_items, $offset);
|
|
| 1181 | + $posts = $wpdb->get_results($sql); |
|
| 1182 | 1182 | |
| 1183 | 1183 | if (!empty($posts)) {
|
| 1184 | 1184 | |
| 1185 | 1185 | foreach ($posts as $p) {
|
| 1186 | 1186 | $p->post_type = $ptype; |
| 1187 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1187 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1188 | 1188 | if (empty($raw_tags)) {
|
| 1189 | 1189 | $post_tags = ''; |
| 1190 | 1190 | } else {
|
| 1191 | 1191 | $post_tags = implode(",", $raw_tags);
|
| 1192 | 1192 | } |
| 1193 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1194 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1193 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1194 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1195 | 1195 | |
| 1196 | 1196 | } |
| 1197 | 1197 | if ($step >= $max_step) {
|
@@ -1207,23 +1207,23 @@ discard block |
||
| 1207 | 1207 | if (!empty($all_postypes)) {
|
| 1208 | 1208 | foreach ($all_postypes as $key) {
|
| 1209 | 1209 | // update each GD CPT |
| 1210 | - $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1210 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail");
|
|
| 1211 | 1211 | |
| 1212 | 1212 | if (!empty($posts)) {
|
| 1213 | 1213 | |
| 1214 | 1214 | foreach ($posts as $p) {
|
| 1215 | 1215 | $p->post_type = $key; |
| 1216 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1216 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1217 | 1217 | if (empty($raw_tags)) {
|
| 1218 | 1218 | $post_tags = ''; |
| 1219 | 1219 | } else {
|
| 1220 | 1220 | $post_tags = implode(",", $raw_tags);
|
| 1221 | 1221 | } |
| 1222 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1223 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1222 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1223 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1224 | 1224 | |
| 1225 | 1225 | } |
| 1226 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1226 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | } |
@@ -1234,14 +1234,14 @@ discard block |
||
| 1234 | 1234 | |
| 1235 | 1235 | if ($is_error_during_diagnose) {
|
| 1236 | 1236 | $info_div_class = "geodir_problem_info"; |
| 1237 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1237 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1238 | 1238 | } else {
|
| 1239 | 1239 | $info_div_class = "geodir_noproblem_info"; |
| 1240 | 1240 | $fix_button_txt = ''; |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | if ($stepped_process) {
|
| 1244 | - $percent = ($step/$max_step) * 100; |
|
| 1244 | + $percent = ($step / $max_step) * 100; |
|
| 1245 | 1245 | if ($output_str == 'done') {
|
| 1246 | 1246 | echo $output_str; |
| 1247 | 1247 | } else {
|
@@ -1284,29 +1284,29 @@ discard block |
||
| 1284 | 1284 | if (!empty($all_postypes)) {
|
| 1285 | 1285 | foreach ($all_postypes as $key) {
|
| 1286 | 1286 | // update each GD CTP |
| 1287 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1287 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
|
|
| 1288 | 1288 | |
| 1289 | 1289 | if (!empty($posts)) {
|
| 1290 | 1290 | |
| 1291 | 1291 | foreach ($posts as $p) {
|
| 1292 | 1292 | $p->post_type = $key; |
| 1293 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1293 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
|
|
| 1294 | 1294 | |
| 1295 | 1295 | if (empty($raw_cats)) {
|
| 1296 | 1296 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
| 1297 | 1297 | |
| 1298 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1299 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1300 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1298 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
|
|
| 1299 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
|
|
| 1300 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
|
|
| 1301 | 1301 | if (is_numeric($cat_part)) {
|
| 1302 | - $raw_cats[] = (int)$cat_part; |
|
| 1302 | + $raw_cats[] = (int) $cat_part; |
|
| 1303 | 1303 | } |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | 1308 | if (!empty($raw_cats)) {
|
| 1309 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1309 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
| 1310 | 1310 | |
| 1311 | 1311 | } |
| 1312 | 1312 | |
@@ -1316,14 +1316,14 @@ discard block |
||
| 1316 | 1316 | if (empty($raw_cats)) {
|
| 1317 | 1317 | $post_cats = ''; |
| 1318 | 1318 | } else {
|
| 1319 | - $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1319 | + $post_cats = ','.implode(",", $raw_cats).',';
|
|
| 1320 | 1320 | } |
| 1321 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1322 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1321 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1322 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | 1325 | } |
| 1326 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1326 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1327 | 1327 | |
| 1328 | 1328 | } |
| 1329 | 1329 | |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | if ($is_error_during_diagnose) {
|
| 1333 | 1333 | $info_div_class = "geodir_problem_info"; |
| 1334 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1334 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1335 | 1335 | } else {
|
| 1336 | 1336 | $info_div_class = "geodir_noproblem_info"; |
| 1337 | 1337 | $fix_button_txt = ''; |
@@ -1384,15 +1384,15 @@ discard block |
||
| 1384 | 1384 | if (!empty($ver_arr)) {
|
| 1385 | 1385 | foreach ($ver_arr as $key => $val) {
|
| 1386 | 1386 | if (delete_option($val)) {
|
| 1387 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1387 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
|
|
| 1388 | 1388 | } else {
|
| 1389 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1389 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
|
|
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | 1394 | if ($output_str) {
|
| 1395 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1395 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
|
|
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | 1398 | } |
@@ -1429,43 +1429,43 @@ discard block |
||
| 1429 | 1429 | $output_str = ''; |
| 1430 | 1430 | |
| 1431 | 1431 | // check review locations |
| 1432 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1432 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1433 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
|
|
| 1434 | 1434 | $is_error_during_diagnose = true; |
| 1435 | 1435 | |
| 1436 | 1436 | if ($fix) {
|
| 1437 | 1437 | if (geodir_fix_review_location()) {
|
| 1438 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1438 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
|
|
| 1439 | 1439 | } else {
|
| 1440 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1440 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
|
|
| 1441 | 1441 | } |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | 1444 | } else {
|
| 1445 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1445 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
|
|
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | 1448 | // check review content |
| 1449 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1450 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1449 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
|
|
| 1450 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
|
|
| 1451 | 1451 | $is_error_during_diagnose = true; |
| 1452 | 1452 | |
| 1453 | 1453 | if ($fix) {
|
| 1454 | 1454 | if (geodir_fix_review_content()) {
|
| 1455 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1455 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
|
|
| 1456 | 1456 | } else {
|
| 1457 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1457 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
|
|
| 1458 | 1458 | } |
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | 1461 | } else {
|
| 1462 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1462 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
|
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | |
| 1466 | 1466 | if ($is_error_during_diagnose) {
|
| 1467 | 1467 | $info_div_class = "geodir_problem_info"; |
| 1468 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1468 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1469 | 1469 | } else {
|
| 1470 | 1470 | $info_div_class = "geodir_noproblem_info"; |
| 1471 | 1471 | $fix_button_txt = ''; |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | |
| 1530 | 1530 | if ($is_error_during_diagnose) {
|
| 1531 | 1531 | $info_div_class = "geodir_problem_info"; |
| 1532 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1532 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1533 | 1533 | } else {
|
| 1534 | 1534 | $info_div_class = "geodir_noproblem_info"; |
| 1535 | 1535 | $fix_button_txt = ''; |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | else {
|
| 1564 | 1564 | $page_found = $wpdb->get_var( |
| 1565 | 1565 | $wpdb->prepare( |
| 1566 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1566 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
| 1567 | 1567 | array($slug) |
| 1568 | 1568 | ) |
| 1569 | 1569 | ); |
@@ -1609,18 +1609,18 @@ discard block |
||
| 1609 | 1609 | ////////////////////////////////// |
| 1610 | 1610 | $option_value = get_option('geodir_home_page');
|
| 1611 | 1611 | $page = get_post($option_value); |
| 1612 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1612 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1613 | 1613 | |
| 1614 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1615 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1614 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1615 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1616 | 1616 | else {
|
| 1617 | 1617 | $is_error_during_diagnose = true; |
| 1618 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1618 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1619 | 1619 | if ($fix) {
|
| 1620 | 1620 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
| 1621 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1621 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
|
|
| 1622 | 1622 | } else {
|
| 1623 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1623 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1624 | 1624 | } |
| 1625 | 1625 | } |
| 1626 | 1626 | } |
@@ -1634,18 +1634,18 @@ discard block |
||
| 1634 | 1634 | ////////////////////////////////// |
| 1635 | 1635 | $option_value = get_option('geodir_add_listing_page');
|
| 1636 | 1636 | $page = get_post($option_value); |
| 1637 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1637 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1638 | 1638 | |
| 1639 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1640 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1639 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1640 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1641 | 1641 | else {
|
| 1642 | 1642 | $is_error_during_diagnose = true; |
| 1643 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1643 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1644 | 1644 | if ($fix) {
|
| 1645 | 1645 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
| 1646 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1646 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
|
|
| 1647 | 1647 | } else {
|
| 1648 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1648 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1649 | 1649 | } |
| 1650 | 1650 | } |
| 1651 | 1651 | } |
@@ -1660,18 +1660,18 @@ discard block |
||
| 1660 | 1660 | ////////////////////////////////// |
| 1661 | 1661 | $option_value = get_option('geodir_preview_page');
|
| 1662 | 1662 | $page = get_post($option_value); |
| 1663 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1663 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1664 | 1664 | |
| 1665 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1666 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1665 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1666 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1667 | 1667 | else {
|
| 1668 | 1668 | $is_error_during_diagnose = true; |
| 1669 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1669 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1670 | 1670 | if ($fix) {
|
| 1671 | 1671 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
| 1672 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1672 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
|
|
| 1673 | 1673 | } else {
|
| 1674 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1674 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1675 | 1675 | } |
| 1676 | 1676 | } |
| 1677 | 1677 | } |
@@ -1685,18 +1685,18 @@ discard block |
||
| 1685 | 1685 | ////////////////////////////////// |
| 1686 | 1686 | $option_value = get_option('geodir_success_page');
|
| 1687 | 1687 | $page = get_post($option_value); |
| 1688 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1688 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1689 | 1689 | |
| 1690 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1691 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1690 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1691 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1692 | 1692 | else {
|
| 1693 | 1693 | $is_error_during_diagnose = true; |
| 1694 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1694 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1695 | 1695 | if ($fix) {
|
| 1696 | 1696 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
| 1697 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1697 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
|
|
| 1698 | 1698 | } else {
|
| 1699 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1699 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1700 | 1700 | } |
| 1701 | 1701 | } |
| 1702 | 1702 | } |
@@ -1710,18 +1710,18 @@ discard block |
||
| 1710 | 1710 | ////////////////////////////////// |
| 1711 | 1711 | $option_value = get_option('geodir_info_page');
|
| 1712 | 1712 | $page = get_post($option_value); |
| 1713 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1713 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1714 | 1714 | |
| 1715 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1716 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1715 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1716 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1717 | 1717 | else {
|
| 1718 | 1718 | $is_error_during_diagnose = true; |
| 1719 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1719 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1720 | 1720 | if ($fix) {
|
| 1721 | 1721 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
| 1722 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1722 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
|
|
| 1723 | 1723 | } else {
|
| 1724 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1724 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1725 | 1725 | } |
| 1726 | 1726 | } |
| 1727 | 1727 | } |
@@ -1735,18 +1735,18 @@ discard block |
||
| 1735 | 1735 | ////////////////////////////////// |
| 1736 | 1736 | $option_value = get_option('geodir_login_page');
|
| 1737 | 1737 | $page = get_post($option_value); |
| 1738 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1738 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1739 | 1739 | |
| 1740 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1741 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1740 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1741 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1742 | 1742 | else {
|
| 1743 | 1743 | $is_error_during_diagnose = true; |
| 1744 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1744 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1745 | 1745 | if ($fix) {
|
| 1746 | 1746 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
| 1747 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1747 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
|
|
| 1748 | 1748 | } else {
|
| 1749 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1749 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1750 | 1750 | } |
| 1751 | 1751 | } |
| 1752 | 1752 | } |
@@ -1760,18 +1760,18 @@ discard block |
||
| 1760 | 1760 | ////////////////////////////////// |
| 1761 | 1761 | $option_value = get_option('geodir_location_page');
|
| 1762 | 1762 | $page = get_post($option_value); |
| 1763 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1763 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1764 | 1764 | |
| 1765 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1766 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1765 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1766 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1767 | 1767 | else {
|
| 1768 | 1768 | $is_error_during_diagnose = true; |
| 1769 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1769 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1770 | 1770 | if ($fix) {
|
| 1771 | 1771 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
| 1772 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1772 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
|
|
| 1773 | 1773 | } else {
|
| 1774 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1774 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1775 | 1775 | } |
| 1776 | 1776 | } |
| 1777 | 1777 | } |
@@ -1780,13 +1780,13 @@ discard block |
||
| 1780 | 1780 | /* Diagnose Location Page Ends */ |
| 1781 | 1781 | //////////////////////////////// |
| 1782 | 1782 | |
| 1783 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1783 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
|
|
| 1784 | 1784 | /** |
| 1785 | 1785 | * This action is called at the end of the GD Tools page check function. |
| 1786 | 1786 | * |
| 1787 | 1787 | * @since 1.5.2 |
| 1788 | 1788 | */ |
| 1789 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1789 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
|
|
| 1790 | 1790 | |
| 1791 | 1791 | $output_str = $page_chk_arr['output_str']; |
| 1792 | 1792 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1796,7 +1796,7 @@ discard block |
||
| 1796 | 1796 | flush_rewrite_rules(); |
| 1797 | 1797 | } |
| 1798 | 1798 | $info_div_class = "geodir_problem_info"; |
| 1799 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1799 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1800 | 1800 | } else {
|
| 1801 | 1801 | $info_div_class = "geodir_noproblem_info"; |
| 1802 | 1802 | $fix_button_txt = ''; |
@@ -1824,10 +1824,10 @@ discard block |
||
| 1824 | 1824 | $fix_button_txt = ''; |
| 1825 | 1825 | |
| 1826 | 1826 | if ($is_error_during_diagnose) {
|
| 1827 | - $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>";
|
|
| 1827 | + $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>";
|
|
| 1828 | 1828 | $info_div_class = "geodir_problem_info"; |
| 1829 | 1829 | } else {
|
| 1830 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1830 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
|
|
| 1831 | 1831 | $info_div_class = "geodir_noproblem_info"; |
| 1832 | 1832 | $fix_button_txt = ''; |
| 1833 | 1833 | } |
@@ -1869,17 +1869,17 @@ discard block |
||
| 1869 | 1869 | global $wpdb, $wp_query, $plugin_prefix; |
| 1870 | 1870 | |
| 1871 | 1871 | if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
|
| 1872 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1872 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
| 1873 | 1873 | |
| 1874 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1874 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
| 1875 | 1875 | $clauses['join'] = $join; |
| 1876 | 1876 | |
| 1877 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1877 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
| 1878 | 1878 | $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
| 1879 | 1879 | $clauses['fields'] = $fields; |
| 1880 | 1880 | |
| 1881 | 1881 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
| 1882 | - $orderby = 'gd_expire ' . $order; |
|
| 1882 | + $orderby = 'gd_expire '.$order; |
|
| 1883 | 1883 | $clauses['orderby'] = $orderby; |
| 1884 | 1884 | } |
| 1885 | 1885 | return $clauses; |
@@ -1922,7 +1922,7 @@ discard block |
||
| 1922 | 1922 | global $current_user; |
| 1923 | 1923 | $upload_dir = wp_upload_dir(); |
| 1924 | 1924 | |
| 1925 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1925 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
| 1926 | 1926 | $handle = fopen($file, 'w'); |
| 1927 | 1927 | |
| 1928 | 1928 | fwrite($handle, $input); |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | $uploads_dir = $uploads['path']; |
| 1968 | 1968 | $image_name_arr = explode('/', $filename);
|
| 1969 | 1969 | $filename = end($image_name_arr); |
| 1970 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1970 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1971 | 1971 | $return = array(); |
| 1972 | 1972 | $return['file'] = $uploadedFile; |
| 1973 | 1973 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
@@ -1984,8 +1984,8 @@ discard block |
||
| 1984 | 1984 | |
| 1985 | 1985 | if (($handle = fopen($target_path, "r")) !== FALSE) {
|
| 1986 | 1986 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
| 1987 | - if(is_array($data) && !empty($data)) {
|
|
| 1988 | - $file[] = '"' . implode('","', $data) . '"';
|
|
| 1987 | + if (is_array($data) && !empty($data)) {
|
|
| 1988 | + $file[] = '"'.implode('","', $data).'"';
|
|
| 1989 | 1989 | } |
| 1990 | 1990 | } |
| 1991 | 1991 | fclose($handle); |
@@ -2102,10 +2102,10 @@ discard block |
||
| 2102 | 2102 | $tag_arr = explode(',', $post_tags);
|
| 2103 | 2103 | } |
| 2104 | 2104 | |
| 2105 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 2105 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
| 2106 | 2106 | |
| 2107 | 2107 | $error = ''; |
| 2108 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 2108 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
|
|
| 2109 | 2109 | $invalid_post_type++; |
| 2110 | 2110 | continue; |
| 2111 | 2111 | } |
@@ -2131,7 +2131,7 @@ discard block |
||
| 2131 | 2131 | if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
| 2132 | 2132 | $submitdata = date('Y-m-d');
|
| 2133 | 2133 | |
| 2134 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 2134 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
|
|
| 2135 | 2135 | } else {
|
| 2136 | 2136 | $gd_post_info['expire_date'] = 'Never'; |
| 2137 | 2137 | } |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | |
| 2160 | 2160 | // Post status |
| 2161 | 2161 | if ($customKeyarray[$c] == 'post_status') {
|
| 2162 | - $post_status = sanitize_key( $buffer[$c] ); |
|
| 2162 | + $post_status = sanitize_key($buffer[$c]); |
|
| 2163 | 2163 | } |
| 2164 | 2164 | } |
| 2165 | 2165 | |
@@ -2177,8 +2177,8 @@ discard block |
||
| 2177 | 2177 | |
| 2178 | 2178 | // Default post status |
| 2179 | 2179 | $default_status = 'publish'; |
| 2180 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 2181 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 2180 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 2181 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 2182 | 2182 | |
| 2183 | 2183 | $my_post['post_title'] = $post_title; |
| 2184 | 2184 | $my_post['post_content'] = $post_desc; |
@@ -2222,7 +2222,7 @@ discard block |
||
| 2222 | 2222 | $payment_info = array(); |
| 2223 | 2223 | $package_info = array(); |
| 2224 | 2224 | |
| 2225 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2225 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2226 | 2226 | $package_id = ''; |
| 2227 | 2227 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
| 2228 | 2228 | $package_id = $gd_post_info['package_id']; |
@@ -2232,7 +2232,7 @@ discard block |
||
| 2232 | 2232 | $payment_info['package_id'] = $package_info['pid']; |
| 2233 | 2233 | |
| 2234 | 2234 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
| 2235 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2235 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
|
|
| 2236 | 2236 | } else {
|
| 2237 | 2237 | $payment_info['expire_date'] = 'Never'; |
| 2238 | 2238 | } |
@@ -2244,7 +2244,7 @@ discard block |
||
| 2244 | 2244 | |
| 2245 | 2245 | $post_type = get_post_type($last_postid); |
| 2246 | 2246 | |
| 2247 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2247 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2248 | 2248 | |
| 2249 | 2249 | geodir_save_post_info($last_postid, $gd_post_info); |
| 2250 | 2250 | |
@@ -2265,7 +2265,7 @@ discard block |
||
| 2265 | 2265 | $attachment['post_id'] = $last_postid; |
| 2266 | 2266 | $attachment['title'] = $img_name_arr[0]; |
| 2267 | 2267 | $attachment['content'] = ''; |
| 2268 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2268 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
| 2269 | 2269 | $attachment['mime_type'] = $uploaded_file_type; |
| 2270 | 2270 | $attachment['menu_order'] = $menu_order; |
| 2271 | 2271 | $attachment['is_featured'] = 0; |
@@ -2274,15 +2274,15 @@ discard block |
||
| 2274 | 2274 | |
| 2275 | 2275 | foreach ($attachment as $key => $val) {
|
| 2276 | 2276 | if ($val != '') |
| 2277 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2277 | + $attachment_set .= $key." = '".$val."', "; |
|
| 2278 | 2278 | } |
| 2279 | 2279 | $attachment_set = trim($attachment_set, ", "); |
| 2280 | 2280 | |
| 2281 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2281 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 2282 | 2282 | |
| 2283 | 2283 | if ($menu_order == 1) {
|
| 2284 | 2284 | $post_type = get_post_type($last_postid); |
| 2285 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2285 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
|
|
| 2286 | 2286 | } |
| 2287 | 2287 | $menu_order++; |
| 2288 | 2288 | } |
@@ -2323,11 +2323,11 @@ discard block |
||
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | 2325 | // Add the tab in left sidebar menu fro import & export page. |
| 2326 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
| 2326 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
|
|
| 2327 | 2327 | |
| 2328 | 2328 | // Handle ajax request for import/export. |
| 2329 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
| 2330 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
| 2329 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
|
|
| 2330 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
|
|
| 2331 | 2331 | |
| 2332 | 2332 | |
| 2333 | 2333 | /** |
@@ -2338,40 +2338,40 @@ discard block |
||
| 2338 | 2338 | * @param $post_id int $post_id The post ID of the post being saved. |
| 2339 | 2339 | * @param $post object $post The post object of the post being saved. |
| 2340 | 2340 | */ |
| 2341 | -function geodir_update_location_prefix($post_id,$post){
|
|
| 2342 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2343 | - update_option('geodir_location_prefix',$post->post_name);
|
|
| 2341 | +function geodir_update_location_prefix($post_id, $post) {
|
|
| 2342 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
|
|
| 2343 | + update_option('geodir_location_prefix', $post->post_name);
|
|
| 2344 | 2344 | } |
| 2345 | 2345 | |
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | -add_action('save_post', 'geodir_update_location_prefix',10,2);
|
|
| 2348 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2);
|
|
| 2349 | 2349 | |
| 2350 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
| 2350 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
|
|
| 2351 | 2351 | |
| 2352 | -function geodir_ga_callback(){
|
|
| 2352 | +function geodir_ga_callback() {
|
|
| 2353 | 2353 | |
| 2354 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2354 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2355 | 2355 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
| 2356 | 2356 | $code = "code=".$_REQUEST['code']; |
| 2357 | 2357 | $grant_type = "&grant_type=authorization_code"; |
| 2358 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2358 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
|
|
| 2359 | 2359 | $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
| 2360 | 2360 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
| 2361 | 2361 | |
| 2362 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2362 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
| 2363 | 2363 | |
| 2364 | 2364 | $response = wp_remote_post($auth_url, array('timeout' => 15));
|
| 2365 | 2365 | |
| 2366 | 2366 | //print_r($response); |
| 2367 | 2367 | |
| 2368 | - $error_msg = __('Something went wrong','geodirectory');
|
|
| 2369 | - if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2368 | + $error_msg = __('Something went wrong', 'geodirectory');
|
|
| 2369 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
|
|
| 2370 | 2370 | |
| 2371 | 2371 | $parts = json_decode($response['body']); |
| 2372 | 2372 | //print_r($parts); |
| 2373 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2374 | - else{
|
|
| 2373 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
|
|
| 2374 | + else {
|
|
| 2375 | 2375 | |
| 2376 | 2376 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2377 | 2377 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2380,18 +2380,18 @@ discard block |
||
| 2380 | 2380 | |
| 2381 | 2381 | |
| 2382 | 2382 | } |
| 2383 | - elseif(!empty($response['response']['code'])) {
|
|
| 2383 | + elseif (!empty($response['response']['code'])) {
|
|
| 2384 | 2384 | $parts = json_decode($response['body']); |
| 2385 | 2385 | |
| 2386 | - if(isset($parts->error)){
|
|
| 2387 | - echo $parts->error.": ".$parts->error_description;exit; |
|
| 2388 | - }else{
|
|
| 2389 | - echo $error_msg." - #2";exit; |
|
| 2386 | + if (isset($parts->error)) {
|
|
| 2387 | + echo $parts->error.": ".$parts->error_description; exit; |
|
| 2388 | + } else {
|
|
| 2389 | + echo $error_msg." - #2"; exit; |
|
| 2390 | 2390 | } |
| 2391 | 2391 | |
| 2392 | - }else{
|
|
| 2392 | + } else {
|
|
| 2393 | 2393 | |
| 2394 | - echo $error_msg." - #3";exit; |
|
| 2394 | + echo $error_msg." - #3"; exit; |
|
| 2395 | 2395 | |
| 2396 | 2396 | } |
| 2397 | 2397 | } |
@@ -2413,7 +2413,7 @@ discard block |
||
| 2413 | 2413 | function geodir_uninstall_settings($general_settings) {
|
| 2414 | 2414 | $settings = array(); |
| 2415 | 2415 | $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
| 2416 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
| 2416 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
|
|
| 2417 | 2417 | |
| 2418 | 2418 | $plugins = get_plugins(); |
| 2419 | 2419 | $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
@@ -2425,7 +2425,7 @@ discard block |
||
| 2425 | 2425 | if (in_array($plugin_name, $un_plugins)) {
|
| 2426 | 2426 | $settings[] = array( |
| 2427 | 2427 | 'type' => 'checkbox', |
| 2428 | - 'id' => 'geodir_un_' . $plugin_name, |
|
| 2428 | + 'id' => 'geodir_un_'.$plugin_name, |
|
| 2429 | 2429 | 'name' => $data['Name'], |
| 2430 | 2430 | 'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
| 2431 | 2431 | 'std' => '0' |
@@ -2459,7 +2459,7 @@ discard block |
||
| 2459 | 2459 | * @since 1.6.9 |
| 2460 | 2460 | */ |
| 2461 | 2461 | function geodir_uninstall_settings_desc() {
|
| 2462 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory') . '</p>';
|
|
| 2462 | + echo '<p class="gd-un-settings-desc">'.__('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory').'</p>';
|
|
| 2463 | 2463 | } |
| 2464 | 2464 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
|
| 2465 | 2465 | |
@@ -2523,12 +2523,12 @@ discard block |
||
| 2523 | 2523 | |
| 2524 | 2524 | |
| 2525 | 2525 | if ($delete) {
|
| 2526 | - $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
| 2526 | + $output_str .= "<li><strong>".__('Table dropped, refresh page to reinstall.', 'geodirectory')."</strong></li>";
|
|
| 2527 | 2527 | ob_start(); |
| 2528 | 2528 | geodir_diagnose_version_clear(); |
| 2529 | 2529 | ob_end_clean(); |
| 2530 | - }else{
|
|
| 2531 | - $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
|
|
| 2530 | + } else {
|
|
| 2531 | + $output_str .= "<li><strong>".__('Something went wrong.', 'geodirectory')."</strong></li>";
|
|
| 2532 | 2532 | } |
| 2533 | 2533 | |
| 2534 | 2534 | if ($is_error_during_diagnose) {
|
@@ -2553,9 +2553,9 @@ discard block |
||
| 2553 | 2553 | * @param object $row The post|taxonomy object. |
| 2554 | 2554 | * @return array Filtered actions. |
| 2555 | 2555 | */ |
| 2556 | -function geodir_disable_quick_edit( $actions = array(), $row = null ) {
|
|
| 2557 | - if ( isset( $actions['inline hide-if-no-js'] ) ) {
|
|
| 2558 | - unset( $actions['inline hide-if-no-js'] ); |
|
| 2556 | +function geodir_disable_quick_edit($actions = array(), $row = null) {
|
|
| 2557 | + if (isset($actions['inline hide-if-no-js'])) {
|
|
| 2558 | + unset($actions['inline hide-if-no-js']); |
|
| 2559 | 2559 | } |
| 2560 | 2560 | |
| 2561 | 2561 | return $actions; |
@@ -2574,24 +2574,24 @@ discard block |
||
| 2574 | 2574 | function geodir_check_quick_edit() {
|
| 2575 | 2575 | global $pagenow, $current_screen, $gd_cpt_screen; |
| 2576 | 2576 | |
| 2577 | - if ( ( $pagenow == 'edit.php' || $pagenow == 'edit-tags.php' ) && !empty( $current_screen->post_type ) ) {
|
|
| 2578 | - if ( empty( $gd_cpt_screen ) ) {
|
|
| 2579 | - if ( in_array( $current_screen->post_type, geodir_get_posttypes() ) ) {
|
|
| 2577 | + if (($pagenow == 'edit.php' || $pagenow == 'edit-tags.php') && !empty($current_screen->post_type)) {
|
|
| 2578 | + if (empty($gd_cpt_screen)) {
|
|
| 2579 | + if (in_array($current_screen->post_type, geodir_get_posttypes())) {
|
|
| 2580 | 2580 | $gd_cpt_screen = 'y'; |
| 2581 | 2581 | } else {
|
| 2582 | 2582 | $gd_cpt_screen = 'n'; |
| 2583 | 2583 | } |
| 2584 | 2584 | } |
| 2585 | 2585 | |
| 2586 | - if ( $gd_cpt_screen == 'y' ) {
|
|
| 2587 | - if ( $pagenow == 'edit.php' ) {
|
|
| 2588 | - add_filter( 'post_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2589 | - add_filter( 'page_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2590 | - } elseif ( $pagenow == 'edit-tags.php' && !empty( $current_screen->taxonomy ) ) {
|
|
| 2591 | - add_filter( $current_screen->taxonomy . '_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2586 | + if ($gd_cpt_screen == 'y') {
|
|
| 2587 | + if ($pagenow == 'edit.php') {
|
|
| 2588 | + add_filter('post_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
| 2589 | + add_filter('page_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
| 2590 | + } elseif ($pagenow == 'edit-tags.php' && !empty($current_screen->taxonomy)) {
|
|
| 2591 | + add_filter($current_screen->taxonomy.'_row_actions', 'geodir_disable_quick_edit', 10, 2); |
|
| 2592 | 2592 | } |
| 2593 | 2593 | } |
| 2594 | 2594 | } |
| 2595 | 2595 | } |
| 2596 | -add_action( 'admin_head', 'geodir_check_quick_edit', 10 ); |
|
| 2596 | +add_action('admin_head', 'geodir_check_quick_edit', 10);
|
|
| 2597 | 2597 | |
@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function geodir_theme_location_setting_fun() |
| 18 | 18 | {
|
| 19 | - $post_type_arr = array(); |
|
| 20 | - $geodir_all_nav_locations = get_registered_nav_menus(); |
|
| 21 | - $geodir_active_nav_locations = get_nav_menu_locations(); |
|
| 22 | - if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
|
|
| 23 | - foreach ($geodir_active_nav_locations as $key => $theme_location) {
|
|
| 24 | - if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) |
|
| 25 | - $post_type_arr[$key] = $geodir_all_nav_locations[$key]; |
|
| 26 | - } |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - return $post_type_arr; |
|
| 19 | + $post_type_arr = array(); |
|
| 20 | + $geodir_all_nav_locations = get_registered_nav_menus(); |
|
| 21 | + $geodir_active_nav_locations = get_nav_menu_locations(); |
|
| 22 | + if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
|
|
| 23 | + foreach ($geodir_active_nav_locations as $key => $theme_location) {
|
|
| 24 | + if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) |
|
| 25 | + $post_type_arr[$key] = $geodir_all_nav_locations[$key]; |
|
| 26 | + } |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + return $post_type_arr; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -37,198 +37,198 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | $geodir_settings['design_settings'] = apply_filters('geodir_design_settings', array(
|
| 39 | 39 | |
| 40 | - /* Home Layout Settings start */ |
|
| 41 | - array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
|
|
| 40 | + /* Home Layout Settings start */ |
|
| 41 | + array('name' => __('Home', 'geodirectory'), 'type' => 'title', 'desc' => 'Setting to set home page layout', 'id' => 'home_page_settings '),
|
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - array('name' => __('Home Top Section Settings', 'geodirectory'),
|
|
| 45 | - 'type' => 'sectionstart', |
|
| 46 | - 'desc' => '', |
|
| 47 | - 'id' => 'geodir_home_top_section'), |
|
| 44 | + array('name' => __('Home Top Section Settings', 'geodirectory'),
|
|
| 45 | + 'type' => 'sectionstart', |
|
| 46 | + 'desc' => '', |
|
| 47 | + 'id' => 'geodir_home_top_section'), |
|
| 48 | 48 | |
| 49 | - array( |
|
| 50 | - 'name' => __('Home top section', 'geodirectory'),
|
|
| 51 | - 'desc' => __('Show the top section of home page', 'geodirectory'),
|
|
| 52 | - 'id' => 'geodir_show_home_top_section', |
|
| 53 | - 'type' => 'checkbox', |
|
| 54 | - 'std' => '1' // Default value to show home top section |
|
| 55 | - ), |
|
| 49 | + array( |
|
| 50 | + 'name' => __('Home top section', 'geodirectory'),
|
|
| 51 | + 'desc' => __('Show the top section of home page', 'geodirectory'),
|
|
| 52 | + 'id' => 'geodir_show_home_top_section', |
|
| 53 | + 'type' => 'checkbox', |
|
| 54 | + 'std' => '1' // Default value to show home top section |
|
| 55 | + ), |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | - array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
|
|
| 58 | + array('type' => 'sectionend', 'id' => 'geodir_home_top_section'),
|
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | - array('name' => __('Home Page Layout Settings', 'geodirectory'),
|
|
| 62 | - 'type' => 'sectionstart', |
|
| 63 | - 'desc' => '', |
|
| 64 | - 'id' => 'geodir_home_layout'), |
|
| 61 | + array('name' => __('Home Page Layout Settings', 'geodirectory'),
|
|
| 62 | + 'type' => 'sectionstart', |
|
| 63 | + 'desc' => '', |
|
| 64 | + 'id' => 'geodir_home_layout'), |
|
| 65 | 65 | |
| 66 | - array( |
|
| 67 | - 'name' => __('Home right section', 'geodirectory'),
|
|
| 68 | - 'desc' => __('Show the right section of home page', 'geodirectory'),
|
|
| 69 | - 'id' => 'geodir_show_home_right_section', |
|
| 70 | - 'type' => 'checkbox', |
|
| 71 | - 'std' => '1' // Default value to show home top section |
|
| 72 | - ), |
|
| 66 | + array( |
|
| 67 | + 'name' => __('Home right section', 'geodirectory'),
|
|
| 68 | + 'desc' => __('Show the right section of home page', 'geodirectory'),
|
|
| 69 | + 'id' => 'geodir_show_home_right_section', |
|
| 70 | + 'type' => 'checkbox', |
|
| 71 | + 'std' => '1' // Default value to show home top section |
|
| 72 | + ), |
|
| 73 | 73 | |
| 74 | - array( |
|
| 75 | - 'name' => __('Width of home right section', 'geodirectory'),
|
|
| 76 | - 'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
|
|
| 77 | - 'id' => 'geodir_width_home_right_section', |
|
| 78 | - 'type' => 'text', |
|
| 79 | - 'css' => 'min-width:300px;', |
|
| 80 | - 'std' => '30' // Default value to show home top section |
|
| 81 | - ), |
|
| 74 | + array( |
|
| 75 | + 'name' => __('Width of home right section', 'geodirectory'),
|
|
| 76 | + 'desc' => __('Enter the width of right section of home page in %', 'geodirectory'),
|
|
| 77 | + 'id' => 'geodir_width_home_right_section', |
|
| 78 | + 'type' => 'text', |
|
| 79 | + 'css' => 'min-width:300px;', |
|
| 80 | + 'std' => '30' // Default value to show home top section |
|
| 81 | + ), |
|
| 82 | 82 | |
| 83 | - array( |
|
| 84 | - 'name' => __('Home content section', 'geodirectory'),
|
|
| 85 | - 'desc' => __('Show the content section of home page', 'geodirectory'),
|
|
| 86 | - 'id' => 'geodir_show_home_contant_section', |
|
| 87 | - 'type' => 'checkbox', |
|
| 88 | - 'std' => '1' // Default value to show home top section |
|
| 89 | - ), |
|
| 83 | + array( |
|
| 84 | + 'name' => __('Home content section', 'geodirectory'),
|
|
| 85 | + 'desc' => __('Show the content section of home page', 'geodirectory'),
|
|
| 86 | + 'id' => 'geodir_show_home_contant_section', |
|
| 87 | + 'type' => 'checkbox', |
|
| 88 | + 'std' => '1' // Default value to show home top section |
|
| 89 | + ), |
|
| 90 | 90 | |
| 91 | - array( |
|
| 92 | - 'name' => __('Width of home content section', 'geodirectory'),
|
|
| 93 | - 'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
|
|
| 94 | - 'id' => 'geodir_width_home_contant_section', |
|
| 95 | - 'type' => 'text', |
|
| 96 | - 'css' => 'min-width:300px;', |
|
| 97 | - 'std' => '63' // Default value to show home top section |
|
| 98 | - ), |
|
| 91 | + array( |
|
| 92 | + 'name' => __('Width of home content section', 'geodirectory'),
|
|
| 93 | + 'desc' => __('Enter the width of content section of home page in %', 'geodirectory'),
|
|
| 94 | + 'id' => 'geodir_width_home_contant_section', |
|
| 95 | + 'type' => 'text', |
|
| 96 | + 'css' => 'min-width:300px;', |
|
| 97 | + 'std' => '63' // Default value to show home top section |
|
| 98 | + ), |
|
| 99 | 99 | |
| 100 | - array( |
|
| 101 | - 'name' => __('Home left section', 'geodirectory'),
|
|
| 102 | - 'desc' => __('Show the left section of home page', 'geodirectory'),
|
|
| 103 | - 'id' => 'geodir_show_home_left_section', |
|
| 104 | - 'type' => 'checkbox', |
|
| 105 | - 'std' => '0' // Default value to show home top section |
|
| 106 | - ), |
|
| 100 | + array( |
|
| 101 | + 'name' => __('Home left section', 'geodirectory'),
|
|
| 102 | + 'desc' => __('Show the left section of home page', 'geodirectory'),
|
|
| 103 | + 'id' => 'geodir_show_home_left_section', |
|
| 104 | + 'type' => 'checkbox', |
|
| 105 | + 'std' => '0' // Default value to show home top section |
|
| 106 | + ), |
|
| 107 | 107 | |
| 108 | - array( |
|
| 109 | - 'name' => __('Width of home left section', 'geodirectory'),
|
|
| 110 | - 'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
|
|
| 111 | - 'id' => 'geodir_width_home_left_section', |
|
| 112 | - 'type' => 'text', |
|
| 113 | - 'css' => 'min-width:300px;', |
|
| 114 | - 'std' => '30' // Default value to show home top section |
|
| 115 | - ), |
|
| 108 | + array( |
|
| 109 | + 'name' => __('Width of home left section', 'geodirectory'),
|
|
| 110 | + 'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
|
|
| 111 | + 'id' => 'geodir_width_home_left_section', |
|
| 112 | + 'type' => 'text', |
|
| 113 | + 'css' => 'min-width:300px;', |
|
| 114 | + 'std' => '30' // Default value to show home top section |
|
| 115 | + ), |
|
| 116 | 116 | |
| 117 | - array( |
|
| 118 | - 'name' => __('Home bottom section', 'geodirectory'),
|
|
| 119 | - 'desc' => __('Show the bottom section of home page', 'geodirectory'),
|
|
| 120 | - 'id' => 'geodir_show_home_bottom_section', |
|
| 121 | - 'type' => 'checkbox', |
|
| 122 | - 'std' => '0' // Default value to show home top section |
|
| 123 | - ), |
|
| 124 | - array( |
|
| 125 | - 'name' => __('Resize image large size', 'geodirectory'),
|
|
| 126 | - 'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
|
|
| 127 | - 'id' => 'geodir_use_wp_media_large_size', |
|
| 128 | - 'type' => 'checkbox', |
|
| 129 | - 'std' => '0' |
|
| 130 | - ), |
|
| 117 | + array( |
|
| 118 | + 'name' => __('Home bottom section', 'geodirectory'),
|
|
| 119 | + 'desc' => __('Show the bottom section of home page', 'geodirectory'),
|
|
| 120 | + 'id' => 'geodir_show_home_bottom_section', |
|
| 121 | + 'type' => 'checkbox', |
|
| 122 | + 'std' => '0' // Default value to show home top section |
|
| 123 | + ), |
|
| 124 | + array( |
|
| 125 | + 'name' => __('Resize image large size', 'geodirectory'),
|
|
| 126 | + 'desc' => sprintf(__('Use default wordpress media image large size ( %s ) for featured image upload. If unchecked then default geodirectory image large size ( 800x800 ) will be used.', 'geodirectory'), get_option('large_size_w') . 'x' . get_option('large_size_h')),
|
|
| 127 | + 'id' => 'geodir_use_wp_media_large_size', |
|
| 128 | + 'type' => 'checkbox', |
|
| 129 | + 'std' => '0' |
|
| 130 | + ), |
|
| 131 | 131 | |
| 132 | - array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
|
|
| 132 | + array('type' => 'sectionend', 'id' => 'geodir_home_layout'),
|
|
| 133 | 133 | |
| 134 | 134 | |
| 135 | - /* Home Layout Settings end */ |
|
| 135 | + /* Home Layout Settings end */ |
|
| 136 | 136 | |
| 137 | 137 | |
| 138 | - /* Listing Layout Settings end */ |
|
| 138 | + /* Listing Layout Settings end */ |
|
| 139 | 139 | |
| 140 | - array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
|
|
| 140 | + array('name' => __('Listings', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_listing_settings '),
|
|
| 141 | 141 | |
| 142 | 142 | |
| 143 | - array('name' => __('Listing Page Layout Settings', 'geodirectory'),
|
|
| 144 | - 'type' => 'sectionstart', |
|
| 145 | - 'desc' => '', |
|
| 146 | - 'id' => 'geodir_listing_layout'), |
|
| 143 | + array('name' => __('Listing Page Layout Settings', 'geodirectory'),
|
|
| 144 | + 'type' => 'sectionstart', |
|
| 145 | + 'desc' => '', |
|
| 146 | + 'id' => 'geodir_listing_layout'), |
|
| 147 | 147 | |
| 148 | - array( |
|
| 149 | - 'name' => __('Listing top section', 'geodirectory'),
|
|
| 150 | - 'desc' => __('Show the top section of listing page', 'geodirectory'),
|
|
| 151 | - 'id' => 'geodir_show_listing_top_section', |
|
| 152 | - 'type' => 'checkbox', |
|
| 153 | - 'std' => '1' // Default value to show home top section |
|
| 154 | - ), |
|
| 148 | + array( |
|
| 149 | + 'name' => __('Listing top section', 'geodirectory'),
|
|
| 150 | + 'desc' => __('Show the top section of listing page', 'geodirectory'),
|
|
| 151 | + 'id' => 'geodir_show_listing_top_section', |
|
| 152 | + 'type' => 'checkbox', |
|
| 153 | + 'std' => '1' // Default value to show home top section |
|
| 154 | + ), |
|
| 155 | 155 | |
| 156 | - array( |
|
| 157 | - 'name' => __('Listing right section', 'geodirectory'),
|
|
| 158 | - 'desc' => __('Show the right section of listing page', 'geodirectory'),
|
|
| 159 | - 'id' => 'geodir_show_listing_right_section', |
|
| 160 | - 'type' => 'checkbox', |
|
| 161 | - 'std' => '1' // Default value to show home top section |
|
| 162 | - ), |
|
| 156 | + array( |
|
| 157 | + 'name' => __('Listing right section', 'geodirectory'),
|
|
| 158 | + 'desc' => __('Show the right section of listing page', 'geodirectory'),
|
|
| 159 | + 'id' => 'geodir_show_listing_right_section', |
|
| 160 | + 'type' => 'checkbox', |
|
| 161 | + 'std' => '1' // Default value to show home top section |
|
| 162 | + ), |
|
| 163 | 163 | |
| 164 | - array( |
|
| 165 | - 'name' => __('Width of listing right section', 'geodirectory'),
|
|
| 166 | - 'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
|
|
| 167 | - 'id' => 'geodir_width_listing_right_section', |
|
| 168 | - 'type' => 'text', |
|
| 169 | - 'css' => 'min-width:300px;', |
|
| 170 | - 'std' => '30' // Default value to show home top section |
|
| 171 | - ), |
|
| 164 | + array( |
|
| 165 | + 'name' => __('Width of listing right section', 'geodirectory'),
|
|
| 166 | + 'desc' => __('Enter the width of right section of listing page in %', 'geodirectory'),
|
|
| 167 | + 'id' => 'geodir_width_listing_right_section', |
|
| 168 | + 'type' => 'text', |
|
| 169 | + 'css' => 'min-width:300px;', |
|
| 170 | + 'std' => '30' // Default value to show home top section |
|
| 171 | + ), |
|
| 172 | 172 | |
| 173 | 173 | |
| 174 | - array( |
|
| 175 | - 'name' => __('Listing content section view', 'geodirectory'),
|
|
| 176 | - 'desc' => __('Set the listing view of listing page', 'geodirectory'),
|
|
| 177 | - 'id' => 'geodir_listing_view', |
|
| 178 | - 'css' => 'min-width:300px;', |
|
| 179 | - 'std' => 'gridview_onehalf', |
|
| 180 | - 'type' => 'select', |
|
| 181 | - 'class' => 'chosen_select', |
|
| 182 | - 'options' => array_unique(array( |
|
| 183 | - 'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
|
|
| 184 | - 'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
|
|
| 185 | - 'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
|
|
| 186 | - 'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
|
|
| 187 | - 'listview' => __('List view', 'geodirectory'),
|
|
| 188 | - )) |
|
| 189 | - ), |
|
| 174 | + array( |
|
| 175 | + 'name' => __('Listing content section view', 'geodirectory'),
|
|
| 176 | + 'desc' => __('Set the listing view of listing page', 'geodirectory'),
|
|
| 177 | + 'id' => 'geodir_listing_view', |
|
| 178 | + 'css' => 'min-width:300px;', |
|
| 179 | + 'std' => 'gridview_onehalf', |
|
| 180 | + 'type' => 'select', |
|
| 181 | + 'class' => 'chosen_select', |
|
| 182 | + 'options' => array_unique(array( |
|
| 183 | + 'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
|
|
| 184 | + 'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
|
|
| 185 | + 'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
|
|
| 186 | + 'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
|
|
| 187 | + 'listview' => __('List view', 'geodirectory'),
|
|
| 188 | + )) |
|
| 189 | + ), |
|
| 190 | 190 | |
| 191 | - array( |
|
| 192 | - 'name' => __('Width of listing content section', 'geodirectory'),
|
|
| 193 | - 'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
|
|
| 194 | - 'id' => 'geodir_width_listing_contant_section', |
|
| 195 | - 'type' => 'text', |
|
| 196 | - 'css' => 'min-width:300px;', |
|
| 197 | - 'std' => '63' // Default value to show home top section |
|
| 198 | - ), |
|
| 191 | + array( |
|
| 192 | + 'name' => __('Width of listing content section', 'geodirectory'),
|
|
| 193 | + 'desc' => __('Enter the width of content section of listing page in %', 'geodirectory'),
|
|
| 194 | + 'id' => 'geodir_width_listing_contant_section', |
|
| 195 | + 'type' => 'text', |
|
| 196 | + 'css' => 'min-width:300px;', |
|
| 197 | + 'std' => '63' // Default value to show home top section |
|
| 198 | + ), |
|
| 199 | 199 | |
| 200 | - array( |
|
| 201 | - 'name' => __('Listing left section', 'geodirectory'),
|
|
| 202 | - 'desc' => __('Show the left section of listing page', 'geodirectory'),
|
|
| 203 | - 'id' => 'geodir_show_listing_left_section', |
|
| 204 | - 'type' => 'checkbox', |
|
| 205 | - 'std' => '0' // Default value to show home top section |
|
| 206 | - ), |
|
| 200 | + array( |
|
| 201 | + 'name' => __('Listing left section', 'geodirectory'),
|
|
| 202 | + 'desc' => __('Show the left section of listing page', 'geodirectory'),
|
|
| 203 | + 'id' => 'geodir_show_listing_left_section', |
|
| 204 | + 'type' => 'checkbox', |
|
| 205 | + 'std' => '0' // Default value to show home top section |
|
| 206 | + ), |
|
| 207 | 207 | |
| 208 | - array( |
|
| 209 | - 'name' => __('Width of listing left section', 'geodirectory'),
|
|
| 210 | - 'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
|
|
| 211 | - 'id' => 'geodir_width_listing_left_section', |
|
| 212 | - 'type' => 'text', |
|
| 213 | - 'css' => 'min-width:300px;', |
|
| 214 | - 'std' => '30' // Default value to show home top section |
|
| 215 | - ), |
|
| 208 | + array( |
|
| 209 | + 'name' => __('Width of listing left section', 'geodirectory'),
|
|
| 210 | + 'desc' => __('Enter the width of left section of listing in %', 'geodirectory'),
|
|
| 211 | + 'id' => 'geodir_width_listing_left_section', |
|
| 212 | + 'type' => 'text', |
|
| 213 | + 'css' => 'min-width:300px;', |
|
| 214 | + 'std' => '30' // Default value to show home top section |
|
| 215 | + ), |
|
| 216 | 216 | |
| 217 | - array( |
|
| 218 | - 'name' => __('Listing bottom section', 'geodirectory'),
|
|
| 219 | - 'desc' => __('Show the bottom section of listing page', 'geodirectory'),
|
|
| 220 | - 'id' => 'geodir_show_listing_bottom_section', |
|
| 221 | - 'type' => 'checkbox', |
|
| 222 | - 'std' => '0' // Default value to show home top section |
|
| 223 | - ), |
|
| 217 | + array( |
|
| 218 | + 'name' => __('Listing bottom section', 'geodirectory'),
|
|
| 219 | + 'desc' => __('Show the bottom section of listing page', 'geodirectory'),
|
|
| 220 | + 'id' => 'geodir_show_listing_bottom_section', |
|
| 221 | + 'type' => 'checkbox', |
|
| 222 | + 'std' => '0' // Default value to show home top section |
|
| 223 | + ), |
|
| 224 | 224 | |
| 225 | - array( |
|
| 226 | - 'name' => __('Upload listing no image', 'geodirectory'),
|
|
| 227 | - 'desc' => '', |
|
| 228 | - 'id' => 'geodir_listing_no_img', |
|
| 229 | - 'type' => 'file', |
|
| 230 | - 'std' => '0' // Default value to show home top section |
|
| 231 | - ), |
|
| 225 | + array( |
|
| 226 | + 'name' => __('Upload listing no image', 'geodirectory'),
|
|
| 227 | + 'desc' => '', |
|
| 228 | + 'id' => 'geodir_listing_no_img', |
|
| 229 | + 'type' => 'file', |
|
| 230 | + 'std' => '0' // Default value to show home top section |
|
| 231 | + ), |
|
| 232 | 232 | |
| 233 | 233 | array( |
| 234 | 234 | 'name' => __('Listing image size', 'geodirectory'),
|
@@ -241,345 +241,345 @@ discard block |
||
| 241 | 241 | 'options' => geodir_listing_image_size_arr() |
| 242 | 242 | ), |
| 243 | 243 | |
| 244 | - array( |
|
| 245 | - 'name' => __('Description word limit', 'geodirectory'),
|
|
| 246 | - 'desc' => '', |
|
| 247 | - 'id' => 'geodir_desc_word_limit', |
|
| 248 | - 'type' => 'text', |
|
| 249 | - 'css' => 'min-width:300px;', |
|
| 250 | - 'std' => '50' // Default value to show home top section |
|
| 251 | - ), |
|
| 244 | + array( |
|
| 245 | + 'name' => __('Description word limit', 'geodirectory'),
|
|
| 246 | + 'desc' => '', |
|
| 247 | + 'id' => 'geodir_desc_word_limit', |
|
| 248 | + 'type' => 'text', |
|
| 249 | + 'css' => 'min-width:300px;', |
|
| 250 | + 'std' => '50' // Default value to show home top section |
|
| 251 | + ), |
|
| 252 | 252 | |
| 253 | - array( |
|
| 254 | - 'name' => __('Hover listing map animation', 'geodirectory'),
|
|
| 255 | - 'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
|
|
| 256 | - 'id' => 'geodir_listing_hover_bounce_map_pin', |
|
| 257 | - 'type' => 'checkbox', |
|
| 258 | - 'std' => '1' // Default value to show home top section |
|
| 259 | - ), |
|
| 253 | + array( |
|
| 254 | + 'name' => __('Hover listing map animation', 'geodirectory'),
|
|
| 255 | + 'desc' => __('Bounce map pin if listing hovered', 'geodirectory'),
|
|
| 256 | + 'id' => 'geodir_listing_hover_bounce_map_pin', |
|
| 257 | + 'type' => 'checkbox', |
|
| 258 | + 'std' => '1' // Default value to show home top section |
|
| 259 | + ), |
|
| 260 | 260 | |
| 261 | - array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
|
|
| 261 | + array('type' => 'sectionend', 'id' => 'geodir_listing_layout'),
|
|
| 262 | 262 | |
| 263 | 263 | |
| 264 | - array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
|
|
| 264 | + array('name' => __('Listing General Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_listing_gen_settings '),
|
|
| 265 | 265 | |
| 266 | - array( |
|
| 267 | - 'name' => __('New listing default status', 'geodirectory'),
|
|
| 268 | - 'desc' => __('Select new listing default status.', 'geodirectory'),
|
|
| 269 | - 'tip' => '', |
|
| 270 | - 'id' => 'geodir_new_post_default_status', |
|
| 271 | - 'css' => 'min-width:300px;', |
|
| 272 | - 'std' => 'pending', |
|
| 273 | - 'type' => 'select', |
|
| 274 | - 'class' => 'chosen_select', |
|
| 275 | - 'options' => array_unique(array( |
|
| 276 | - 'pending' => __('Pending Review', 'geodirectory'),
|
|
| 277 | - 'draft' => __('draft', 'geodirectory'),
|
|
| 278 | - 'publish' => __('publish', 'geodirectory'),
|
|
| 279 | - |
|
| 280 | - )) |
|
| 281 | - ), |
|
| 266 | + array( |
|
| 267 | + 'name' => __('New listing default status', 'geodirectory'),
|
|
| 268 | + 'desc' => __('Select new listing default status.', 'geodirectory'),
|
|
| 269 | + 'tip' => '', |
|
| 270 | + 'id' => 'geodir_new_post_default_status', |
|
| 271 | + 'css' => 'min-width:300px;', |
|
| 272 | + 'std' => 'pending', |
|
| 273 | + 'type' => 'select', |
|
| 274 | + 'class' => 'chosen_select', |
|
| 275 | + 'options' => array_unique(array( |
|
| 276 | + 'pending' => __('Pending Review', 'geodirectory'),
|
|
| 277 | + 'draft' => __('draft', 'geodirectory'),
|
|
| 278 | + 'publish' => __('publish', 'geodirectory'),
|
|
| 282 | 279 | |
| 283 | - array( |
|
| 284 | - 'name' => __('New listings settings', 'geodirectory'),
|
|
| 285 | - 'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
|
|
| 286 | - 'id' => 'geodir_listing_new_days', |
|
| 287 | - 'type' => 'text', |
|
| 288 | - 'css' => 'min-width:300px;', |
|
| 289 | - 'std' => '30' // Default value for the page title - changed in settings |
|
| 290 | - ), |
|
| 280 | + )) |
|
| 281 | + ), |
|
| 291 | 282 | |
| 292 | - array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
|
|
| 283 | + array( |
|
| 284 | + 'name' => __('New listings settings', 'geodirectory'),
|
|
| 285 | + 'desc' => __('Enter number of days a listing will appear new.(enter 0 to disable feature)', 'geodirectory'),
|
|
| 286 | + 'id' => 'geodir_listing_new_days', |
|
| 287 | + 'type' => 'text', |
|
| 288 | + 'css' => 'min-width:300px;', |
|
| 289 | + 'std' => '30' // Default value for the page title - changed in settings |
|
| 290 | + ), |
|
| 293 | 291 | |
| 292 | + array('type' => 'sectionend', 'id' => 'geodir_listing_gen_settings'),
|
|
| 294 | 293 | |
| 295 | - array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
|
|
| 296 | 294 | |
| 297 | - array( |
|
| 298 | - 'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
|
|
| 299 | - 'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
|
|
| 300 | - 'id' => 'geodir_accept_term_condition', |
|
| 301 | - 'type' => 'checkbox', |
|
| 302 | - 'std' => '1' // Default value to show home top section |
|
| 303 | - ), |
|
| 295 | + array('name' => __('Add Listing Form Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_add_listing_gen_settings'),
|
|
| 304 | 296 | |
| 297 | + array( |
|
| 298 | + 'name' => __('Enable "Accept Terms and Conditions"', 'geodirectory'),
|
|
| 299 | + 'desc' => __('Show the "Accept Terms and Conditions" field on add listing.', 'geodirectory'),
|
|
| 300 | + 'id' => 'geodir_accept_term_condition', |
|
| 301 | + 'type' => 'checkbox', |
|
| 302 | + 'std' => '1' // Default value to show home top section |
|
| 303 | + ), |
|
| 305 | 304 | |
| 306 | - array( |
|
| 307 | - 'name' => __('Show description field as editor', 'geodirectory'),
|
|
| 308 | - 'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
|
|
| 309 | - 'tip' => '', |
|
| 310 | - 'id' => 'geodir_tiny_editor_on_add_listing', |
|
| 311 | - 'css' => 'min-width:300px;', |
|
| 312 | - 'std' => array(), |
|
| 313 | - 'type' => 'multiselect', |
|
| 314 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 315 | - 'class' => 'chosen_select', |
|
| 316 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 317 | - ), |
|
| 318 | 305 | |
| 319 | - array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
|
|
| 320 | - /* Listing Layout Settings end */ |
|
| 306 | + array( |
|
| 307 | + 'name' => __('Show description field as editor', 'geodirectory'),
|
|
| 308 | + 'desc' => __('Select post types to show advanced editor on add listing page.', 'geodirectory'),
|
|
| 309 | + 'tip' => '', |
|
| 310 | + 'id' => 'geodir_tiny_editor_on_add_listing', |
|
| 311 | + 'css' => 'min-width:300px;', |
|
| 312 | + 'std' => array(), |
|
| 313 | + 'type' => 'multiselect', |
|
| 314 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 315 | + 'class' => 'chosen_select', |
|
| 316 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 317 | + ), |
|
| 321 | 318 | |
| 319 | + array('type' => 'sectionend', 'id' => 'geodir_add_listing_gen_settings'),
|
|
| 320 | + /* Listing Layout Settings end */ |
|
| 322 | 321 | |
| 323 | - /* Search Layout Settings end */ |
|
| 324 | 322 | |
| 325 | - array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
|
|
| 323 | + /* Search Layout Settings end */ |
|
| 326 | 324 | |
| 325 | + array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_search_settings '),
|
|
| 327 | 326 | |
| 328 | - array('name' => __('Search Page Layout Settings', 'geodirectory'),
|
|
| 329 | - 'type' => 'sectionstart', |
|
| 330 | - 'desc' => '', |
|
| 331 | - 'id' => 'geodir_search_layout'), |
|
| 332 | 327 | |
| 333 | - array( |
|
| 334 | - 'name' => __('Search top section', 'geodirectory'),
|
|
| 335 | - 'desc' => __('Show the top section of search page', 'geodirectory'),
|
|
| 336 | - 'id' => 'geodir_show_search_top_section', |
|
| 337 | - 'type' => 'checkbox', |
|
| 338 | - 'std' => '1' // Default value to show home top section |
|
| 339 | - ), |
|
| 328 | + array('name' => __('Search Page Layout Settings', 'geodirectory'),
|
|
| 329 | + 'type' => 'sectionstart', |
|
| 330 | + 'desc' => '', |
|
| 331 | + 'id' => 'geodir_search_layout'), |
|
| 340 | 332 | |
| 341 | - array( |
|
| 342 | - 'name' => __('Search right section', 'geodirectory'),
|
|
| 343 | - 'desc' => __('Show the right section of search page', 'geodirectory'),
|
|
| 344 | - 'id' => 'geodir_show_search_right_section', |
|
| 345 | - 'type' => 'checkbox', |
|
| 346 | - 'std' => '1' // Default value to show home top section |
|
| 347 | - ), |
|
| 333 | + array( |
|
| 334 | + 'name' => __('Search top section', 'geodirectory'),
|
|
| 335 | + 'desc' => __('Show the top section of search page', 'geodirectory'),
|
|
| 336 | + 'id' => 'geodir_show_search_top_section', |
|
| 337 | + 'type' => 'checkbox', |
|
| 338 | + 'std' => '1' // Default value to show home top section |
|
| 339 | + ), |
|
| 348 | 340 | |
| 349 | - array( |
|
| 350 | - 'name' => __('Width of search right section', 'geodirectory'),
|
|
| 351 | - 'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
|
|
| 352 | - 'id' => 'geodir_width_search_right_section', |
|
| 353 | - 'type' => 'text', |
|
| 354 | - 'css' => 'min-width:300px;', |
|
| 355 | - 'std' => '30' // Default value to show home top section |
|
| 356 | - ), |
|
| 341 | + array( |
|
| 342 | + 'name' => __('Search right section', 'geodirectory'),
|
|
| 343 | + 'desc' => __('Show the right section of search page', 'geodirectory'),
|
|
| 344 | + 'id' => 'geodir_show_search_right_section', |
|
| 345 | + 'type' => 'checkbox', |
|
| 346 | + 'std' => '1' // Default value to show home top section |
|
| 347 | + ), |
|
| 357 | 348 | |
| 349 | + array( |
|
| 350 | + 'name' => __('Width of search right section', 'geodirectory'),
|
|
| 351 | + 'desc' => __('Enter the width of right section of search page in %', 'geodirectory'),
|
|
| 352 | + 'id' => 'geodir_width_search_right_section', |
|
| 353 | + 'type' => 'text', |
|
| 354 | + 'css' => 'min-width:300px;', |
|
| 355 | + 'std' => '30' // Default value to show home top section |
|
| 356 | + ), |
|
| 358 | 357 | |
| 359 | - array( |
|
| 360 | - 'name' => __('Search content section view', 'geodirectory'),
|
|
| 361 | - 'desc' => __('Set the listing view of search page', 'geodirectory'),
|
|
| 362 | - 'id' => 'geodir_search_view', |
|
| 363 | - 'css' => 'min-width:300px;', |
|
| 364 | - 'std' => 'gridview_onehalf', |
|
| 365 | - 'type' => 'select', |
|
| 366 | - 'class' => 'chosen_select', |
|
| 367 | - 'options' => array_unique(array( |
|
| 368 | - 'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
|
|
| 369 | - 'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
|
|
| 370 | - 'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
|
|
| 371 | - 'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
|
|
| 372 | - 'listview' => __('List view', 'geodirectory'),
|
|
| 373 | - )) |
|
| 374 | - ), |
|
| 375 | 358 | |
| 376 | - array( |
|
| 377 | - 'name' => __('Width of search content section', 'geodirectory'),
|
|
| 378 | - 'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
|
|
| 379 | - 'id' => 'geodir_width_search_contant_section', |
|
| 380 | - 'type' => 'text', |
|
| 381 | - 'css' => 'min-width:300px;', |
|
| 382 | - 'std' => '63' // Default value to show home top section |
|
| 383 | - ), |
|
| 359 | + array( |
|
| 360 | + 'name' => __('Search content section view', 'geodirectory'),
|
|
| 361 | + 'desc' => __('Set the listing view of search page', 'geodirectory'),
|
|
| 362 | + 'id' => 'geodir_search_view', |
|
| 363 | + 'css' => 'min-width:300px;', |
|
| 364 | + 'std' => 'gridview_onehalf', |
|
| 365 | + 'type' => 'select', |
|
| 366 | + 'class' => 'chosen_select', |
|
| 367 | + 'options' => array_unique(array( |
|
| 368 | + 'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
|
|
| 369 | + 'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
|
|
| 370 | + 'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
|
|
| 371 | + 'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
|
|
| 372 | + 'listview' => __('List view', 'geodirectory'),
|
|
| 373 | + )) |
|
| 374 | + ), |
|
| 384 | 375 | |
| 385 | - array( |
|
| 386 | - 'name' => __('Search left section', 'geodirectory'),
|
|
| 387 | - 'desc' => __('Show the left section of search page', 'geodirectory'),
|
|
| 388 | - 'id' => 'geodir_show_search_left_section', |
|
| 389 | - 'type' => 'checkbox', |
|
| 390 | - 'std' => '0' // Default value to show home top section |
|
| 391 | - ), |
|
| 376 | + array( |
|
| 377 | + 'name' => __('Width of search content section', 'geodirectory'),
|
|
| 378 | + 'desc' => __('Enter the width of content section of search page in %', 'geodirectory'),
|
|
| 379 | + 'id' => 'geodir_width_search_contant_section', |
|
| 380 | + 'type' => 'text', |
|
| 381 | + 'css' => 'min-width:300px;', |
|
| 382 | + 'std' => '63' // Default value to show home top section |
|
| 383 | + ), |
|
| 392 | 384 | |
| 393 | - array( |
|
| 394 | - 'name' => __('Width of search left section', 'geodirectory'),
|
|
| 395 | - 'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
|
|
| 396 | - 'id' => 'geodir_width_search_left_section', |
|
| 397 | - 'type' => 'text', |
|
| 398 | - 'css' => 'min-width:300px;', |
|
| 399 | - 'std' => '30' // Default value to show home top section |
|
| 400 | - ), |
|
| 385 | + array( |
|
| 386 | + 'name' => __('Search left section', 'geodirectory'),
|
|
| 387 | + 'desc' => __('Show the left section of search page', 'geodirectory'),
|
|
| 388 | + 'id' => 'geodir_show_search_left_section', |
|
| 389 | + 'type' => 'checkbox', |
|
| 390 | + 'std' => '0' // Default value to show home top section |
|
| 391 | + ), |
|
| 401 | 392 | |
| 402 | - array( |
|
| 403 | - 'name' => __('Search bottom section', 'geodirectory'),
|
|
| 404 | - 'desc' => __('Show the bottom section of search page', 'geodirectory'),
|
|
| 405 | - 'id' => 'geodir_show_search_bottom_section', |
|
| 406 | - 'type' => 'checkbox', |
|
| 407 | - 'std' => '0' // Default value to show home top section |
|
| 408 | - ), |
|
| 393 | + array( |
|
| 394 | + 'name' => __('Width of search left section', 'geodirectory'),
|
|
| 395 | + 'desc' => __('Enter the width of left section of search in %', 'geodirectory'),
|
|
| 396 | + 'id' => 'geodir_width_search_left_section', |
|
| 397 | + 'type' => 'text', |
|
| 398 | + 'css' => 'min-width:300px;', |
|
| 399 | + 'std' => '30' // Default value to show home top section |
|
| 400 | + ), |
|
| 401 | + |
|
| 402 | + array( |
|
| 403 | + 'name' => __('Search bottom section', 'geodirectory'),
|
|
| 404 | + 'desc' => __('Show the bottom section of search page', 'geodirectory'),
|
|
| 405 | + 'id' => 'geodir_show_search_bottom_section', |
|
| 406 | + 'type' => 'checkbox', |
|
| 407 | + 'std' => '0' // Default value to show home top section |
|
| 408 | + ), |
|
| 409 | 409 | |
| 410 | 410 | array( |
| 411 | - 'name' => __('Show advanced pagination details', 'geodirectory'),
|
|
| 412 | - 'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
|
|
| 413 | - 'id' => 'geodir_pagination_advance_info', |
|
| 414 | - 'css' => 'min-width:300px;', |
|
| 415 | - 'std' => '', |
|
| 416 | - 'type' => 'select', |
|
| 417 | - 'class' => 'chosen_select', |
|
| 418 | - 'options' => array( |
|
| 411 | + 'name' => __('Show advanced pagination details', 'geodirectory'),
|
|
| 412 | + 'desc' => __('This will add extra pagination info like "Showing listings x-y of z" after/before pagination.', 'geodirectory'),
|
|
| 413 | + 'id' => 'geodir_pagination_advance_info', |
|
| 414 | + 'css' => 'min-width:300px;', |
|
| 415 | + 'std' => '', |
|
| 416 | + 'type' => 'select', |
|
| 417 | + 'class' => 'chosen_select', |
|
| 418 | + 'options' => array( |
|
| 419 | 419 | '' => __('Never Display', 'geodirectory'),
|
| 420 | 420 | 'after' => __('After Pagination', 'geodirectory'),
|
| 421 | 421 | 'before' => __('Before Pagination', 'geodirectory')
|
| 422 | 422 | ) |
| 423 | - ), |
|
| 423 | + ), |
|
| 424 | 424 | |
| 425 | - array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
|
|
| 425 | + array('type' => 'sectionend', 'id' => 'geodir_search_layout'),
|
|
| 426 | 426 | |
| 427 | 427 | |
| 428 | - array('name' => __('Search form settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
|
|
| 428 | + array('name' => __('Search form settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_search_form_default_text_settings'),
|
|
| 429 | 429 | |
| 430 | - array( |
|
| 431 | - 'name' => __('Use old non-styled form', 'geodirectory'),
|
|
| 432 | - 'desc' => __('Will show the old type form (not recommended unless you had added your own styles)', 'geodirectory'),
|
|
| 433 | - 'id' => 'geodir_show_search_old_search_from', |
|
| 434 | - 'type' => 'checkbox', |
|
| 435 | - 'std' => '0' // Default value to show |
|
| 436 | - ), |
|
| 430 | + array( |
|
| 431 | + 'name' => __('Use old non-styled form', 'geodirectory'),
|
|
| 432 | + 'desc' => __('Will show the old type form (not recommended unless you had added your own styles)', 'geodirectory'),
|
|
| 433 | + 'id' => 'geodir_show_search_old_search_from', |
|
| 434 | + 'type' => 'checkbox', |
|
| 435 | + 'std' => '0' // Default value to show |
|
| 436 | + ), |
|
| 437 | 437 | |
| 438 | - array( |
|
| 439 | - 'name' => __('Search field default value', 'geodirectory'),
|
|
| 440 | - 'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
|
|
| 441 | - 'id' => 'geodir_search_field_default_text', |
|
| 442 | - 'type' => 'text', |
|
| 443 | - 'css' => 'min-width:300px;', |
|
| 444 | - 'std' => 'Search for' // show on the listing page. |
|
| 445 | - ), |
|
| 438 | + array( |
|
| 439 | + 'name' => __('Search field default value', 'geodirectory'),
|
|
| 440 | + 'desc' => __('Show the search text box \'placeholder\' value on search form.', 'geodirectory'),
|
|
| 441 | + 'id' => 'geodir_search_field_default_text', |
|
| 442 | + 'type' => 'text', |
|
| 443 | + 'css' => 'min-width:300px;', |
|
| 444 | + 'std' => 'Search for' // show on the listing page. |
|
| 445 | + ), |
|
| 446 | 446 | |
| 447 | - array( |
|
| 448 | - 'name' => __('Near field default value', 'geodirectory'),
|
|
| 449 | - 'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
|
|
| 450 | - 'id' => 'geodir_near_field_default_text', |
|
| 451 | - 'type' => 'text', |
|
| 452 | - 'css' => 'min-width:300px;', |
|
| 453 | - 'std' => 'Near' // show on the listing page. |
|
| 454 | - ), |
|
| 447 | + array( |
|
| 448 | + 'name' => __('Near field default value', 'geodirectory'),
|
|
| 449 | + 'desc' => __('Show the near text box \'placeholder\' value on search form.', 'geodirectory'),
|
|
| 450 | + 'id' => 'geodir_near_field_default_text', |
|
| 451 | + 'type' => 'text', |
|
| 452 | + 'css' => 'min-width:300px;', |
|
| 453 | + 'std' => 'Near' // show on the listing page. |
|
| 454 | + ), |
|
| 455 | 455 | |
| 456 | - array( |
|
| 457 | - 'name' => __('Search button label', 'geodirectory'),
|
|
| 458 | - 'desc' => __('Show the search button label on search form.', 'geodirectory'),
|
|
| 459 | - 'id' => 'geodir_search_button_label', |
|
| 460 | - 'type' => 'text', |
|
| 461 | - 'css' => 'min-width:300px;', |
|
| 462 | - 'std' => 'Search' // show on the listing page. |
|
| 463 | - ), |
|
| 456 | + array( |
|
| 457 | + 'name' => __('Search button label', 'geodirectory'),
|
|
| 458 | + 'desc' => __('Show the search button label on search form.', 'geodirectory'),
|
|
| 459 | + 'id' => 'geodir_search_button_label', |
|
| 460 | + 'type' => 'text', |
|
| 461 | + 'css' => 'min-width:300px;', |
|
| 462 | + 'std' => 'Search' // show on the listing page. |
|
| 463 | + ), |
|
| 464 | 464 | |
| 465 | - array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
|
|
| 465 | + array('type' => 'sectionend', 'id' => 'geodir_search_form_default_text_settings'),
|
|
| 466 | 466 | |
| 467 | - /* Listing Layout Settings end */ |
|
| 467 | + /* Listing Layout Settings end */ |
|
| 468 | 468 | |
| 469 | 469 | |
| 470 | - /* Detail Layout Settings end */ |
|
| 470 | + /* Detail Layout Settings end */ |
|
| 471 | 471 | |
| 472 | - array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
|
|
| 472 | + array('name' => __('Detail', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_detail_settings '),
|
|
| 473 | 473 | |
| 474 | - array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
|
|
| 474 | + array('name' => __('Detail/Single Page Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_settings '),
|
|
| 475 | 475 | |
| 476 | - array( |
|
| 477 | - 'name' => __('Detail top section', 'geodirectory'),
|
|
| 478 | - 'desc' => __('Show the top section of listing page', 'geodirectory'),
|
|
| 479 | - 'id' => 'geodir_show_detail_top_section', |
|
| 480 | - 'type' => 'checkbox', |
|
| 481 | - 'std' => '1' // Default value to show home top section |
|
| 482 | - ), |
|
| 476 | + array( |
|
| 477 | + 'name' => __('Detail top section', 'geodirectory'),
|
|
| 478 | + 'desc' => __('Show the top section of listing page', 'geodirectory'),
|
|
| 479 | + 'id' => 'geodir_show_detail_top_section', |
|
| 480 | + 'type' => 'checkbox', |
|
| 481 | + 'std' => '1' // Default value to show home top section |
|
| 482 | + ), |
|
| 483 | 483 | |
| 484 | - array( |
|
| 485 | - 'name' => __('Detail bottom section', 'geodirectory'),
|
|
| 486 | - 'desc' => __('Show the bottom section of listing page', 'geodirectory'),
|
|
| 487 | - 'id' => 'geodir_show_detail_bottom_section', |
|
| 488 | - 'type' => 'checkbox', |
|
| 489 | - 'std' => '1' // Default value to show home top section |
|
| 490 | - ), |
|
| 491 | - array( |
|
| 492 | - 'name' => __('Detail sidebar section on left side', 'geodirectory'),
|
|
| 493 | - 'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
|
|
| 494 | - 'id' => 'geodir_detail_sidebar_left_section', |
|
| 495 | - 'type' => 'checkbox', |
|
| 496 | - 'std' => '0' |
|
| 497 | - ), |
|
| 498 | - array( |
|
| 499 | - 'name' => __('Disable GD modal', 'geodirectory'),
|
|
| 500 | - 'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
|
|
| 501 | - 'id' => 'geodir_disable_gb_modal', |
|
| 502 | - 'type' => 'checkbox', |
|
| 503 | - 'std' => '0' |
|
| 504 | - ), |
|
| 505 | - array( |
|
| 506 | - 'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
|
|
| 507 | - 'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
|
|
| 508 | - 'id' => 'geodir_disable_tfg_buttons_section', |
|
| 509 | - 'type' => 'checkbox', |
|
| 510 | - 'std' => '0' |
|
| 511 | - ), |
|
| 512 | - array( |
|
| 513 | - 'name' => __('Disable Google Analytics section', 'geodirectory'),
|
|
| 514 | - 'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
|
|
| 515 | - 'id' => 'geodir_disable_google_analytics_section', |
|
| 516 | - 'type' => 'checkbox', |
|
| 517 | - 'std' => '0' |
|
| 518 | - ), |
|
| 519 | - array( |
|
| 520 | - 'name' => __('Disable User Links section', 'geodirectory'),
|
|
| 521 | - 'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
|
|
| 522 | - 'id' => 'geodir_disable_user_links_section', |
|
| 523 | - 'type' => 'checkbox', |
|
| 524 | - 'std' => '0' |
|
| 525 | - ), |
|
| 526 | - array( |
|
| 527 | - 'name' => __('Disable Rating Info section', 'geodirectory'),
|
|
| 528 | - 'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
|
|
| 529 | - 'id' => 'geodir_disable_rating_info_section', |
|
| 530 | - 'type' => 'checkbox', |
|
| 531 | - 'std' => '0' |
|
| 532 | - ), |
|
| 533 | - array( |
|
| 534 | - 'name' => __('Disable Listing Info section', 'geodirectory'),
|
|
| 535 | - 'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
|
|
| 536 | - 'id' => 'geodir_disable_listing_info_section', |
|
| 537 | - 'type' => 'checkbox', |
|
| 538 | - 'std' => '0' |
|
| 539 | - ), |
|
| 484 | + array( |
|
| 485 | + 'name' => __('Detail bottom section', 'geodirectory'),
|
|
| 486 | + 'desc' => __('Show the bottom section of listing page', 'geodirectory'),
|
|
| 487 | + 'id' => 'geodir_show_detail_bottom_section', |
|
| 488 | + 'type' => 'checkbox', |
|
| 489 | + 'std' => '1' // Default value to show home top section |
|
| 490 | + ), |
|
| 491 | + array( |
|
| 492 | + 'name' => __('Detail sidebar section on left side', 'geodirectory'),
|
|
| 493 | + 'desc' => __('Display detail sidebar section on left side of the detail page', 'geodirectory'),
|
|
| 494 | + 'id' => 'geodir_detail_sidebar_left_section', |
|
| 495 | + 'type' => 'checkbox', |
|
| 496 | + 'std' => '0' |
|
| 497 | + ), |
|
| 498 | + array( |
|
| 499 | + 'name' => __('Disable GD modal', 'geodirectory'),
|
|
| 500 | + 'desc' => __('Disable GD modal that displays slideshow images in popup', 'geodirectory'),
|
|
| 501 | + 'id' => 'geodir_disable_gb_modal', |
|
| 502 | + 'type' => 'checkbox', |
|
| 503 | + 'std' => '0' |
|
| 504 | + ), |
|
| 505 | + array( |
|
| 506 | + 'name' => __('Disable Tweet, Fb Like, Google+ buttons section', 'geodirectory'),
|
|
| 507 | + 'desc' => __('Disable Tweet, Fb Like, Google+ buttons section that displays on Detail page sidebar', 'geodirectory'),
|
|
| 508 | + 'id' => 'geodir_disable_tfg_buttons_section', |
|
| 509 | + 'type' => 'checkbox', |
|
| 510 | + 'std' => '0' |
|
| 511 | + ), |
|
| 512 | + array( |
|
| 513 | + 'name' => __('Disable Google Analytics section', 'geodirectory'),
|
|
| 514 | + 'desc' => __('Disable Google Analytics section that displays on Detail page sidebar', 'geodirectory'),
|
|
| 515 | + 'id' => 'geodir_disable_google_analytics_section', |
|
| 516 | + 'type' => 'checkbox', |
|
| 517 | + 'std' => '0' |
|
| 518 | + ), |
|
| 519 | + array( |
|
| 520 | + 'name' => __('Disable User Links section', 'geodirectory'),
|
|
| 521 | + 'desc' => __('Disable User Links section (Edit post, Favorite etc..) that displays on Detail page sidebar', 'geodirectory'),
|
|
| 522 | + 'id' => 'geodir_disable_user_links_section', |
|
| 523 | + 'type' => 'checkbox', |
|
| 524 | + 'std' => '0' |
|
| 525 | + ), |
|
| 526 | + array( |
|
| 527 | + 'name' => __('Disable Rating Info section', 'geodirectory'),
|
|
| 528 | + 'desc' => __('Disable Rating Info section that displays on Detail page sidebar', 'geodirectory'),
|
|
| 529 | + 'id' => 'geodir_disable_rating_info_section', |
|
| 530 | + 'type' => 'checkbox', |
|
| 531 | + 'std' => '0' |
|
| 532 | + ), |
|
| 533 | + array( |
|
| 534 | + 'name' => __('Disable Listing Info section', 'geodirectory'),
|
|
| 535 | + 'desc' => __('Disable Listing Info section that displays on Detail page sidebar', 'geodirectory'),
|
|
| 536 | + 'id' => 'geodir_disable_listing_info_section', |
|
| 537 | + 'type' => 'checkbox', |
|
| 538 | + 'std' => '0' |
|
| 539 | + ), |
|
| 540 | 540 | |
| 541 | - array('type' => 'sectionend', 'id' => 'detail_page_settings'),
|
|
| 541 | + array('type' => 'sectionend', 'id' => 'detail_page_settings'),
|
|
| 542 | 542 | |
| 543 | 543 | |
| 544 | - /* ---------- DETAIL PAGE TAB SETTING START*/ |
|
| 544 | + /* ---------- DETAIL PAGE TAB SETTING START*/ |
|
| 545 | 545 | |
| 546 | - array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
|
|
| 546 | + array('name' => __('Detail Page Tab Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_detail_page_tab_settings '),
|
|
| 547 | 547 | |
| 548 | - array( |
|
| 549 | - 'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
|
|
| 550 | - 'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
|
|
| 551 | - 'tip' => '', |
|
| 552 | - 'id' => 'geodir_detail_page_tabs_excluded', |
|
| 553 | - 'css' => 'min-width:300px;', |
|
| 554 | - 'std' => geodir_get_posttypes(), |
|
| 555 | - 'type' => 'multiselect', |
|
| 556 | - 'placeholder_text' => __('Select tabs', 'geodirectory'),
|
|
| 557 | - 'class' => 'chosen_select', |
|
| 558 | - 'options' => array_unique(geodir_detail_page_tabs_key_value_array()) |
|
| 559 | - ), |
|
| 548 | + array( |
|
| 549 | + 'name' => __('Exclude selected tabs from detail page', 'geodirectory'),
|
|
| 550 | + 'desc' => __('Select tabs to exclude from the list of all appearing tabs on detail page.', 'geodirectory'),
|
|
| 551 | + 'tip' => '', |
|
| 552 | + 'id' => 'geodir_detail_page_tabs_excluded', |
|
| 553 | + 'css' => 'min-width:300px;', |
|
| 554 | + 'std' => geodir_get_posttypes(), |
|
| 555 | + 'type' => 'multiselect', |
|
| 556 | + 'placeholder_text' => __('Select tabs', 'geodirectory'),
|
|
| 557 | + 'class' => 'chosen_select', |
|
| 558 | + 'options' => array_unique(geodir_detail_page_tabs_key_value_array()) |
|
| 559 | + ), |
|
| 560 | 560 | |
| 561 | - array( |
|
| 562 | - 'name' => __('Show as list', 'geodirectory'),
|
|
| 563 | - 'desc' => __('Show as list instead of tabs', 'geodirectory'),
|
|
| 564 | - 'id' => 'geodir_disable_tabs', |
|
| 565 | - 'type' => 'checkbox', |
|
| 566 | - 'std' => '0' |
|
| 567 | - ), |
|
| 561 | + array( |
|
| 562 | + 'name' => __('Show as list', 'geodirectory'),
|
|
| 563 | + 'desc' => __('Show as list instead of tabs', 'geodirectory'),
|
|
| 564 | + 'id' => 'geodir_disable_tabs', |
|
| 565 | + 'type' => 'checkbox', |
|
| 566 | + 'std' => '0' |
|
| 567 | + ), |
|
| 568 | 568 | |
| 569 | - array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
|
|
| 570 | - /* ---------- DETAIL PAGE TAB SETTING END*/ |
|
| 569 | + array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
|
|
| 570 | + /* ---------- DETAIL PAGE TAB SETTING END*/ |
|
| 571 | 571 | |
| 572 | - /* START DEFAULT STAR IMAGE*/ |
|
| 573 | - array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
|
|
| 572 | + /* START DEFAULT STAR IMAGE*/ |
|
| 573 | + array('name' => __('Default Rating Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_rating_settings '),
|
|
| 574 | 574 | |
| 575 | - array( |
|
| 576 | - 'name' => __('Upload default rating star icon', 'geodirectory'),
|
|
| 577 | - 'desc' => '', |
|
| 578 | - 'id' => 'geodir_default_rating_star_icon', |
|
| 579 | - 'type' => 'file', |
|
| 580 | - 'std' => '0', |
|
| 581 | - 'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section |
|
| 582 | - ), |
|
| 575 | + array( |
|
| 576 | + 'name' => __('Upload default rating star icon', 'geodirectory'),
|
|
| 577 | + 'desc' => '', |
|
| 578 | + 'id' => 'geodir_default_rating_star_icon', |
|
| 579 | + 'type' => 'file', |
|
| 580 | + 'std' => '0', |
|
| 581 | + 'value' => geodir_plugin_url() . '/geodirectory-assets/images/stars.png'// Default value to show home top section |
|
| 582 | + ), |
|
| 583 | 583 | array( |
| 584 | 584 | 'name' => __('Enable Font Awesome', 'geodirectory'),
|
| 585 | 585 | 'desc' => __('When enabled all rating images will be using font awesome rating icons as images.', 'geodirectory' ),
|
@@ -595,369 +595,369 @@ discard block |
||
| 595 | 595 | 'std' => '#757575' |
| 596 | 596 | ), |
| 597 | 597 | |
| 598 | - array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
|
|
| 598 | + array('type' => 'sectionend', 'id' => 'geodir_detail_page_tab_settings'),
|
|
| 599 | 599 | |
| 600 | - /* END DEFAULT STAR IMAGE*/ |
|
| 600 | + /* END DEFAULT STAR IMAGE*/ |
|
| 601 | 601 | |
| 602 | - /* Detail related post settings start */ |
|
| 602 | + /* Detail related post settings start */ |
|
| 603 | 603 | |
| 604 | - array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
|
|
| 604 | + array('name' => __('Related Post Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'detail_page_related_post_settings '),
|
|
| 605 | 605 | |
| 606 | - array( |
|
| 607 | - 'name' => __('Show related post listing on', 'geodirectory'),
|
|
| 608 | - 'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
|
|
| 609 | - 'tip' => '', |
|
| 610 | - 'id' => 'geodir_add_related_listing_posttypes', |
|
| 611 | - 'css' => 'min-width:300px;', |
|
| 612 | - 'std' => geodir_get_posttypes(), |
|
| 613 | - 'type' => 'multiselect', |
|
| 614 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 615 | - 'class' => 'chosen_select', |
|
| 616 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 617 | - ), |
|
| 606 | + array( |
|
| 607 | + 'name' => __('Show related post listing on', 'geodirectory'),
|
|
| 608 | + 'desc' => __('Select the post types to display related listing on detail page.', 'geodirectory'),
|
|
| 609 | + 'tip' => '', |
|
| 610 | + 'id' => 'geodir_add_related_listing_posttypes', |
|
| 611 | + 'css' => 'min-width:300px;', |
|
| 612 | + 'std' => geodir_get_posttypes(), |
|
| 613 | + 'type' => 'multiselect', |
|
| 614 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 615 | + 'class' => 'chosen_select', |
|
| 616 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 617 | + ), |
|
| 618 | 618 | |
| 619 | - array( |
|
| 620 | - 'name' => __('Relate to', 'geodirectory'),
|
|
| 621 | - 'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
|
|
| 622 | - 'id' => 'geodir_related_post_relate_to', |
|
| 623 | - 'css' => 'min-width:300px;', |
|
| 624 | - 'std' => 'category', |
|
| 625 | - 'type' => 'select', |
|
| 626 | - 'class' => 'chosen_select', |
|
| 627 | - 'options' => array_unique(array( |
|
| 628 | - 'category' => __('Categories', 'geodirectory'),
|
|
| 629 | - 'tags' => __('Tags', 'geodirectory'),
|
|
| 630 | - )) |
|
| 631 | - ), |
|
| 619 | + array( |
|
| 620 | + 'name' => __('Relate to', 'geodirectory'),
|
|
| 621 | + 'desc' => __('Set the relation between current post to related posts.', 'geodirectory'),
|
|
| 622 | + 'id' => 'geodir_related_post_relate_to', |
|
| 623 | + 'css' => 'min-width:300px;', |
|
| 624 | + 'std' => 'category', |
|
| 625 | + 'type' => 'select', |
|
| 626 | + 'class' => 'chosen_select', |
|
| 627 | + 'options' => array_unique(array( |
|
| 628 | + 'category' => __('Categories', 'geodirectory'),
|
|
| 629 | + 'tags' => __('Tags', 'geodirectory'),
|
|
| 630 | + )) |
|
| 631 | + ), |
|
| 632 | 632 | |
| 633 | - array( |
|
| 634 | - 'name' => __('Layout', 'geodirectory'),
|
|
| 635 | - 'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
|
|
| 636 | - 'id' => 'geodir_related_post_listing_view', |
|
| 637 | - 'css' => 'min-width:300px;', |
|
| 638 | - 'std' => 'gridview_onehalf', |
|
| 639 | - 'type' => 'select', |
|
| 640 | - 'class' => 'chosen_select', |
|
| 641 | - 'options' => array_unique(array( |
|
| 642 | - 'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
|
|
| 643 | - 'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
|
|
| 644 | - 'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
|
|
| 645 | - 'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
|
|
| 646 | - 'listview' => __('List view', 'geodirectory'),
|
|
| 647 | - )) |
|
| 648 | - ), |
|
| 633 | + array( |
|
| 634 | + 'name' => __('Layout', 'geodirectory'),
|
|
| 635 | + 'desc' => __('Set the listing view of relate post on detail page', 'geodirectory'),
|
|
| 636 | + 'id' => 'geodir_related_post_listing_view', |
|
| 637 | + 'css' => 'min-width:300px;', |
|
| 638 | + 'std' => 'gridview_onehalf', |
|
| 639 | + 'type' => 'select', |
|
| 640 | + 'class' => 'chosen_select', |
|
| 641 | + 'options' => array_unique(array( |
|
| 642 | + 'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
|
|
| 643 | + 'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
|
|
| 644 | + 'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
|
|
| 645 | + 'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
|
|
| 646 | + 'listview' => __('List view', 'geodirectory'),
|
|
| 647 | + )) |
|
| 648 | + ), |
|
| 649 | 649 | |
| 650 | - array( |
|
| 651 | - 'name' => __('Sort by', 'geodirectory'),
|
|
| 652 | - 'desc' => __('Set the related post listing sort by view', 'geodirectory'),
|
|
| 653 | - 'id' => 'geodir_related_post_sortby', |
|
| 654 | - 'css' => 'min-width:300px;', |
|
| 655 | - 'std' => 'latest', |
|
| 656 | - 'type' => 'select', |
|
| 657 | - 'class' => 'chosen_select', |
|
| 658 | - 'options' => array_unique(array( |
|
| 659 | - 'latest' => __('Latest', 'geodirectory'),
|
|
| 660 | - 'featured' => __('Featured', 'geodirectory'),
|
|
| 661 | - 'high_review' => __('Review', 'geodirectory'),
|
|
| 662 | - 'high_rating' => __('Rating', 'geodirectory'),
|
|
| 663 | - 'random' => __('Random', 'geodirectory'),
|
|
| 664 | - 'nearest' => __('Nearest', 'geodirectory'),
|
|
| 665 | - )) |
|
| 666 | - ), |
|
| 650 | + array( |
|
| 651 | + 'name' => __('Sort by', 'geodirectory'),
|
|
| 652 | + 'desc' => __('Set the related post listing sort by view', 'geodirectory'),
|
|
| 653 | + 'id' => 'geodir_related_post_sortby', |
|
| 654 | + 'css' => 'min-width:300px;', |
|
| 655 | + 'std' => 'latest', |
|
| 656 | + 'type' => 'select', |
|
| 657 | + 'class' => 'chosen_select', |
|
| 658 | + 'options' => array_unique(array( |
|
| 659 | + 'latest' => __('Latest', 'geodirectory'),
|
|
| 660 | + 'featured' => __('Featured', 'geodirectory'),
|
|
| 661 | + 'high_review' => __('Review', 'geodirectory'),
|
|
| 662 | + 'high_rating' => __('Rating', 'geodirectory'),
|
|
| 663 | + 'random' => __('Random', 'geodirectory'),
|
|
| 664 | + 'nearest' => __('Nearest', 'geodirectory'),
|
|
| 665 | + )) |
|
| 666 | + ), |
|
| 667 | 667 | |
| 668 | - array( |
|
| 669 | - 'name' => __('Number of posts:', 'geodirectory'),
|
|
| 670 | - 'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
|
|
| 671 | - 'id' => 'geodir_related_post_count', |
|
| 672 | - 'type' => 'text', |
|
| 673 | - 'css' => 'min-width:300px;', |
|
| 674 | - 'std' => '5' // Default value to show home top section |
|
| 675 | - ), |
|
| 668 | + array( |
|
| 669 | + 'name' => __('Number of posts:', 'geodirectory'),
|
|
| 670 | + 'desc' => __('Enter number of posts to display on related posts listing', 'geodirectory'),
|
|
| 671 | + 'id' => 'geodir_related_post_count', |
|
| 672 | + 'type' => 'text', |
|
| 673 | + 'css' => 'min-width:300px;', |
|
| 674 | + 'std' => '5' // Default value to show home top section |
|
| 675 | + ), |
|
| 676 | 676 | |
| 677 | - array( |
|
| 678 | - 'name' => __('Post excerpt', 'geodirectory'),
|
|
| 679 | - 'desc' => __('Post content excerpt character count', 'geodirectory'),
|
|
| 680 | - 'id' => 'geodir_related_post_excerpt', |
|
| 681 | - 'type' => 'text', |
|
| 682 | - 'css' => 'min-width:300px;', |
|
| 683 | - 'std' => '20' // Default value to show home top section |
|
| 684 | - ), |
|
| 677 | + array( |
|
| 678 | + 'name' => __('Post excerpt', 'geodirectory'),
|
|
| 679 | + 'desc' => __('Post content excerpt character count', 'geodirectory'),
|
|
| 680 | + 'id' => 'geodir_related_post_excerpt', |
|
| 681 | + 'type' => 'text', |
|
| 682 | + 'css' => 'min-width:300px;', |
|
| 683 | + 'std' => '20' // Default value to show home top section |
|
| 684 | + ), |
|
| 685 | 685 | |
| 686 | 686 | |
| 687 | - array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
|
|
| 688 | - /* Detail Layout Settings end */ |
|
| 687 | + array('type' => 'sectionend', 'id' => 'detail_page_related_post_settings'),
|
|
| 688 | + /* Detail Layout Settings end */ |
|
| 689 | 689 | |
| 690 | - /* Author Layout Settings Start */ |
|
| 690 | + /* Author Layout Settings Start */ |
|
| 691 | 691 | |
| 692 | - array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
|
|
| 692 | + array('name' => __('Author', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_author_settings '),
|
|
| 693 | 693 | |
| 694 | 694 | |
| 695 | - array('name' => __('Author Page Layout Settings', 'geodirectory'),
|
|
| 696 | - 'type' => 'sectionstart', |
|
| 697 | - 'desc' => '', |
|
| 698 | - 'id' => 'geodir_author_layout'), |
|
| 695 | + array('name' => __('Author Page Layout Settings', 'geodirectory'),
|
|
| 696 | + 'type' => 'sectionstart', |
|
| 697 | + 'desc' => '', |
|
| 698 | + 'id' => 'geodir_author_layout'), |
|
| 699 | 699 | |
| 700 | - array( |
|
| 701 | - 'name' => __('Author top section', 'geodirectory'),
|
|
| 702 | - 'desc' => __('Show the top section of author page', 'geodirectory'),
|
|
| 703 | - 'id' => 'geodir_show_author_top_section', |
|
| 704 | - 'type' => 'checkbox', |
|
| 705 | - 'std' => '1' // Default value to show home top section |
|
| 706 | - ), |
|
| 700 | + array( |
|
| 701 | + 'name' => __('Author top section', 'geodirectory'),
|
|
| 702 | + 'desc' => __('Show the top section of author page', 'geodirectory'),
|
|
| 703 | + 'id' => 'geodir_show_author_top_section', |
|
| 704 | + 'type' => 'checkbox', |
|
| 705 | + 'std' => '1' // Default value to show home top section |
|
| 706 | + ), |
|
| 707 | 707 | |
| 708 | - array( |
|
| 709 | - 'name' => __('Author right section', 'geodirectory'),
|
|
| 710 | - 'desc' => __('Show the right section of author page', 'geodirectory'),
|
|
| 711 | - 'id' => 'geodir_show_author_right_section', |
|
| 712 | - 'type' => 'checkbox', |
|
| 713 | - 'std' => '1' // Default value to show home top section |
|
| 714 | - ), |
|
| 708 | + array( |
|
| 709 | + 'name' => __('Author right section', 'geodirectory'),
|
|
| 710 | + 'desc' => __('Show the right section of author page', 'geodirectory'),
|
|
| 711 | + 'id' => 'geodir_show_author_right_section', |
|
| 712 | + 'type' => 'checkbox', |
|
| 713 | + 'std' => '1' // Default value to show home top section |
|
| 714 | + ), |
|
| 715 | 715 | |
| 716 | - array( |
|
| 717 | - 'name' => __('Width of author right section', 'geodirectory'),
|
|
| 718 | - 'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
|
|
| 719 | - 'id' => 'geodir_width_author_right_section', |
|
| 720 | - 'type' => 'text', |
|
| 721 | - 'css' => 'min-width:300px;', |
|
| 722 | - 'std' => '30' // Default value to show home top section |
|
| 723 | - ), |
|
| 716 | + array( |
|
| 717 | + 'name' => __('Width of author right section', 'geodirectory'),
|
|
| 718 | + 'desc' => __('Enter the width of right section of author page in %', 'geodirectory'),
|
|
| 719 | + 'id' => 'geodir_width_author_right_section', |
|
| 720 | + 'type' => 'text', |
|
| 721 | + 'css' => 'min-width:300px;', |
|
| 722 | + 'std' => '30' // Default value to show home top section |
|
| 723 | + ), |
|
| 724 | 724 | |
| 725 | - array( |
|
| 726 | - 'name' => __('Author content section view', 'geodirectory'),
|
|
| 727 | - 'desc' => __('Set the listing view of author page', 'geodirectory'),
|
|
| 728 | - 'id' => 'geodir_author_view', |
|
| 729 | - 'css' => 'min-width:300px;', |
|
| 730 | - 'std' => 'gridview_onehalf', |
|
| 731 | - 'type' => 'select', |
|
| 732 | - 'class' => 'chosen_select', |
|
| 733 | - 'options' => array_unique(array( |
|
| 734 | - 'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
|
|
| 735 | - 'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
|
|
| 736 | - 'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
|
|
| 737 | - 'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
|
|
| 738 | - 'listview' => __('List view', 'geodirectory'),
|
|
| 739 | - )) |
|
| 740 | - ), |
|
| 725 | + array( |
|
| 726 | + 'name' => __('Author content section view', 'geodirectory'),
|
|
| 727 | + 'desc' => __('Set the listing view of author page', 'geodirectory'),
|
|
| 728 | + 'id' => 'geodir_author_view', |
|
| 729 | + 'css' => 'min-width:300px;', |
|
| 730 | + 'std' => 'gridview_onehalf', |
|
| 731 | + 'type' => 'select', |
|
| 732 | + 'class' => 'chosen_select', |
|
| 733 | + 'options' => array_unique(array( |
|
| 734 | + 'gridview_onehalf' => __('Grid View (Two Columns)', 'geodirectory'),
|
|
| 735 | + 'gridview_onethird' => __('Grid View (Three Columns)', 'geodirectory'),
|
|
| 736 | + 'gridview_onefourth' => __('Grid View (Four Columns)', 'geodirectory'),
|
|
| 737 | + 'gridview_onefifth' => __('Grid View (Five Columns)', 'geodirectory'),
|
|
| 738 | + 'listview' => __('List view', 'geodirectory'),
|
|
| 739 | + )) |
|
| 740 | + ), |
|
| 741 | 741 | |
| 742 | - array( |
|
| 743 | - 'name' => __('Width of author content section', 'geodirectory'),
|
|
| 744 | - 'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
|
|
| 745 | - 'id' => 'geodir_width_author_contant_section', |
|
| 746 | - 'type' => 'text', |
|
| 747 | - 'css' => 'min-width:300px;', |
|
| 748 | - 'std' => '63' // Default value to show home top section |
|
| 749 | - ), |
|
| 742 | + array( |
|
| 743 | + 'name' => __('Width of author content section', 'geodirectory'),
|
|
| 744 | + 'desc' => __('Enter the width of content section of author page in %', 'geodirectory'),
|
|
| 745 | + 'id' => 'geodir_width_author_contant_section', |
|
| 746 | + 'type' => 'text', |
|
| 747 | + 'css' => 'min-width:300px;', |
|
| 748 | + 'std' => '63' // Default value to show home top section |
|
| 749 | + ), |
|
| 750 | 750 | |
| 751 | - array( |
|
| 752 | - 'name' => __('Author left section', 'geodirectory'),
|
|
| 753 | - 'desc' => __('Show the left section of author page', 'geodirectory'),
|
|
| 754 | - 'id' => 'geodir_show_author_left_section', |
|
| 755 | - 'type' => 'checkbox', |
|
| 756 | - 'std' => '0' // Default value to show home top section |
|
| 757 | - ), |
|
| 751 | + array( |
|
| 752 | + 'name' => __('Author left section', 'geodirectory'),
|
|
| 753 | + 'desc' => __('Show the left section of author page', 'geodirectory'),
|
|
| 754 | + 'id' => 'geodir_show_author_left_section', |
|
| 755 | + 'type' => 'checkbox', |
|
| 756 | + 'std' => '0' // Default value to show home top section |
|
| 757 | + ), |
|
| 758 | 758 | |
| 759 | - array( |
|
| 760 | - 'name' => __('Width of author left section', 'geodirectory'),
|
|
| 761 | - 'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
|
|
| 762 | - 'id' => 'geodir_width_author_left_section', |
|
| 763 | - 'type' => 'text', |
|
| 764 | - 'css' => 'min-width:300px;', |
|
| 765 | - 'std' => '30' // Default value to show home top section |
|
| 766 | - ), |
|
| 759 | + array( |
|
| 760 | + 'name' => __('Width of author left section', 'geodirectory'),
|
|
| 761 | + 'desc' => __('Enter the width of left section of home page in %', 'geodirectory'),
|
|
| 762 | + 'id' => 'geodir_width_author_left_section', |
|
| 763 | + 'type' => 'text', |
|
| 764 | + 'css' => 'min-width:300px;', |
|
| 765 | + 'std' => '30' // Default value to show home top section |
|
| 766 | + ), |
|
| 767 | 767 | |
| 768 | - array( |
|
| 769 | - 'name' => __('Author bottom section', 'geodirectory'),
|
|
| 770 | - 'desc' => __('Show the bottom section of author page', 'geodirectory'),
|
|
| 771 | - 'id' => 'geodir_show_author_bottom_section', |
|
| 772 | - 'type' => 'checkbox', |
|
| 773 | - 'std' => '0' // Default value to show home top section |
|
| 774 | - ), |
|
| 768 | + array( |
|
| 769 | + 'name' => __('Author bottom section', 'geodirectory'),
|
|
| 770 | + 'desc' => __('Show the bottom section of author page', 'geodirectory'),
|
|
| 771 | + 'id' => 'geodir_show_author_bottom_section', |
|
| 772 | + 'type' => 'checkbox', |
|
| 773 | + 'std' => '0' // Default value to show home top section |
|
| 774 | + ), |
|
| 775 | 775 | |
| 776 | 776 | |
| 777 | - array( |
|
| 778 | - 'name' => __('Description word limit', 'geodirectory'),
|
|
| 779 | - 'desc' => '', |
|
| 780 | - 'id' => 'geodir_author_desc_word_limit', |
|
| 781 | - 'type' => 'text', |
|
| 782 | - 'css' => 'min-width:300px;', |
|
| 783 | - 'std' => '50' // Default value to show home top section |
|
| 784 | - ), |
|
| 777 | + array( |
|
| 778 | + 'name' => __('Description word limit', 'geodirectory'),
|
|
| 779 | + 'desc' => '', |
|
| 780 | + 'id' => 'geodir_author_desc_word_limit', |
|
| 781 | + 'type' => 'text', |
|
| 782 | + 'css' => 'min-width:300px;', |
|
| 783 | + 'std' => '50' // Default value to show home top section |
|
| 784 | + ), |
|
| 785 | 785 | |
| 786 | - array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
|
|
| 787 | - /* Author Layout Settings end */ |
|
| 786 | + array('type' => 'sectionend', 'id' => 'geodir_author_layout'),
|
|
| 787 | + /* Author Layout Settings end */ |
|
| 788 | 788 | |
| 789 | 789 | |
| 790 | - /* Post Type Navigation Settings Start */ |
|
| 791 | - array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
|
|
| 790 | + /* Post Type Navigation Settings Start */ |
|
| 791 | + array('name' => __('Navigation', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_navigation_settings'),
|
|
| 792 | 792 | |
| 793 | 793 | |
| 794 | - /* Post Type Navigation Settings Start */ |
|
| 794 | + /* Post Type Navigation Settings Start */ |
|
| 795 | 795 | |
| 796 | - array('name' => __('Navigation Locations', 'geodirectory'),
|
|
| 797 | - 'type' => 'sectionstart', |
|
| 798 | - 'desc' => '', |
|
| 799 | - 'id' => 'geodir_navigation_locations'), |
|
| 796 | + array('name' => __('Navigation Locations', 'geodirectory'),
|
|
| 797 | + 'type' => 'sectionstart', |
|
| 798 | + 'desc' => '', |
|
| 799 | + 'id' => 'geodir_navigation_locations'), |
|
| 800 | 800 | |
| 801 | - array( |
|
| 802 | - 'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
|
|
| 803 | - 'desc' => '', |
|
| 804 | - 'tip' => '', |
|
| 805 | - 'id' => 'geodir_theme_location_nav', |
|
| 806 | - 'css' => 'min-width:300px;', |
|
| 807 | - 'std' => array(), |
|
| 808 | - 'type' => 'multiselect', |
|
| 809 | - 'placeholder_text' => __('Select menu locations', 'geodirectory'),
|
|
| 810 | - 'class' => 'chosen_select', |
|
| 811 | - 'options' => array_unique(geodir_theme_location_setting_fun()) |
|
| 812 | - ), |
|
| 813 | - array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
|
|
| 814 | - |
|
| 815 | - |
|
| 816 | - array('name' => __('Navigation Settings', 'geodirectory'),
|
|
| 817 | - 'type' => 'sectionstart', |
|
| 818 | - 'desc' => '', |
|
| 819 | - 'id' => 'geodir_navigation_options'), |
|
| 801 | + array( |
|
| 802 | + 'name' => __('Show geodirectory navigation in selected menu locations', 'geodirectory'),
|
|
| 803 | + 'desc' => '', |
|
| 804 | + 'tip' => '', |
|
| 805 | + 'id' => 'geodir_theme_location_nav', |
|
| 806 | + 'css' => 'min-width:300px;', |
|
| 807 | + 'std' => array(), |
|
| 808 | + 'type' => 'multiselect', |
|
| 809 | + 'placeholder_text' => __('Select menu locations', 'geodirectory'),
|
|
| 810 | + 'class' => 'chosen_select', |
|
| 811 | + 'options' => array_unique(geodir_theme_location_setting_fun()) |
|
| 812 | + ), |
|
| 813 | + array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
|
|
| 820 | 814 | |
| 821 | 815 | |
| 822 | - array( |
|
| 823 | - 'name' => __('Show add listing navigation in menu', 'geodirectory'),
|
|
| 824 | - 'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
|
|
| 825 | - 'id' => 'geodir_show_addlisting_nav', |
|
| 826 | - 'std' => '1', |
|
| 827 | - 'type' => 'checkbox' |
|
| 828 | - ), |
|
| 816 | + array('name' => __('Navigation Settings', 'geodirectory'),
|
|
| 817 | + 'type' => 'sectionstart', |
|
| 818 | + 'desc' => '', |
|
| 819 | + 'id' => 'geodir_navigation_options'), |
|
| 829 | 820 | |
| 830 | - array( |
|
| 831 | - 'name' => __('Show listings navigation in menu', 'geodirectory'),
|
|
| 832 | - 'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
|
|
| 833 | - 'id' => 'geodir_show_listing_nav', |
|
| 834 | - 'std' => '1', |
|
| 835 | - 'type' => 'checkbox' |
|
| 836 | - ), |
|
| 837 | 821 | |
| 838 | - array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
|
|
| 822 | + array( |
|
| 823 | + 'name' => __('Show add listing navigation in menu', 'geodirectory'),
|
|
| 824 | + 'desc' => sprintf(__('Show add listing navigation in main menu? (untick to disable) If you disable this option, none of the add listing link will appear in main navigation.', 'geodirectory')),
|
|
| 825 | + 'id' => 'geodir_show_addlisting_nav', |
|
| 826 | + 'std' => '1', |
|
| 827 | + 'type' => 'checkbox' |
|
| 828 | + ), |
|
| 839 | 829 | |
| 830 | + array( |
|
| 831 | + 'name' => __('Show listings navigation in menu', 'geodirectory'),
|
|
| 832 | + 'desc' => sprintf(__('Show listing navigation in main menu? (untick to disable) If you disable this option, none of the listing link will appear in main navigation.', 'geodirectory')),
|
|
| 833 | + 'id' => 'geodir_show_listing_nav', |
|
| 834 | + 'std' => '1', |
|
| 835 | + 'type' => 'checkbox' |
|
| 836 | + ), |
|
| 840 | 837 | |
| 841 | - array('name' => __('Post Type Navigation Settings', 'geodirectory'),
|
|
| 842 | - 'type' => 'sectionstart', |
|
| 843 | - 'desc' => '', |
|
| 844 | - 'id' => 'geodir_post_type_navigation_layout'), |
|
| 845 | - array( |
|
| 846 | - 'name' => __('Show listing link in main navigation', 'geodirectory'),
|
|
| 847 | - 'desc' => '', |
|
| 848 | - 'tip' => '', |
|
| 849 | - 'id' => 'geodir_add_posttype_in_main_nav', |
|
| 850 | - 'css' => 'min-width:300px;', |
|
| 851 | - 'std' => array(), |
|
| 852 | - 'type' => 'multiselect', |
|
| 853 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 854 | - 'class' => 'chosen_select', |
|
| 855 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 856 | - ), |
|
| 838 | + array('type' => 'sectionend', 'id' => 'geodir_navigation_options'),
|
|
| 857 | 839 | |
| 858 | - array( |
|
| 859 | - 'name' => __('Show listing link in listing navigation', 'geodirectory'),
|
|
| 860 | - 'desc' => '', |
|
| 861 | - 'tip' => '', |
|
| 862 | - 'id' => 'geodir_add_posttype_in_listing_nav', |
|
| 863 | - 'css' => 'min-width:300px;', |
|
| 864 | - 'std' => geodir_get_posttypes(), |
|
| 865 | - 'type' => 'multiselect', |
|
| 866 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 867 | - 'class' => 'chosen_select', |
|
| 868 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 869 | - ), |
|
| 870 | 840 | |
| 871 | - array( |
|
| 872 | - 'name' => __('Allow post type to add from frontend', 'geodirectory'),
|
|
| 873 | - 'desc' => '', |
|
| 874 | - 'tip' => '', |
|
| 875 | - 'id' => 'geodir_allow_posttype_frontend', |
|
| 876 | - 'css' => 'min-width:300px;', |
|
| 877 | - 'std' => geodir_get_posttypes(), |
|
| 878 | - 'type' => 'multiselect', |
|
| 879 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 880 | - 'class' => 'chosen_select', |
|
| 881 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 882 | - ), |
|
| 841 | + array('name' => __('Post Type Navigation Settings', 'geodirectory'),
|
|
| 842 | + 'type' => 'sectionstart', |
|
| 843 | + 'desc' => '', |
|
| 844 | + 'id' => 'geodir_post_type_navigation_layout'), |
|
| 845 | + array( |
|
| 846 | + 'name' => __('Show listing link in main navigation', 'geodirectory'),
|
|
| 847 | + 'desc' => '', |
|
| 848 | + 'tip' => '', |
|
| 849 | + 'id' => 'geodir_add_posttype_in_main_nav', |
|
| 850 | + 'css' => 'min-width:300px;', |
|
| 851 | + 'std' => array(), |
|
| 852 | + 'type' => 'multiselect', |
|
| 853 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 854 | + 'class' => 'chosen_select', |
|
| 855 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 856 | + ), |
|
| 883 | 857 | |
| 884 | - array( |
|
| 885 | - 'name' => __('Show add listing link in main navigation', 'geodirectory'),
|
|
| 886 | - 'desc' => '', |
|
| 887 | - 'tip' => '', |
|
| 888 | - 'id' => 'geodir_add_listing_link_main_nav', |
|
| 889 | - 'css' => 'min-width:300px;', |
|
| 890 | - 'std' => array(), |
|
| 891 | - 'type' => 'multiselect', |
|
| 892 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 893 | - 'class' => 'chosen_select', |
|
| 894 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 895 | - ), |
|
| 858 | + array( |
|
| 859 | + 'name' => __('Show listing link in listing navigation', 'geodirectory'),
|
|
| 860 | + 'desc' => '', |
|
| 861 | + 'tip' => '', |
|
| 862 | + 'id' => 'geodir_add_posttype_in_listing_nav', |
|
| 863 | + 'css' => 'min-width:300px;', |
|
| 864 | + 'std' => geodir_get_posttypes(), |
|
| 865 | + 'type' => 'multiselect', |
|
| 866 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 867 | + 'class' => 'chosen_select', |
|
| 868 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 869 | + ), |
|
| 896 | 870 | |
| 897 | - array( |
|
| 898 | - 'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
|
|
| 899 | - 'desc' => '', |
|
| 900 | - 'tip' => '', |
|
| 901 | - 'id' => 'geodir_add_listing_link_add_listing_nav', |
|
| 902 | - 'css' => 'min-width:300px;', |
|
| 903 | - 'std' => geodir_get_posttypes(), |
|
| 904 | - 'type' => 'multiselect', |
|
| 905 | - 'class' => 'chosen_select', |
|
| 906 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 907 | - ), |
|
| 871 | + array( |
|
| 872 | + 'name' => __('Allow post type to add from frontend', 'geodirectory'),
|
|
| 873 | + 'desc' => '', |
|
| 874 | + 'tip' => '', |
|
| 875 | + 'id' => 'geodir_allow_posttype_frontend', |
|
| 876 | + 'css' => 'min-width:300px;', |
|
| 877 | + 'std' => geodir_get_posttypes(), |
|
| 878 | + 'type' => 'multiselect', |
|
| 879 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 880 | + 'class' => 'chosen_select', |
|
| 881 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 882 | + ), |
|
| 883 | + |
|
| 884 | + array( |
|
| 885 | + 'name' => __('Show add listing link in main navigation', 'geodirectory'),
|
|
| 886 | + 'desc' => '', |
|
| 887 | + 'tip' => '', |
|
| 888 | + 'id' => 'geodir_add_listing_link_main_nav', |
|
| 889 | + 'css' => 'min-width:300px;', |
|
| 890 | + 'std' => array(), |
|
| 891 | + 'type' => 'multiselect', |
|
| 892 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 893 | + 'class' => 'chosen_select', |
|
| 894 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 895 | + ), |
|
| 896 | + |
|
| 897 | + array( |
|
| 898 | + 'name' => __('Show add listing link in add listing navigation', 'geodirectory'),
|
|
| 899 | + 'desc' => '', |
|
| 900 | + 'tip' => '', |
|
| 901 | + 'id' => 'geodir_add_listing_link_add_listing_nav', |
|
| 902 | + 'css' => 'min-width:300px;', |
|
| 903 | + 'std' => geodir_get_posttypes(), |
|
| 904 | + 'type' => 'multiselect', |
|
| 905 | + 'class' => 'chosen_select', |
|
| 906 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 907 | + ), |
|
| 908 | 908 | |
| 909 | - array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
|
|
| 909 | + array('type' => 'sectionend', 'id' => 'geodir_post_type_navigation_layout'),
|
|
| 910 | 910 | |
| 911 | 911 | |
| 912 | - array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
|
|
| 912 | + array('name' => __('User Dashboard Post Type Navigation Settings', 'geodirectory'), 'type' => 'sectionstart', 'desc' => '', 'id' => 'geodir_user_dashboard_post_type '),
|
|
| 913 | 913 | |
| 914 | 914 | |
| 915 | - array( |
|
| 916 | - 'name' => __('Show add listing link in user dashboard', 'geodirectory'),
|
|
| 917 | - 'desc' => '', |
|
| 918 | - 'tip' => '', |
|
| 919 | - 'id' => 'geodir_add_listing_link_user_dashboard', |
|
| 920 | - 'css' => 'min-width:300px;', |
|
| 921 | - 'std' => geodir_get_posttypes(), |
|
| 922 | - 'type' => 'multiselect', |
|
| 923 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 924 | - 'class' => 'chosen_select', |
|
| 925 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 926 | - ), |
|
| 915 | + array( |
|
| 916 | + 'name' => __('Show add listing link in user dashboard', 'geodirectory'),
|
|
| 917 | + 'desc' => '', |
|
| 918 | + 'tip' => '', |
|
| 919 | + 'id' => 'geodir_add_listing_link_user_dashboard', |
|
| 920 | + 'css' => 'min-width:300px;', |
|
| 921 | + 'std' => geodir_get_posttypes(), |
|
| 922 | + 'type' => 'multiselect', |
|
| 923 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 924 | + 'class' => 'chosen_select', |
|
| 925 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 926 | + ), |
|
| 927 | 927 | |
| 928 | - array( |
|
| 929 | - 'name' => __('Show favorite link in user dashboard', 'geodirectory'),
|
|
| 930 | - 'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
|
|
| 931 | - 'tip' => '', |
|
| 932 | - 'id' => 'geodir_favorite_link_user_dashboard', |
|
| 933 | - 'css' => 'min-width:300px;', |
|
| 934 | - 'std' => geodir_get_posttypes(), |
|
| 935 | - 'type' => 'multiselect', |
|
| 936 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 937 | - 'class' => 'chosen_select', |
|
| 938 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 939 | - ), |
|
| 928 | + array( |
|
| 929 | + 'name' => __('Show favorite link in user dashboard', 'geodirectory'),
|
|
| 930 | + 'desc' => __('Option will not appear if user does not have a favorite of that post type', 'geodirectory'),
|
|
| 931 | + 'tip' => '', |
|
| 932 | + 'id' => 'geodir_favorite_link_user_dashboard', |
|
| 933 | + 'css' => 'min-width:300px;', |
|
| 934 | + 'std' => geodir_get_posttypes(), |
|
| 935 | + 'type' => 'multiselect', |
|
| 936 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 937 | + 'class' => 'chosen_select', |
|
| 938 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 939 | + ), |
|
| 940 | 940 | |
| 941 | - array( |
|
| 942 | - 'name' => __('Show listing link in user dashboard', 'geodirectory'),
|
|
| 943 | - 'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
|
|
| 944 | - 'tip' => '', |
|
| 945 | - 'id' => 'geodir_listing_link_user_dashboard', |
|
| 946 | - 'css' => 'min-width:300px;', |
|
| 947 | - 'std' => geodir_get_posttypes(), |
|
| 948 | - 'type' => 'multiselect', |
|
| 949 | - 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 950 | - 'class' => 'chosen_select', |
|
| 951 | - 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 952 | - ), |
|
| 953 | - |
|
| 954 | - array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
|
|
| 955 | - /* Post Type Navigation Settings End */ |
|
| 956 | - |
|
| 957 | - /* Script Settings Start */ |
|
| 958 | - array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
|
|
| 959 | - |
|
| 960 | - /* |
|
| 941 | + array( |
|
| 942 | + 'name' => __('Show listing link in user dashboard', 'geodirectory'),
|
|
| 943 | + 'desc' => __('Option will not appear if user does not have his/her own listing of that post type', 'geodirectory'),
|
|
| 944 | + 'tip' => '', |
|
| 945 | + 'id' => 'geodir_listing_link_user_dashboard', |
|
| 946 | + 'css' => 'min-width:300px;', |
|
| 947 | + 'std' => geodir_get_posttypes(), |
|
| 948 | + 'type' => 'multiselect', |
|
| 949 | + 'placeholder_text' => __('Select post types', 'geodirectory'),
|
|
| 950 | + 'class' => 'chosen_select', |
|
| 951 | + 'options' => array_unique(geodir_post_type_setting_fun()) |
|
| 952 | + ), |
|
| 953 | + |
|
| 954 | + array('type' => 'sectionend', 'id' => 'geodir_user_dashboard_post_type'),
|
|
| 955 | + /* Post Type Navigation Settings End */ |
|
| 956 | + |
|
| 957 | + /* Script Settings Start */ |
|
| 958 | + array('name' => __('Scripts', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_script_settings '),
|
|
| 959 | + |
|
| 960 | + /* |
|
| 961 | 961 | array( 'name' => __( 'Add/Remove Scripts', 'geodirectory' ), |
| 962 | 962 | 'type' => 'sectionstart', |
| 963 | 963 | 'desc' => '', |
@@ -983,190 +983,190 @@ discard block |
||
| 983 | 983 | |
| 984 | 984 | */ |
| 985 | 985 | |
| 986 | - array('name' => __('GD Lazy Load Images', 'geodirectory'),
|
|
| 987 | - 'type' => 'sectionstart', |
|
| 988 | - 'desc' => '', |
|
| 989 | - 'id' => 'geodir_gdll_settings'), |
|
| 986 | + array('name' => __('GD Lazy Load Images', 'geodirectory'),
|
|
| 987 | + 'type' => 'sectionstart', |
|
| 988 | + 'desc' => '', |
|
| 989 | + 'id' => 'geodir_gdll_settings'), |
|
| 990 | 990 | |
| 991 | - array( |
|
| 992 | - 'name' => __('Enable lazy load images?', 'geodirectory'),
|
|
| 993 | - 'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
|
|
| 994 | - 'id' => 'geodir_lazy_load', |
|
| 995 | - 'type' => 'checkbox', |
|
| 996 | - 'std' => '1' // Default value to show home top section |
|
| 997 | - ), |
|
| 998 | - array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
|
|
| 991 | + array( |
|
| 992 | + 'name' => __('Enable lazy load images?', 'geodirectory'),
|
|
| 993 | + 'desc' => __('GD images will be loaded only when visible on the page', 'geodirectory'),
|
|
| 994 | + 'id' => 'geodir_lazy_load', |
|
| 995 | + 'type' => 'checkbox', |
|
| 996 | + 'std' => '1' // Default value to show home top section |
|
| 997 | + ), |
|
| 998 | + array('type' => 'sectionend', 'id' => 'geodir_gdll_settings'),
|
|
| 999 | 999 | |
| 1000 | 1000 | |
| 1001 | - array('name' => __('Script Settings', 'geodirectory'),
|
|
| 1002 | - 'type' => 'sectionstart', |
|
| 1003 | - 'desc' => '', |
|
| 1004 | - 'id' => 'geodir_script_settings'), |
|
| 1001 | + array('name' => __('Script Settings', 'geodirectory'),
|
|
| 1002 | + 'type' => 'sectionstart', |
|
| 1003 | + 'desc' => '', |
|
| 1004 | + 'id' => 'geodir_script_settings'), |
|
| 1005 | 1005 | |
| 1006 | - array( |
|
| 1007 | - 'name' => __('Custom style css code', 'geodirectory'),
|
|
| 1008 | - 'desc' => '', |
|
| 1009 | - 'id' => 'geodir_coustem_css', |
|
| 1010 | - 'type' => 'textarea', |
|
| 1011 | - 'css' => 'min-width:300px;', |
|
| 1012 | - 'std' => '' // Default value for the page title - changed in settings |
|
| 1013 | - ), |
|
| 1006 | + array( |
|
| 1007 | + 'name' => __('Custom style css code', 'geodirectory'),
|
|
| 1008 | + 'desc' => '', |
|
| 1009 | + 'id' => 'geodir_coustem_css', |
|
| 1010 | + 'type' => 'textarea', |
|
| 1011 | + 'css' => 'min-width:300px;', |
|
| 1012 | + 'std' => '' // Default value for the page title - changed in settings |
|
| 1013 | + ), |
|
| 1014 | 1014 | |
| 1015 | - array( |
|
| 1016 | - 'name' => __('Header script code', 'geodirectory'),
|
|
| 1017 | - 'desc' => '', |
|
| 1018 | - 'id' => 'geodir_header_scripts', |
|
| 1019 | - 'type' => 'textarea', |
|
| 1020 | - 'css' => 'min-width:300px;', |
|
| 1021 | - 'std' => '' // Default value for the page title - changed in settings |
|
| 1022 | - ), |
|
| 1015 | + array( |
|
| 1016 | + 'name' => __('Header script code', 'geodirectory'),
|
|
| 1017 | + 'desc' => '', |
|
| 1018 | + 'id' => 'geodir_header_scripts', |
|
| 1019 | + 'type' => 'textarea', |
|
| 1020 | + 'css' => 'min-width:300px;', |
|
| 1021 | + 'std' => '' // Default value for the page title - changed in settings |
|
| 1022 | + ), |
|
| 1023 | 1023 | |
| 1024 | - array( |
|
| 1025 | - 'name' => __('Footer script code', 'geodirectory'),
|
|
| 1026 | - 'desc' => '', |
|
| 1027 | - 'id' => 'geodir_footer_scripts', |
|
| 1028 | - 'type' => 'textarea', |
|
| 1029 | - 'css' => 'min-width:300px;', |
|
| 1030 | - 'std' => '' // Default value for the page title - changed in settings |
|
| 1031 | - ), |
|
| 1024 | + array( |
|
| 1025 | + 'name' => __('Footer script code', 'geodirectory'),
|
|
| 1026 | + 'desc' => '', |
|
| 1027 | + 'id' => 'geodir_footer_scripts', |
|
| 1028 | + 'type' => 'textarea', |
|
| 1029 | + 'css' => 'min-width:300px;', |
|
| 1030 | + 'std' => '' // Default value for the page title - changed in settings |
|
| 1031 | + ), |
|
| 1032 | 1032 | |
| 1033 | - array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
|
|
| 1034 | - /* Script Settings End */ |
|
| 1033 | + array('type' => 'sectionend', 'id' => 'geodir_script_settings'),
|
|
| 1034 | + /* Script Settings End */ |
|
| 1035 | 1035 | |
| 1036 | - /* Map Settings Start */ |
|
| 1037 | - array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
|
|
| 1036 | + /* Map Settings Start */ |
|
| 1037 | + array('name' => __('Map', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'geodir_map_settings '),
|
|
| 1038 | 1038 | |
| 1039 | 1039 | |
| 1040 | - // Google API key |
|
| 1041 | - array( |
|
| 1042 | - 'name' => __('Google Maps API KEY', 'geodirectory'),
|
|
| 1043 | - 'type' => 'sectionstart', |
|
| 1044 | - 'desc' => '', |
|
| 1045 | - 'id' => 'geodir_google_api_key' |
|
| 1046 | - ), |
|
| 1047 | - array( |
|
| 1048 | - 'name' => __('Google Maps API KEY', 'geodirectory'),
|
|
| 1049 | - 'desc' => sprintf( |
|
| 1050 | - __('This is a requirement to use Google Maps, you can get a key from <a href="%s" target="_blank">here</a> OR you can set GD to use Open Street Maps below under Select Maps API setting. (<a href="%s" target="_blank">How to add a Google API KEY?</a>)', 'geodirectory'),
|
|
| 1051 | - 'https://console.developers.google.com/flows/enableapi?apiid=static_maps_backend,street_view_image_backend,maps_embed_backend,places_backend,geocoding_backend,directions_backend,distance_matrix_backend,geolocation,elevation_backend,timezone_backend,maps_backend&keyType=CLIENT_SIDE&reusekey=true','https://wpgeodirectory.com/docs/add-google-api-key/' ), |
|
| 1052 | - 'tip' => '', |
|
| 1053 | - 'id' => 'geodir_google_api_key', |
|
| 1054 | - 'css' => 'min-width:300px;', |
|
| 1055 | - 'std' => '', |
|
| 1056 | - 'type' => 'map-key', |
|
| 1057 | - ), |
|
| 1058 | - array( |
|
| 1059 | - 'type' => 'sectionend', |
|
| 1060 | - 'id' => 'geodir_google_api_key' |
|
| 1061 | - ), |
|
| 1040 | + // Google API key |
|
| 1041 | + array( |
|
| 1042 | + 'name' => __('Google Maps API KEY', 'geodirectory'),
|
|
| 1043 | + 'type' => 'sectionstart', |
|
| 1044 | + 'desc' => '', |
|
| 1045 | + 'id' => 'geodir_google_api_key' |
|
| 1046 | + ), |
|
| 1047 | + array( |
|
| 1048 | + 'name' => __('Google Maps API KEY', 'geodirectory'),
|
|
| 1049 | + 'desc' => sprintf( |
|
| 1050 | + __('This is a requirement to use Google Maps, you can get a key from <a href="%s" target="_blank">here</a> OR you can set GD to use Open Street Maps below under Select Maps API setting. (<a href="%s" target="_blank">How to add a Google API KEY?</a>)', 'geodirectory'),
|
|
| 1051 | + 'https://console.developers.google.com/flows/enableapi?apiid=static_maps_backend,street_view_image_backend,maps_embed_backend,places_backend,geocoding_backend,directions_backend,distance_matrix_backend,geolocation,elevation_backend,timezone_backend,maps_backend&keyType=CLIENT_SIDE&reusekey=true','https://wpgeodirectory.com/docs/add-google-api-key/' ), |
|
| 1052 | + 'tip' => '', |
|
| 1053 | + 'id' => 'geodir_google_api_key', |
|
| 1054 | + 'css' => 'min-width:300px;', |
|
| 1055 | + 'std' => '', |
|
| 1056 | + 'type' => 'map-key', |
|
| 1057 | + ), |
|
| 1058 | + array( |
|
| 1059 | + 'type' => 'sectionend', |
|
| 1060 | + 'id' => 'geodir_google_api_key' |
|
| 1061 | + ), |
|
| 1062 | 1062 | |
| 1063 | - /* Untick the category by default on home map */ |
|
| 1064 | - array( |
|
| 1065 | - 'name' => __('Home Map Settings', 'geodirectory'),
|
|
| 1066 | - 'type' => 'sectionstart', |
|
| 1067 | - 'desc' => '', |
|
| 1068 | - 'id' => 'geodir_home_map_section' |
|
| 1069 | - ), |
|
| 1070 | - array( |
|
| 1071 | - 'name' => __('Select category to untick by default on map', 'geodirectory'),
|
|
| 1072 | - 'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
|
|
| 1073 | - 'tip' => '', |
|
| 1074 | - 'id' => 'geodir_home_map_untick', |
|
| 1075 | - 'css' => 'min-width:300px;', |
|
| 1076 | - 'std' => '', |
|
| 1077 | - 'type' => 'multiselect', |
|
| 1078 | - 'placeholder_text' => __('Select category', 'geodirectory'),
|
|
| 1079 | - 'class' => 'chosen_select', |
|
| 1080 | - 'options' => geodir_home_map_cats_key_value_array() |
|
| 1081 | - ), |
|
| 1082 | - array( |
|
| 1083 | - 'type' => 'sectionend', |
|
| 1084 | - 'id' => 'geodir_home_map_section' |
|
| 1085 | - ), |
|
| 1063 | + /* Untick the category by default on home map */ |
|
| 1064 | + array( |
|
| 1065 | + 'name' => __('Home Map Settings', 'geodirectory'),
|
|
| 1066 | + 'type' => 'sectionstart', |
|
| 1067 | + 'desc' => '', |
|
| 1068 | + 'id' => 'geodir_home_map_section' |
|
| 1069 | + ), |
|
| 1070 | + array( |
|
| 1071 | + 'name' => __('Select category to untick by default on map', 'geodirectory'),
|
|
| 1072 | + 'desc' => __('Select category to untick by default on the home map.', 'geodirectory'),
|
|
| 1073 | + 'tip' => '', |
|
| 1074 | + 'id' => 'geodir_home_map_untick', |
|
| 1075 | + 'css' => 'min-width:300px;', |
|
| 1076 | + 'std' => '', |
|
| 1077 | + 'type' => 'multiselect', |
|
| 1078 | + 'placeholder_text' => __('Select category', 'geodirectory'),
|
|
| 1079 | + 'class' => 'chosen_select', |
|
| 1080 | + 'options' => geodir_home_map_cats_key_value_array() |
|
| 1081 | + ), |
|
| 1082 | + array( |
|
| 1083 | + 'type' => 'sectionend', |
|
| 1084 | + 'id' => 'geodir_home_map_section' |
|
| 1085 | + ), |
|
| 1086 | 1086 | |
| 1087 | - array( |
|
| 1088 | - 'name' => __('Add Listing Map Settings', 'geodirectory'),
|
|
| 1089 | - 'type' => 'sectionstart', |
|
| 1090 | - 'desc' => '', |
|
| 1091 | - 'id' => 'geodir_add_listing_map_section' |
|
| 1092 | - ), |
|
| 1093 | - array( |
|
| 1094 | - 'name' => __('Disable mouse scroll on details page map tab', 'geodirectory'),
|
|
| 1095 | - 'desc' => __('Stops the mouse scroll zooming the map (home and listings settings set from widget)', 'geodirectory'),
|
|
| 1096 | - 'id' => 'geodir_add_listing_mouse_scroll', |
|
| 1097 | - 'type' => 'checkbox', |
|
| 1098 | - 'std' => '0' // Default value to show home top section |
|
| 1099 | - ), |
|
| 1100 | - array( |
|
| 1101 | - 'type' => 'sectionend', |
|
| 1102 | - 'id' => 'geodir_add_listing_map_section' |
|
| 1103 | - ), |
|
| 1087 | + array( |
|
| 1088 | + 'name' => __('Add Listing Map Settings', 'geodirectory'),
|
|
| 1089 | + 'type' => 'sectionstart', |
|
| 1090 | + 'desc' => '', |
|
| 1091 | + 'id' => 'geodir_add_listing_map_section' |
|
| 1092 | + ), |
|
| 1093 | + array( |
|
| 1094 | + 'name' => __('Disable mouse scroll on details page map tab', 'geodirectory'),
|
|
| 1095 | + 'desc' => __('Stops the mouse scroll zooming the map (home and listings settings set from widget)', 'geodirectory'),
|
|
| 1096 | + 'id' => 'geodir_add_listing_mouse_scroll', |
|
| 1097 | + 'type' => 'checkbox', |
|
| 1098 | + 'std' => '0' // Default value to show home top section |
|
| 1099 | + ), |
|
| 1100 | + array( |
|
| 1101 | + 'type' => 'sectionend', |
|
| 1102 | + 'id' => 'geodir_add_listing_map_section' |
|
| 1103 | + ), |
|
| 1104 | 1104 | |
| 1105 | 1105 | |
| 1106 | - array('name' => __('Default map settings', 'geodirectory'),
|
|
| 1107 | - 'type' => 'sectionstart', |
|
| 1108 | - 'desc' => '', |
|
| 1109 | - 'id' => 'geodir_map_default_settings'), |
|
| 1106 | + array('name' => __('Default map settings', 'geodirectory'),
|
|
| 1107 | + 'type' => 'sectionstart', |
|
| 1108 | + 'desc' => '', |
|
| 1109 | + 'id' => 'geodir_map_default_settings'), |
|
| 1110 | 1110 | |
| 1111 | - array( |
|
| 1112 | - 'name' => '', |
|
| 1113 | - 'desc' => '', |
|
| 1114 | - 'id' => 'map_default_settings', |
|
| 1115 | - 'type' => 'map_default_settings', |
|
| 1116 | - 'css' => 'min-width:300px;', |
|
| 1117 | - 'std' => '' // Default value for the page title - changed in settings |
|
| 1118 | - ), |
|
| 1111 | + array( |
|
| 1112 | + 'name' => '', |
|
| 1113 | + 'desc' => '', |
|
| 1114 | + 'id' => 'map_default_settings', |
|
| 1115 | + 'type' => 'map_default_settings', |
|
| 1116 | + 'css' => 'min-width:300px;', |
|
| 1117 | + 'std' => '' // Default value for the page title - changed in settings |
|
| 1118 | + ), |
|
| 1119 | 1119 | |
| 1120 | - array( |
|
| 1121 | - 'name' => __('Upload map default marker icon', 'geodirectory'),
|
|
| 1122 | - 'desc' => '', |
|
| 1123 | - 'id' => 'geodir_default_marker_icon', |
|
| 1124 | - 'type' => 'file', |
|
| 1125 | - 'std' => '0', |
|
| 1126 | - 'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section |
|
| 1127 | - ), |
|
| 1128 | - // add option that allows enable/disable map dragging to phone devices |
|
| 1129 | - array( |
|
| 1130 | - 'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
|
|
| 1131 | - 'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
|
|
| 1132 | - 'id' => 'geodir_map_onoff_dragging', |
|
| 1133 | - 'type' => 'checkbox', |
|
| 1134 | - 'std' => '0' // Default value to show home top section |
|
| 1135 | - ), |
|
| 1136 | - array( |
|
| 1137 | - 'name' => __('Select Maps API', 'geodirectory'),
|
|
| 1138 | - 'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
|
|
| 1139 | - 'tip' => '', |
|
| 1140 | - 'id' => 'geodir_load_map', |
|
| 1141 | - 'css' => 'min-width:300px;', |
|
| 1142 | - 'std' => 'auto', |
|
| 1143 | - 'type' => 'select', |
|
| 1144 | - 'placeholder_text' => __('Select Map', 'geodirectory'),
|
|
| 1145 | - 'options' => array( |
|
| 1146 | - 'auto' => __('Load Automatic', 'geodirectory'),
|
|
| 1147 | - 'google' => __('Load Google Maps API', 'geodirectory'),
|
|
| 1148 | - 'osm' => __('Load OpenStreetMap API', 'geodirectory'),
|
|
| 1149 | - 'none' => __('Disable Maps', 'geodirectory')
|
|
| 1150 | - ) |
|
| 1151 | - ), |
|
| 1152 | - |
|
| 1153 | - array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
|
|
| 1154 | - |
|
| 1155 | - array('name' => __('Show / hide post type and category on map', 'geodirectory'),
|
|
| 1156 | - 'type' => 'sectionstart', |
|
| 1157 | - 'desc' => '', |
|
| 1158 | - 'id' => 'geodir_map_settings'), |
|
| 1120 | + array( |
|
| 1121 | + 'name' => __('Upload map default marker icon', 'geodirectory'),
|
|
| 1122 | + 'desc' => '', |
|
| 1123 | + 'id' => 'geodir_default_marker_icon', |
|
| 1124 | + 'type' => 'file', |
|
| 1125 | + 'std' => '0', |
|
| 1126 | + 'value' => geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'// Default value to show home top section |
|
| 1127 | + ), |
|
| 1128 | + // add option that allows enable/disable map dragging to phone devices |
|
| 1129 | + array( |
|
| 1130 | + 'name' => __('Show button control on map to enable/disable dragging', 'geodirectory'),
|
|
| 1131 | + 'desc' => __('If checked, it displays button control to enable/disable dragging on google maps for phone devices', 'geodirectory'),
|
|
| 1132 | + 'id' => 'geodir_map_onoff_dragging', |
|
| 1133 | + 'type' => 'checkbox', |
|
| 1134 | + 'std' => '0' // Default value to show home top section |
|
| 1135 | + ), |
|
| 1136 | + array( |
|
| 1137 | + 'name' => __('Select Maps API', 'geodirectory'),
|
|
| 1138 | + 'desc' => __('- Google Maps API will force to load Google JS library only.<br>- OpenStreetMap API will force to load OpenStreetMap JS library only.<br>- Load Automatic will load Google JS library first, but if Google maps JS library not loaded it then loads the OpenStreetMap JS library to load the maps (recommended for regions where Google maps banned).<br>- Disable Maps will disable and hides maps for entire site.', 'geodirectory'),
|
|
| 1139 | + 'tip' => '', |
|
| 1140 | + 'id' => 'geodir_load_map', |
|
| 1141 | + 'css' => 'min-width:300px;', |
|
| 1142 | + 'std' => 'auto', |
|
| 1143 | + 'type' => 'select', |
|
| 1144 | + 'placeholder_text' => __('Select Map', 'geodirectory'),
|
|
| 1145 | + 'options' => array( |
|
| 1146 | + 'auto' => __('Load Automatic', 'geodirectory'),
|
|
| 1147 | + 'google' => __('Load Google Maps API', 'geodirectory'),
|
|
| 1148 | + 'osm' => __('Load OpenStreetMap API', 'geodirectory'),
|
|
| 1149 | + 'none' => __('Disable Maps', 'geodirectory')
|
|
| 1150 | + ) |
|
| 1151 | + ), |
|
| 1159 | 1152 | |
| 1160 | - array( |
|
| 1161 | - 'name' => __('Select Map Category', 'geodirectory'),
|
|
| 1162 | - 'desc' => '', |
|
| 1163 | - 'id' => 'geodir_map_settings', |
|
| 1164 | - 'type' => 'map', |
|
| 1165 | - 'css' => 'min-width:300px;', |
|
| 1166 | - 'std' => '' // Default value for the page title - changed in settings |
|
| 1167 | - ), |
|
| 1153 | + array('type' => 'sectionend', 'id' => 'geodir_map_default_settings'),
|
|
| 1154 | + |
|
| 1155 | + array('name' => __('Show / hide post type and category on map', 'geodirectory'),
|
|
| 1156 | + 'type' => 'sectionstart', |
|
| 1157 | + 'desc' => '', |
|
| 1158 | + 'id' => 'geodir_map_settings'), |
|
| 1159 | + |
|
| 1160 | + array( |
|
| 1161 | + 'name' => __('Select Map Category', 'geodirectory'),
|
|
| 1162 | + 'desc' => '', |
|
| 1163 | + 'id' => 'geodir_map_settings', |
|
| 1164 | + 'type' => 'map', |
|
| 1165 | + 'css' => 'min-width:300px;', |
|
| 1166 | + 'std' => '' // Default value for the page title - changed in settings |
|
| 1167 | + ), |
|
| 1168 | 1168 | |
| 1169 | - array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
|
|
| 1169 | + array('type' => 'sectionend', 'id' => 'geodir_map_settings'),
|
|
| 1170 | 1170 | |
| 1171 | 1171 | |
| 1172 | 1172 | |
@@ -1187,6 +1187,6 @@ discard block |
||
| 1187 | 1187 | 'type' => 'sectionend', |
| 1188 | 1188 | 'id' => 'geodir_map_cache_section' |
| 1189 | 1189 | ), |
| 1190 | - /* Map Settings End */ |
|
| 1190 | + /* Map Settings End */ |
|
| 1191 | 1191 | |
| 1192 | 1192 | )); // End Design settings |