@@ -10,52 +10,52 @@ discard block  | 
                                                    ||
| 10 | 10 | global $wpdb, $table_prefix;  | 
                                                        
| 11 | 11 | |
| 12 | 12 |  if (!function_exists('geodir_column_exist')) {
 | 
                                                        
| 13 | - /**  | 
                                                        |
| 14 | - * Check table column exist or not.  | 
                                                        |
| 15 | - *  | 
                                                        |
| 16 | - * @since 1.0.0  | 
                                                        |
| 17 | - * @package GeoDirectory  | 
                                                        |
| 18 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 19 | - * @param string $db The table name.  | 
                                                        |
| 20 | - * @param string $column The column name.  | 
                                                        |
| 21 | - * @return bool If column exists returns true. Otherwise false.  | 
                                                        |
| 22 | - */  | 
                                                        |
| 23 | - function geodir_column_exist($db, $column)  | 
                                                        |
| 24 | -    {
 | 
                                                        |
| 25 | - global $wpdb;  | 
                                                        |
| 26 | - $exists = false;  | 
                                                        |
| 27 | -        $columns = $wpdb->get_col("show columns from $db");
 | 
                                                        |
| 28 | -        foreach ($columns as $c) {
 | 
                                                        |
| 29 | -            if ($c == $column) {
 | 
                                                        |
| 30 | - $exists = true;  | 
                                                        |
| 31 | - break;  | 
                                                        |
| 32 | - }  | 
                                                        |
| 33 | - }  | 
                                                        |
| 34 | - return $exists;  | 
                                                        |
| 35 | - }  | 
                                                        |
| 13 | + /**  | 
                                                        |
| 14 | + * Check table column exist or not.  | 
                                                        |
| 15 | + *  | 
                                                        |
| 16 | + * @since 1.0.0  | 
                                                        |
| 17 | + * @package GeoDirectory  | 
                                                        |
| 18 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 19 | + * @param string $db The table name.  | 
                                                        |
| 20 | + * @param string $column The column name.  | 
                                                        |
| 21 | + * @return bool If column exists returns true. Otherwise false.  | 
                                                        |
| 22 | + */  | 
                                                        |
| 23 | + function geodir_column_exist($db, $column)  | 
                                                        |
| 24 | +	{
 | 
                                                        |
| 25 | + global $wpdb;  | 
                                                        |
| 26 | + $exists = false;  | 
                                                        |
| 27 | +		$columns = $wpdb->get_col("show columns from $db");
 | 
                                                        |
| 28 | +		foreach ($columns as $c) {
 | 
                                                        |
| 29 | +			if ($c == $column) {
 | 
                                                        |
| 30 | + $exists = true;  | 
                                                        |
| 31 | + break;  | 
                                                        |
| 32 | + }  | 
                                                        |
| 33 | + }  | 
                                                        |
| 34 | + return $exists;  | 
                                                        |
| 35 | + }  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | |
| 38 | 38 |  if (!function_exists('geodir_add_column_if_not_exist')) {
 | 
                                                        
| 39 | - /**  | 
                                                        |
| 40 | - * Add column if table column not exist.  | 
                                                        |
| 41 | - *  | 
                                                        |
| 42 | - * @since 1.0.0  | 
                                                        |
| 43 | - * @package GeoDirectory  | 
                                                        |
| 44 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 45 | - * @param string $db The table name.  | 
                                                        |
| 46 | - * @param string $column The column name.  | 
                                                        |
| 47 | - * @param string $column_attr The column attributes.  | 
                                                        |
| 48 | - */  | 
                                                        |
| 49 | - function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")  | 
                                                        |
| 50 | -    {
 | 
                                                        |
| 51 | - global $wpdb;  | 
                                                        |
| 52 | - $result = 0;// no rows affected  | 
                                                        |
| 53 | -        if (!geodir_column_exist($db, $column)) {
 | 
                                                        |
| 54 | - if (!empty($db) && !empty($column))  | 
                                                        |
| 55 | -                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
 | 
                                                        |
| 56 | - }  | 
                                                        |
| 57 | - return $result;  | 
                                                        |
| 58 | - }  | 
                                                        |
| 39 | + /**  | 
                                                        |
| 40 | + * Add column if table column not exist.  | 
                                                        |
| 41 | + *  | 
                                                        |
| 42 | + * @since 1.0.0  | 
                                                        |
| 43 | + * @package GeoDirectory  | 
                                                        |
| 44 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 45 | + * @param string $db The table name.  | 
                                                        |
| 46 | + * @param string $column The column name.  | 
                                                        |
| 47 | + * @param string $column_attr The column attributes.  | 
                                                        |
| 48 | + */  | 
                                                        |
| 49 | + function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")  | 
                                                        |
| 50 | +	{
 | 
                                                        |
| 51 | + global $wpdb;  | 
                                                        |
| 52 | + $result = 0;// no rows affected  | 
                                                        |
| 53 | +		if (!geodir_column_exist($db, $column)) {
 | 
                                                        |
| 54 | + if (!empty($db) && !empty($column))  | 
                                                        |
| 55 | +				$result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
 | 
                                                        |
| 56 | + }  | 
                                                        |
| 57 | + return $result;  | 
                                                        |
| 58 | + }  | 
                                                        |
| 59 | 59 | }  | 
                                                        
| 60 | 60 | |
| 61 | 61 | /**  | 
                                                        
@@ -72,702 +72,702 @@ discard block  | 
                                                    ||
| 72 | 72 | */  | 
                                                        
| 73 | 73 | function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none')  | 
                                                        
| 74 | 74 |  {
 | 
                                                        
| 75 | - global $wpdb, $geodir_post_custom_fields_cache;  | 
                                                        |
| 76 | -  | 
                                                        |
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;  | 
                                                        |
| 78 | -  | 
                                                        |
| 79 | -    if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
 | 
                                                        |
| 80 | - return $geodir_post_custom_fields_cache[$cache_stored];  | 
                                                        |
| 81 | - }  | 
                                                        |
| 82 | -  | 
                                                        |
| 83 | - $default_query = '';  | 
                                                        |
| 84 | -  | 
                                                        |
| 85 | - if ($default == 'default')  | 
                                                        |
| 86 | -        $default_query = " and is_default IN ('1') ";
 | 
                                                        |
| 87 | - elseif ($default == 'custom')  | 
                                                        |
| 88 | - $default_query = " and is_default = '0' ";  | 
                                                        |
| 89 | -  | 
                                                        |
| 90 | -    if ($fields_location == 'detail') {
 | 
                                                        |
| 91 | - $default_query = " and show_on_detail='1' ";  | 
                                                        |
| 92 | -    } elseif ($fields_location == 'listing') {
 | 
                                                        |
| 93 | - $default_query = " and show_on_listing='1' ";  | 
                                                        |
| 94 | - }  | 
                                                        |
| 95 | -  | 
                                                        |
| 96 | - $post_meta_info = $wpdb->get_results(  | 
                                                        |
| 97 | - $wpdb->prepare(  | 
                                                        |
| 98 | -            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
 | 
                                                        |
| 99 | - array($post_type)  | 
                                                        |
| 100 | - )  | 
                                                        |
| 101 | - );  | 
                                                        |
| 102 | -  | 
                                                        |
| 103 | -  | 
                                                        |
| 104 | - $return_arr = array();  | 
                                                        |
| 105 | -    if ($post_meta_info) {
 | 
                                                        |
| 106 | -  | 
                                                        |
| 107 | -        foreach ($post_meta_info as $post_meta_info_obj) {
 | 
                                                        |
| 108 | -  | 
                                                        |
| 109 | - $custom_fields = array(  | 
                                                        |
| 110 | - "name" => $post_meta_info_obj->htmlvar_name,  | 
                                                        |
| 111 | - "label" => $post_meta_info_obj->clabels,  | 
                                                        |
| 112 | - "default" => $post_meta_info_obj->default_value,  | 
                                                        |
| 113 | - "type" => $post_meta_info_obj->field_type,  | 
                                                        |
| 114 | - "desc" => $post_meta_info_obj->admin_desc);  | 
                                                        |
| 115 | -  | 
                                                        |
| 116 | -            if ($post_meta_info_obj->field_type) {
 | 
                                                        |
| 117 | -                $options = explode(',', $post_meta_info_obj->option_values);
 | 
                                                        |
| 118 | - $custom_fields["options"] = $options;  | 
                                                        |
| 119 | - }  | 
                                                        |
| 120 | -  | 
                                                        |
| 121 | -            foreach ($post_meta_info_obj as $key => $val) {
 | 
                                                        |
| 122 | - $custom_fields[$key] = $val;  | 
                                                        |
| 123 | - }  | 
                                                        |
| 124 | -  | 
                                                        |
| 125 | - $pricearr = array();  | 
                                                        |
| 126 | -            $pricearr = explode(',', $post_meta_info_obj->packages);
 | 
                                                        |
| 127 | -  | 
                                                        |
| 128 | -            if ($package_id != '' && in_array($package_id, $pricearr)) {
 | 
                                                        |
| 129 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;  | 
                                                        |
| 130 | -            } elseif ($package_id == '') {
 | 
                                                        |
| 131 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;  | 
                                                        |
| 132 | - }  | 
                                                        |
| 133 | - }  | 
                                                        |
| 134 | - }  | 
                                                        |
| 135 | - $geodir_post_custom_fields_cache[$cache_stored] = $return_arr;  | 
                                                        |
| 136 | -  | 
                                                        |
| 137 | -    if (has_filter('geodir_filter_geodir_post_custom_fields')) {
 | 
                                                        |
| 138 | - /**  | 
                                                        |
| 139 | - * Filter the post custom fields array.  | 
                                                        |
| 140 | - *  | 
                                                        |
| 141 | - * @since 1.0.0  | 
                                                        |
| 142 | - *  | 
                                                        |
| 143 | - * @param array $return_arr Post custom fields array.  | 
                                                        |
| 144 | - * @param int|string $package_id The package ID.  | 
                                                        |
| 145 | - * @param string $post_type Optional. The wordpress post type.  | 
                                                        |
| 146 | - * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.  | 
                                                        |
| 147 | - */  | 
                                                        |
| 148 | -        $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
 | 
                                                        |
| 149 | - }  | 
                                                        |
| 150 | -  | 
                                                        |
| 151 | - return $return_arr;  | 
                                                        |
| 75 | + global $wpdb, $geodir_post_custom_fields_cache;  | 
                                                        |
| 76 | +  | 
                                                        |
| 77 | + $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;  | 
                                                        |
| 78 | +  | 
                                                        |
| 79 | +	if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
 | 
                                                        |
| 80 | + return $geodir_post_custom_fields_cache[$cache_stored];  | 
                                                        |
| 81 | + }  | 
                                                        |
| 82 | +  | 
                                                        |
| 83 | + $default_query = '';  | 
                                                        |
| 84 | +  | 
                                                        |
| 85 | + if ($default == 'default')  | 
                                                        |
| 86 | +		$default_query = " and is_default IN ('1') ";
 | 
                                                        |
| 87 | + elseif ($default == 'custom')  | 
                                                        |
| 88 | + $default_query = " and is_default = '0' ";  | 
                                                        |
| 89 | +  | 
                                                        |
| 90 | +	if ($fields_location == 'detail') {
 | 
                                                        |
| 91 | + $default_query = " and show_on_detail='1' ";  | 
                                                        |
| 92 | +	} elseif ($fields_location == 'listing') {
 | 
                                                        |
| 93 | + $default_query = " and show_on_listing='1' ";  | 
                                                        |
| 94 | + }  | 
                                                        |
| 95 | +  | 
                                                        |
| 96 | + $post_meta_info = $wpdb->get_results(  | 
                                                        |
| 97 | + $wpdb->prepare(  | 
                                                        |
| 98 | +			"select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
 | 
                                                        |
| 99 | + array($post_type)  | 
                                                        |
| 100 | + )  | 
                                                        |
| 101 | + );  | 
                                                        |
| 102 | +  | 
                                                        |
| 103 | +  | 
                                                        |
| 104 | + $return_arr = array();  | 
                                                        |
| 105 | +	if ($post_meta_info) {
 | 
                                                        |
| 106 | +  | 
                                                        |
| 107 | +		foreach ($post_meta_info as $post_meta_info_obj) {
 | 
                                                        |
| 108 | +  | 
                                                        |
| 109 | + $custom_fields = array(  | 
                                                        |
| 110 | + "name" => $post_meta_info_obj->htmlvar_name,  | 
                                                        |
| 111 | + "label" => $post_meta_info_obj->clabels,  | 
                                                        |
| 112 | + "default" => $post_meta_info_obj->default_value,  | 
                                                        |
| 113 | + "type" => $post_meta_info_obj->field_type,  | 
                                                        |
| 114 | + "desc" => $post_meta_info_obj->admin_desc);  | 
                                                        |
| 115 | +  | 
                                                        |
| 116 | +			if ($post_meta_info_obj->field_type) {
 | 
                                                        |
| 117 | +				$options = explode(',', $post_meta_info_obj->option_values);
 | 
                                                        |
| 118 | + $custom_fields["options"] = $options;  | 
                                                        |
| 119 | + }  | 
                                                        |
| 120 | +  | 
                                                        |
| 121 | +			foreach ($post_meta_info_obj as $key => $val) {
 | 
                                                        |
| 122 | + $custom_fields[$key] = $val;  | 
                                                        |
| 123 | + }  | 
                                                        |
| 124 | +  | 
                                                        |
| 125 | + $pricearr = array();  | 
                                                        |
| 126 | +			$pricearr = explode(',', $post_meta_info_obj->packages);
 | 
                                                        |
| 127 | +  | 
                                                        |
| 128 | +			if ($package_id != '' && in_array($package_id, $pricearr)) {
 | 
                                                        |
| 129 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;  | 
                                                        |
| 130 | +			} elseif ($package_id == '') {
 | 
                                                        |
| 131 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields;  | 
                                                        |
| 132 | + }  | 
                                                        |
| 133 | + }  | 
                                                        |
| 134 | + }  | 
                                                        |
| 135 | + $geodir_post_custom_fields_cache[$cache_stored] = $return_arr;  | 
                                                        |
| 136 | +  | 
                                                        |
| 137 | +	if (has_filter('geodir_filter_geodir_post_custom_fields')) {
 | 
                                                        |
| 138 | + /**  | 
                                                        |
| 139 | + * Filter the post custom fields array.  | 
                                                        |
| 140 | + *  | 
                                                        |
| 141 | + * @since 1.0.0  | 
                                                        |
| 142 | + *  | 
                                                        |
| 143 | + * @param array $return_arr Post custom fields array.  | 
                                                        |
| 144 | + * @param int|string $package_id The package ID.  | 
                                                        |
| 145 | + * @param string $post_type Optional. The wordpress post type.  | 
                                                        |
| 146 | + * @param string $fields_location Optional. Where exactly are you going to place this custom fields?.  | 
                                                        |
| 147 | + */  | 
                                                        |
| 148 | +		$return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
 | 
                                                        |
| 149 | + }  | 
                                                        |
| 150 | +  | 
                                                        |
| 151 | + return $return_arr;  | 
                                                        |
| 152 | 152 | }  | 
                                                        
| 153 | 153 | |
| 154 | 154 |  if (!function_exists('geodir_custom_field_adminhtml')) {
 | 
                                                        
| 155 | - /**  | 
                                                        |
| 156 | - * Adds admin html for custom fields.  | 
                                                        |
| 157 | - *  | 
                                                        |
| 158 | - * @since 1.0.0  | 
                                                        |
| 159 | - * @package GeoDirectory  | 
                                                        |
| 160 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 161 | - * @param string $field_type The form field type.  | 
                                                        |
| 162 | - * @param object|int $result_str The custom field results object or row id.  | 
                                                        |
| 163 | - * @param string $field_ins_upd When set to "submit" displays form.  | 
                                                        |
| 164 | - * @param bool $default when set to true field will be for admin use only.  | 
                                                        |
| 165 | - */  | 
                                                        |
| 166 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)  | 
                                                        |
| 167 | -    {
 | 
                                                        |
| 168 | - global $wpdb;  | 
                                                        |
| 169 | - $cf = $result_str;  | 
                                                        |
| 170 | -        if (!is_object($cf)) {
 | 
                                                        |
| 171 | -  | 
                                                        |
| 172 | -            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
 | 
                                                        |
| 173 | -  | 
                                                        |
| 174 | -        } else {
 | 
                                                        |
| 175 | - $field_info = $cf;  | 
                                                        |
| 176 | - $result_str = $cf->id;  | 
                                                        |
| 177 | - }  | 
                                                        |
| 178 | - /**  | 
                                                        |
| 179 | - * Contains custom field html.  | 
                                                        |
| 180 | - *  | 
                                                        |
| 181 | - * @since 1.0.0  | 
                                                        |
| 182 | - */  | 
                                                        |
| 183 | -        include('custom_field_html.php');
 | 
                                                        |
| 184 | -  | 
                                                        |
| 185 | - }  | 
                                                        |
| 155 | + /**  | 
                                                        |
| 156 | + * Adds admin html for custom fields.  | 
                                                        |
| 157 | + *  | 
                                                        |
| 158 | + * @since 1.0.0  | 
                                                        |
| 159 | + * @package GeoDirectory  | 
                                                        |
| 160 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 161 | + * @param string $field_type The form field type.  | 
                                                        |
| 162 | + * @param object|int $result_str The custom field results object or row id.  | 
                                                        |
| 163 | + * @param string $field_ins_upd When set to "submit" displays form.  | 
                                                        |
| 164 | + * @param bool $default when set to true field will be for admin use only.  | 
                                                        |
| 165 | + */  | 
                                                        |
| 166 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)  | 
                                                        |
| 167 | +	{
 | 
                                                        |
| 168 | + global $wpdb;  | 
                                                        |
| 169 | + $cf = $result_str;  | 
                                                        |
| 170 | +		if (!is_object($cf)) {
 | 
                                                        |
| 171 | +  | 
                                                        |
| 172 | +			$field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
 | 
                                                        |
| 173 | +  | 
                                                        |
| 174 | +		} else {
 | 
                                                        |
| 175 | + $field_info = $cf;  | 
                                                        |
| 176 | + $result_str = $cf->id;  | 
                                                        |
| 177 | + }  | 
                                                        |
| 178 | + /**  | 
                                                        |
| 179 | + * Contains custom field html.  | 
                                                        |
| 180 | + *  | 
                                                        |
| 181 | + * @since 1.0.0  | 
                                                        |
| 182 | + */  | 
                                                        |
| 183 | +		include('custom_field_html.php');
 | 
                                                        |
| 184 | +  | 
                                                        |
| 185 | + }  | 
                                                        |
| 186 | 186 | }  | 
                                                        
| 187 | 187 | |
| 188 | 188 |  if (!function_exists('geodir_custom_field_delete')) {
 | 
                                                        
| 189 | - /**  | 
                                                        |
| 190 | - * Delete custom field using field id.  | 
                                                        |
| 191 | - *  | 
                                                        |
| 192 | - * @since 1.0.0  | 
                                                        |
| 193 | - * @since 1.5.7 Delete field from sorting fields table when custom field deleted.  | 
                                                        |
| 194 | - * @package GeoDirectory  | 
                                                        |
| 195 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 196 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 197 | - * @param string $field_id The custom field ID.  | 
                                                        |
| 198 | - * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.  | 
                                                        |
| 199 | - */  | 
                                                        |
| 200 | -    function geodir_custom_field_delete($field_id = '') {
 | 
                                                        |
| 201 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 202 | -  | 
                                                        |
| 203 | -        if ($field_id != '') {
 | 
                                                        |
| 204 | - $cf = trim($field_id, '_');  | 
                                                        |
| 205 | -  | 
                                                        |
| 206 | -            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
 | 
                                                        |
| 207 | -                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
 | 
                                                        |
| 208 | -  | 
                                                        |
| 209 | - $post_type = $field->post_type;  | 
                                                        |
| 210 | - $htmlvar_name = $field->htmlvar_name;  | 
                                                        |
| 211 | -  | 
                                                        |
| 212 | -                if ($post_type != '' && $htmlvar_name != '') {
 | 
                                                        |
| 213 | -                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
 | 
                                                        |
| 214 | - }  | 
                                                        |
| 215 | -  | 
                                                        |
| 216 | - /**  | 
                                                        |
| 217 | - * Called after a custom field is deleted.  | 
                                                        |
| 218 | - *  | 
                                                        |
| 219 | - * @since 1.0.0  | 
                                                        |
| 220 | - * @param string $cf The fields ID.  | 
                                                        |
| 221 | - * @param string $field->htmlvar_name The html variable name for the field.  | 
                                                        |
| 222 | - * @param string $post_type The post type the field belongs to.  | 
                                                        |
| 223 | - */  | 
                                                        |
| 224 | -                do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
 | 
                                                        |
| 225 | -  | 
                                                        |
| 226 | -                if ($field->field_type == 'address') {
 | 
                                                        |
| 227 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
 | 
                                                        |
| 228 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
 | 
                                                        |
| 229 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
 | 
                                                        |
| 230 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
 | 
                                                        |
| 231 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
 | 
                                                        |
| 232 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
 | 
                                                        |
| 233 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
 | 
                                                        |
| 234 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
 | 
                                                        |
| 235 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
 | 
                                                        |
| 236 | -                } else {
 | 
                                                        |
| 237 | -                    if ($field->field_type != 'fieldset') {
 | 
                                                        |
| 238 | -                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
 | 
                                                        |
| 239 | - }  | 
                                                        |
| 240 | - }  | 
                                                        |
| 241 | -  | 
                                                        |
| 242 | - return $field_id;  | 
                                                        |
| 243 | - } else  | 
                                                        |
| 244 | - return 0;  | 
                                                        |
| 245 | - } else  | 
                                                        |
| 246 | - return 0;  | 
                                                        |
| 247 | - }  | 
                                                        |
| 189 | + /**  | 
                                                        |
| 190 | + * Delete custom field using field id.  | 
                                                        |
| 191 | + *  | 
                                                        |
| 192 | + * @since 1.0.0  | 
                                                        |
| 193 | + * @since 1.5.7 Delete field from sorting fields table when custom field deleted.  | 
                                                        |
| 194 | + * @package GeoDirectory  | 
                                                        |
| 195 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 196 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 197 | + * @param string $field_id The custom field ID.  | 
                                                        |
| 198 | + * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.  | 
                                                        |
| 199 | + */  | 
                                                        |
| 200 | +	function geodir_custom_field_delete($field_id = '') {
 | 
                                                        |
| 201 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 202 | +  | 
                                                        |
| 203 | +		if ($field_id != '') {
 | 
                                                        |
| 204 | + $cf = trim($field_id, '_');  | 
                                                        |
| 205 | +  | 
                                                        |
| 206 | +			if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
 | 
                                                        |
| 207 | +				$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
 | 
                                                        |
| 208 | +  | 
                                                        |
| 209 | + $post_type = $field->post_type;  | 
                                                        |
| 210 | + $htmlvar_name = $field->htmlvar_name;  | 
                                                        |
| 211 | +  | 
                                                        |
| 212 | +				if ($post_type != '' && $htmlvar_name != '') {
 | 
                                                        |
| 213 | +					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
 | 
                                                        |
| 214 | + }  | 
                                                        |
| 215 | +  | 
                                                        |
| 216 | + /**  | 
                                                        |
| 217 | + * Called after a custom field is deleted.  | 
                                                        |
| 218 | + *  | 
                                                        |
| 219 | + * @since 1.0.0  | 
                                                        |
| 220 | + * @param string $cf The fields ID.  | 
                                                        |
| 221 | + * @param string $field->htmlvar_name The html variable name for the field.  | 
                                                        |
| 222 | + * @param string $post_type The post type the field belongs to.  | 
                                                        |
| 223 | + */  | 
                                                        |
| 224 | +				do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
 | 
                                                        |
| 225 | +  | 
                                                        |
| 226 | +				if ($field->field_type == 'address') {
 | 
                                                        |
| 227 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
 | 
                                                        |
| 228 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
 | 
                                                        |
| 229 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
 | 
                                                        |
| 230 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
 | 
                                                        |
| 231 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
 | 
                                                        |
| 232 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
 | 
                                                        |
| 233 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
 | 
                                                        |
| 234 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
 | 
                                                        |
| 235 | +					$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
 | 
                                                        |
| 236 | +				} else {
 | 
                                                        |
| 237 | +					if ($field->field_type != 'fieldset') {
 | 
                                                        |
| 238 | +						$wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
 | 
                                                        |
| 239 | + }  | 
                                                        |
| 240 | + }  | 
                                                        |
| 241 | +  | 
                                                        |
| 242 | + return $field_id;  | 
                                                        |
| 243 | + } else  | 
                                                        |
| 244 | + return 0;  | 
                                                        |
| 245 | + } else  | 
                                                        |
| 246 | + return 0;  | 
                                                        |
| 247 | + }  | 
                                                        |
| 248 | 248 | }  | 
                                                        
| 249 | 249 | |
| 250 | 250 |  if (!function_exists('geodir_custom_field_save')) {
 | 
                                                        
| 251 | - /**  | 
                                                        |
| 252 | - * Save or Update custom fields into the database.  | 
                                                        |
| 253 | - *  | 
                                                        |
| 254 | - * @since 1.0.0  | 
                                                        |
| 255 | - * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.  | 
                                                        |
| 256 | - * @package GeoDirectory  | 
                                                        |
| 257 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 258 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 259 | -     * @param array $request_field {
 | 
                                                        |
| 260 | - * Attributes of the request field array.  | 
                                                        |
| 261 | - *  | 
                                                        |
| 262 | - * @type string $action Ajax Action name. Default "geodir_ajax_action".  | 
                                                        |
| 263 | - * @type string $manage_field_type Field type Default "custom_fields".  | 
                                                        |
| 264 | - * @type string $create_field Create field Default "true".  | 
                                                        |
| 265 | - * @type string $field_ins_upd Field ins upd Default "submit".  | 
                                                        |
| 266 | - * @type string $_wpnonce WP nonce value.  | 
                                                        |
| 267 | - * @type string $listing_type Listing type Example "gd_place".  | 
                                                        |
| 268 | - * @type string $field_type Field type Example "radio".  | 
                                                        |
| 269 | - * @type string $field_id Field id Example "12".  | 
                                                        |
| 270 | - * @type string $data_type Data type Example "VARCHAR".  | 
                                                        |
| 271 | - * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.  | 
                                                        |
| 272 | - * @type array $show_on_pkg Package list to display this field.  | 
                                                        |
| 273 | - * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.  | 
                                                        |
| 274 | - * @type string $site_title Section title which you wish to display in frontend.  | 
                                                        |
| 275 | - * @type string $admin_desc Section description which will appear in frontend.  | 
                                                        |
| 276 | - * @type string $htmlvar_name Html variable name. This should be a unique name.  | 
                                                        |
| 277 | - * @type string $clabels Section Title which will appear in backend.  | 
                                                        |
| 278 | - * @type string $default_value The default value (for "link" this will be used as the link text).  | 
                                                        |
| 279 | - * @type string $sort_order The display order of this field in backend. e.g. 5.  | 
                                                        |
| 280 | - * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.  | 
                                                        |
| 281 | - * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.  | 
                                                        |
| 282 | - * @type string $is_required Use "1" to set field as required.  | 
                                                        |
| 283 | - * @type string $required_msg Enter text for error message if field required and have not full fill requirment.  | 
                                                        |
| 284 | - * @type string $show_on_listing Want to show this on listing page?.  | 
                                                        |
| 285 | - * @type string $show_on_detail Want to show this in More Info tab on detail page?.  | 
                                                        |
| 286 | - * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.  | 
                                                        |
| 287 | - * @type string $option_values Option Values should be separated by comma.  | 
                                                        |
| 288 | - * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.  | 
                                                        |
| 289 | - * @type string $css_class Enter custom css class for field custom style.  | 
                                                        |
| 290 | - *  | 
                                                        |
| 291 | - * }  | 
                                                        |
| 292 | - * @param bool $default Not yet implemented.  | 
                                                        |
| 293 | - * @return int|string If field is unique returns inserted row id. Otherwise returns error string.  | 
                                                        |
| 294 | - */  | 
                                                        |
| 295 | - function geodir_custom_field_save($request_field = array(), $default = false)  | 
                                                        |
| 296 | -    {
 | 
                                                        |
| 297 | -  | 
                                                        |
| 298 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 299 | -  | 
                                                        |
| 300 | - $old_html_variable = '';  | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | - $data_type = trim($request_field['data_type']);  | 
                                                        |
| 303 | -  | 
                                                        |
| 304 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';  | 
                                                        |
| 305 | -  | 
                                                        |
| 306 | - // some servers fail if a POST value is VARCHAR so we change it.  | 
                                                        |
| 307 | -        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
 | 
                                                        |
| 308 | - $request_field['data_type'] = 'VARCHAR';  | 
                                                        |
| 309 | - }  | 
                                                        |
| 310 | -  | 
                                                        |
| 311 | - $cf = trim($result_str, '_');  | 
                                                        |
| 312 | -  | 
                                                        |
| 313 | -  | 
                                                        |
| 314 | - /*-------- check dublicate validation --------*/  | 
                                                        |
| 315 | -  | 
                                                        |
| 316 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';  | 
                                                        |
| 317 | - $post_type = $request_field['listing_type'];  | 
                                                        |
| 318 | -  | 
                                                        |
| 319 | -        if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
 | 
                                                        |
| 320 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;  | 
                                                        |
| 321 | - }  | 
                                                        |
| 322 | -  | 
                                                        |
| 323 | - $check_html_variable = $wpdb->get_var(  | 
                                                        |
| 324 | - $wpdb->prepare(  | 
                                                        |
| 325 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",  | 
                                                        |
| 326 | - array($cf, $cehhtmlvar_name, $post_type)  | 
                                                        |
| 327 | - )  | 
                                                        |
| 328 | - );  | 
                                                        |
| 329 | -  | 
                                                        |
| 330 | -  | 
                                                        |
| 331 | -        if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
 | 
                                                        |
| 332 | -  | 
                                                        |
| 333 | -            if ($cf != '') {
 | 
                                                        |
| 334 | -  | 
                                                        |
| 335 | - $post_meta_info = $wpdb->get_row(  | 
                                                        |
| 336 | - $wpdb->prepare(  | 
                                                        |
| 337 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",  | 
                                                        |
| 338 | - array($cf)  | 
                                                        |
| 339 | - )  | 
                                                        |
| 340 | - );  | 
                                                        |
| 341 | -  | 
                                                        |
| 342 | - }  | 
                                                        |
| 343 | -  | 
                                                        |
| 344 | -            if (!empty($post_meta_info)) {
 | 
                                                        |
| 345 | - $post_val = $post_meta_info;  | 
                                                        |
| 346 | - $old_html_variable = $post_val->htmlvar_name;  | 
                                                        |
| 347 | -  | 
                                                        |
| 348 | - }  | 
                                                        |
| 349 | -  | 
                                                        |
| 350 | -  | 
                                                        |
| 351 | -  | 
                                                        |
| 352 | - if ($post_type == '') $post_type = 'gd_place';  | 
                                                        |
| 251 | + /**  | 
                                                        |
| 252 | + * Save or Update custom fields into the database.  | 
                                                        |
| 253 | + *  | 
                                                        |
| 254 | + * @since 1.0.0  | 
                                                        |
| 255 | + * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.  | 
                                                        |
| 256 | + * @package GeoDirectory  | 
                                                        |
| 257 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 258 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 259 | +	 * @param array $request_field {
 | 
                                                        |
| 260 | + * Attributes of the request field array.  | 
                                                        |
| 261 | + *  | 
                                                        |
| 262 | + * @type string $action Ajax Action name. Default "geodir_ajax_action".  | 
                                                        |
| 263 | + * @type string $manage_field_type Field type Default "custom_fields".  | 
                                                        |
| 264 | + * @type string $create_field Create field Default "true".  | 
                                                        |
| 265 | + * @type string $field_ins_upd Field ins upd Default "submit".  | 
                                                        |
| 266 | + * @type string $_wpnonce WP nonce value.  | 
                                                        |
| 267 | + * @type string $listing_type Listing type Example "gd_place".  | 
                                                        |
| 268 | + * @type string $field_type Field type Example "radio".  | 
                                                        |
| 269 | + * @type string $field_id Field id Example "12".  | 
                                                        |
| 270 | + * @type string $data_type Data type Example "VARCHAR".  | 
                                                        |
| 271 | + * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere.  | 
                                                        |
| 272 | + * @type array $show_on_pkg Package list to display this field.  | 
                                                        |
| 273 | + * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings.  | 
                                                        |
| 274 | + * @type string $site_title Section title which you wish to display in frontend.  | 
                                                        |
| 275 | + * @type string $admin_desc Section description which will appear in frontend.  | 
                                                        |
| 276 | + * @type string $htmlvar_name Html variable name. This should be a unique name.  | 
                                                        |
| 277 | + * @type string $clabels Section Title which will appear in backend.  | 
                                                        |
| 278 | + * @type string $default_value The default value (for "link" this will be used as the link text).  | 
                                                        |
| 279 | + * @type string $sort_order The display order of this field in backend. e.g. 5.  | 
                                                        |
| 280 | + * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field.  | 
                                                        |
| 281 | + * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field.  | 
                                                        |
| 282 | + * @type string $is_required Use "1" to set field as required.  | 
                                                        |
| 283 | + * @type string $required_msg Enter text for error message if field required and have not full fill requirment.  | 
                                                        |
| 284 | + * @type string $show_on_listing Want to show this on listing page?.  | 
                                                        |
| 285 | + * @type string $show_on_detail Want to show this in More Info tab on detail page?.  | 
                                                        |
| 286 | + * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes.  | 
                                                        |
| 287 | + * @type string $option_values Option Values should be separated by comma.  | 
                                                        |
| 288 | + * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class.  | 
                                                        |
| 289 | + * @type string $css_class Enter custom css class for field custom style.  | 
                                                        |
| 290 | + *  | 
                                                        |
| 291 | + * }  | 
                                                        |
| 292 | + * @param bool $default Not yet implemented.  | 
                                                        |
| 293 | + * @return int|string If field is unique returns inserted row id. Otherwise returns error string.  | 
                                                        |
| 294 | + */  | 
                                                        |
| 295 | + function geodir_custom_field_save($request_field = array(), $default = false)  | 
                                                        |
| 296 | +	{
 | 
                                                        |
| 297 | +  | 
                                                        |
| 298 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 299 | +  | 
                                                        |
| 300 | + $old_html_variable = '';  | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | + $data_type = trim($request_field['data_type']);  | 
                                                        |
| 303 | +  | 
                                                        |
| 304 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';  | 
                                                        |
| 305 | +  | 
                                                        |
| 306 | + // some servers fail if a POST value is VARCHAR so we change it.  | 
                                                        |
| 307 | +		if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
 | 
                                                        |
| 308 | + $request_field['data_type'] = 'VARCHAR';  | 
                                                        |
| 309 | + }  | 
                                                        |
| 310 | +  | 
                                                        |
| 311 | + $cf = trim($result_str, '_');  | 
                                                        |
| 312 | +  | 
                                                        |
| 313 | +  | 
                                                        |
| 314 | + /*-------- check dublicate validation --------*/  | 
                                                        |
| 315 | +  | 
                                                        |
| 316 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';  | 
                                                        |
| 317 | + $post_type = $request_field['listing_type'];  | 
                                                        |
| 318 | +  | 
                                                        |
| 319 | +		if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
 | 
                                                        |
| 320 | + $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;  | 
                                                        |
| 321 | + }  | 
                                                        |
| 322 | +  | 
                                                        |
| 323 | + $check_html_variable = $wpdb->get_var(  | 
                                                        |
| 324 | + $wpdb->prepare(  | 
                                                        |
| 325 | + "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",  | 
                                                        |
| 326 | + array($cf, $cehhtmlvar_name, $post_type)  | 
                                                        |
| 327 | + )  | 
                                                        |
| 328 | + );  | 
                                                        |
| 329 | +  | 
                                                        |
| 330 | +  | 
                                                        |
| 331 | +		if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
 | 
                                                        |
| 332 | +  | 
                                                        |
| 333 | +			if ($cf != '') {
 | 
                                                        |
| 334 | +  | 
                                                        |
| 335 | + $post_meta_info = $wpdb->get_row(  | 
                                                        |
| 336 | + $wpdb->prepare(  | 
                                                        |
| 337 | + "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",  | 
                                                        |
| 338 | + array($cf)  | 
                                                        |
| 339 | + )  | 
                                                        |
| 340 | + );  | 
                                                        |
| 341 | +  | 
                                                        |
| 342 | + }  | 
                                                        |
| 343 | +  | 
                                                        |
| 344 | +			if (!empty($post_meta_info)) {
 | 
                                                        |
| 345 | + $post_val = $post_meta_info;  | 
                                                        |
| 346 | + $old_html_variable = $post_val->htmlvar_name;  | 
                                                        |
| 347 | +  | 
                                                        |
| 348 | + }  | 
                                                        |
| 349 | +  | 
                                                        |
| 350 | +  | 
                                                        |
| 351 | +  | 
                                                        |
| 352 | + if ($post_type == '') $post_type = 'gd_place';  | 
                                                        |
| 353 | 353 | |
| 354 | 354 | |
| 355 | - $detail_table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 355 | + $detail_table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 356 | 356 | |
| 357 | - $admin_title = $request_field['admin_title'];  | 
                                                        |
| 358 | - $site_title = $request_field['site_title'];  | 
                                                        |
| 359 | - $data_type = $request_field['data_type'];  | 
                                                        |
| 360 | - $field_type = $request_field['field_type'];  | 
                                                        |
| 361 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';  | 
                                                        |
| 362 | - $admin_desc = $request_field['admin_desc'];  | 
                                                        |
| 363 | - $clabels = $request_field['clabels'];  | 
                                                        |
| 364 | - $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';  | 
                                                        |
| 365 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';  | 
                                                        |
| 366 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';  | 
                                                        |
| 367 | - $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';  | 
                                                        |
| 368 | - $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';  | 
                                                        |
| 369 | - $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';  | 
                                                        |
| 370 | - $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';  | 
                                                        |
| 371 | - $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';  | 
                                                        |
| 372 | - $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';  | 
                                                        |
| 373 | - $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';  | 
                                                        |
| 374 | - $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type  | 
                                                        |
| 375 | - $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';  | 
                                                        |
| 376 | - $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';  | 
                                                        |
| 377 | - $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';  | 
                                                        |
| 378 | - $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';  | 
                                                        |
| 357 | + $admin_title = $request_field['admin_title'];  | 
                                                        |
| 358 | + $site_title = $request_field['site_title'];  | 
                                                        |
| 359 | + $data_type = $request_field['data_type'];  | 
                                                        |
| 360 | + $field_type = $request_field['field_type'];  | 
                                                        |
| 361 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';  | 
                                                        |
| 362 | + $admin_desc = $request_field['admin_desc'];  | 
                                                        |
| 363 | + $clabels = $request_field['clabels'];  | 
                                                        |
| 364 | + $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : '';  | 
                                                        |
| 365 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : '';  | 
                                                        |
| 366 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : '';  | 
                                                        |
| 367 | + $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : '';  | 
                                                        |
| 368 | + $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : '';  | 
                                                        |
| 369 | + $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : '';  | 
                                                        |
| 370 | + $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : '';  | 
                                                        |
| 371 | + $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : '';  | 
                                                        |
| 372 | + $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : '';  | 
                                                        |
| 373 | + $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : '';  | 
                                                        |
| 374 | + $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type  | 
                                                        |
| 375 | + $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : '';  | 
                                                        |
| 376 | + $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : '';  | 
                                                        |
| 377 | + $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : '';  | 
                                                        |
| 378 | + $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';  | 
                                                        |
| 379 | 379 | |
| 380 | -            if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
 | 
                                                        |
| 381 | - $htmlvar_name = 'geodir_' . $htmlvar_name;  | 
                                                        |
| 382 | - }  | 
                                                        |
| 380 | +			if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
 | 
                                                        |
| 381 | + $htmlvar_name = 'geodir_' . $htmlvar_name;  | 
                                                        |
| 382 | + }  | 
                                                        |
| 383 | 383 | |
| 384 | - $option_values = '';  | 
                                                        |
| 385 | - if (isset($request_field['option_values']))  | 
                                                        |
| 386 | - $option_values = $request_field['option_values'];  | 
                                                        |
| 384 | + $option_values = '';  | 
                                                        |
| 385 | + if (isset($request_field['option_values']))  | 
                                                        |
| 386 | + $option_values = $request_field['option_values'];  | 
                                                        |
| 387 | 387 | |
| 388 | - $cat_sort = '';  | 
                                                        |
| 389 | - if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort']))  | 
                                                        |
| 390 | -                $cat_sort = implode(",", $request_field['cat_sort']);
 | 
                                                        |
| 388 | + $cat_sort = '';  | 
                                                        |
| 389 | + if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort']))  | 
                                                        |
| 390 | +				$cat_sort = implode(",", $request_field['cat_sort']);
 | 
                                                        |
| 391 | 391 | |
| 392 | - $cat_filter = '';  | 
                                                        |
| 393 | - if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter']))  | 
                                                        |
| 394 | -                $cat_filter = implode(",", $request_field['cat_filter']);
 | 
                                                        |
| 392 | + $cat_filter = '';  | 
                                                        |
| 393 | + if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter']))  | 
                                                        |
| 394 | +				$cat_filter = implode(",", $request_field['cat_filter']);
 | 
                                                        |
| 395 | 395 | |
| 396 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))  | 
                                                        |
| 397 | -                $price_pkg = implode(",", $request_field['show_on_pkg']);
 | 
                                                        |
| 398 | -            else {
 | 
                                                        |
| 399 | - $package_info = array();  | 
                                                        |
| 396 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))  | 
                                                        |
| 397 | +				$price_pkg = implode(",", $request_field['show_on_pkg']);
 | 
                                                        |
| 398 | +			else {
 | 
                                                        |
| 399 | + $package_info = array();  | 
                                                        |
| 400 | 400 | |
| 401 | - $package_info = geodir_post_package_info($package_info, '', $post_type);  | 
                                                        |
| 402 | - $price_pkg = $package_info->pid;  | 
                                                        |
| 403 | - }  | 
                                                        |
| 401 | + $package_info = geodir_post_package_info($package_info, '', $post_type);  | 
                                                        |
| 402 | + $price_pkg = $package_info->pid;  | 
                                                        |
| 403 | + }  | 
                                                        |
| 404 | 404 | |
| 405 | 405 | |
| 406 | - if (isset($request_field['extra']) && !empty($request_field['extra']))  | 
                                                        |
| 407 | - $extra_fields = $request_field['extra'];  | 
                                                        |
| 406 | + if (isset($request_field['extra']) && !empty($request_field['extra']))  | 
                                                        |
| 407 | + $extra_fields = $request_field['extra'];  | 
                                                        |
| 408 | 408 | |
| 409 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '')  | 
                                                        |
| 410 | - $is_default = $request_field['is_default'];  | 
                                                        |
| 411 | - else  | 
                                                        |
| 412 | - $is_default = '0';  | 
                                                        |
| 409 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '')  | 
                                                        |
| 410 | + $is_default = $request_field['is_default'];  | 
                                                        |
| 411 | + else  | 
                                                        |
| 412 | + $is_default = '0';  | 
                                                        |
| 413 | 413 | |
| 414 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')  | 
                                                        |
| 415 | - $is_admin = $request_field['is_admin'];  | 
                                                        |
| 416 | - else  | 
                                                        |
| 417 | - $is_admin = '0';  | 
                                                        |
| 414 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')  | 
                                                        |
| 415 | + $is_admin = $request_field['is_admin'];  | 
                                                        |
| 416 | + else  | 
                                                        |
| 417 | + $is_admin = '0';  | 
                                                        |
| 418 | 418 | |
| 419 | 419 | |
| 420 | - if ($is_active == '') $is_active = 1;  | 
                                                        |
| 421 | - if ($is_required == '') $is_required = 0;  | 
                                                        |
| 420 | + if ($is_active == '') $is_active = 1;  | 
                                                        |
| 421 | + if ($is_required == '') $is_required = 0;  | 
                                                        |
| 422 | 422 | |
| 423 | 423 | |
| 424 | -            if ($sort_order == '') {
 | 
                                                        |
| 424 | +			if ($sort_order == '') {
 | 
                                                        |
| 425 | 425 | |
| 426 | -                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
 | 
                                                        |
| 426 | +				$last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
 | 
                                                        |
| 427 | 427 | |
| 428 | - $sort_order = (int)$last_order + 1;  | 
                                                        |
| 429 | - }  | 
                                                        |
| 428 | + $sort_order = (int)$last_order + 1;  | 
                                                        |
| 429 | + }  | 
                                                        |
| 430 | 430 | |
| 431 | - $default_value_add = '';  | 
                                                        |
| 431 | + $default_value_add = '';  | 
                                                        |
| 432 | 432 | |
| 433 | 433 | |
| 434 | -            if (!empty($post_meta_info)) {
 | 
                                                        |
| 435 | - switch ($field_type):  | 
                                                        |
| 434 | +			if (!empty($post_meta_info)) {
 | 
                                                        |
| 435 | + switch ($field_type):  | 
                                                        |
| 436 | 436 | |
| 437 | - case 'address':  | 
                                                        |
| 437 | + case 'address':  | 
                                                        |
| 438 | 438 | |
| 439 | -                        if ($htmlvar_name != '') {
 | 
                                                        |
| 440 | - $prefix = $htmlvar_name . '_';  | 
                                                        |
| 441 | - }  | 
                                                        |
| 442 | - $old_prefix = $old_html_variable . '_';  | 
                                                        |
| 439 | +						if ($htmlvar_name != '') {
 | 
                                                        |
| 440 | + $prefix = $htmlvar_name . '_';  | 
                                                        |
| 441 | + }  | 
                                                        |
| 442 | + $old_prefix = $old_html_variable . '_';  | 
                                                        |
| 443 | 443 | |
| 444 | 444 | |
| 445 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";  | 
                                                        |
| 445 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";  | 
                                                        |
| 446 | 446 | |
| 447 | -                        if ($default_value != '') {
 | 
                                                        |
| 448 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 449 | - }  | 
                                                        |
| 447 | +						if ($default_value != '') {
 | 
                                                        |
| 448 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 449 | + }  | 
                                                        |
| 450 | 450 | |
| 451 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 451 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 452 | 452 | |
| 453 | -                        if ($extra_fields != '') {
 | 
                                                        |
| 453 | +						if ($extra_fields != '') {
 | 
                                                        |
| 454 | 454 | |
| 455 | -                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
 | 
                                                        |
| 455 | +							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
 | 
                                                        |
| 456 | 456 | |
| 457 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
 | 
                                                        |
| 458 | -                                if ($is_column) {
 | 
                                                        |
| 459 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";  | 
                                                        |
| 457 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
 | 
                                                        |
| 458 | +								if ($is_column) {
 | 
                                                        |
| 459 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";  | 
                                                        |
| 460 | 460 | |
| 461 | -                                    if ($default_value != '') {
 | 
                                                        |
| 462 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 463 | - }  | 
                                                        |
| 461 | +									if ($default_value != '') {
 | 
                                                        |
| 462 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 463 | + }  | 
                                                        |
| 464 | 464 | |
| 465 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 466 | -                                } else {
 | 
                                                        |
| 465 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 466 | +								} else {
 | 
                                                        |
| 467 | 467 | |
| 468 | - $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        |
| 469 | -                                    if ($default_value != '') {
 | 
                                                        |
| 470 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 471 | - }  | 
                                                        |
| 472 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);  | 
                                                        |
| 468 | + $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        |
| 469 | +									if ($default_value != '') {
 | 
                                                        |
| 470 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 471 | + }  | 
                                                        |
| 472 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);  | 
                                                        |
| 473 | 473 | |
| 474 | - }  | 
                                                        |
| 474 | + }  | 
                                                        |
| 475 | 475 | |
| 476 | 476 | |
| 477 | - }  | 
                                                        |
| 477 | + }  | 
                                                        |
| 478 | 478 | |
| 479 | 479 | |
| 480 | -                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
 | 
                                                        |
| 480 | +							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
 | 
                                                        |
| 481 | 481 | |
| 482 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
 | 
                                                        |
| 482 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
 | 
                                                        |
| 483 | 483 | |
| 484 | -                                if ($is_column) {
 | 
                                                        |
| 485 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";  | 
                                                        |
| 484 | +								if ($is_column) {
 | 
                                                        |
| 485 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";  | 
                                                        |
| 486 | 486 | |
| 487 | -                                    if ($default_value != '') {
 | 
                                                        |
| 488 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 489 | - }  | 
                                                        |
| 487 | +									if ($default_value != '') {
 | 
                                                        |
| 488 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 489 | + }  | 
                                                        |
| 490 | 490 | |
| 491 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 492 | -                                } else {
 | 
                                                        |
| 493 | - $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        |
| 494 | -                                    if ($default_value != '') {
 | 
                                                        |
| 495 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 496 | - }  | 
                                                        |
| 491 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 492 | +								} else {
 | 
                                                        |
| 493 | + $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        |
| 494 | +									if ($default_value != '') {
 | 
                                                        |
| 495 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 496 | + }  | 
                                                        |
| 497 | 497 | |
| 498 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);  | 
                                                        |
| 499 | - }  | 
                                                        |
| 498 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);  | 
                                                        |
| 499 | + }  | 
                                                        |
| 500 | 500 | |
| 501 | - }  | 
                                                        |
| 502 | -                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
 | 
                                                        |
| 501 | + }  | 
                                                        |
| 502 | +							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
 | 
                                                        |
| 503 | 503 | |
| 504 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
 | 
                                                        |
| 504 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
 | 
                                                        |
| 505 | 505 | |
| 506 | -                                if ($is_column) {
 | 
                                                        |
| 506 | +								if ($is_column) {
 | 
                                                        |
| 507 | 507 | |
| 508 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";  | 
                                                        |
| 508 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";  | 
                                                        |
| 509 | 509 | |
| 510 | -                                    if ($default_value != '') {
 | 
                                                        |
| 511 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 512 | - }  | 
                                                        |
| 510 | +									if ($default_value != '') {
 | 
                                                        |
| 511 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 512 | + }  | 
                                                        |
| 513 | 513 | |
| 514 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 515 | -                                } else {
 | 
                                                        |
| 514 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 515 | +								} else {
 | 
                                                        |
| 516 | 516 | |
| 517 | - $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        |
| 518 | -                                    if ($default_value != '') {
 | 
                                                        |
| 519 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 520 | - }  | 
                                                        |
| 517 | + $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        |
| 518 | +									if ($default_value != '') {
 | 
                                                        |
| 519 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 520 | + }  | 
                                                        |
| 521 | 521 | |
| 522 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);  | 
                                                        |
| 522 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);  | 
                                                        |
| 523 | 523 | |
| 524 | - }  | 
                                                        |
| 524 | + }  | 
                                                        |
| 525 | 525 | |
| 526 | - }  | 
                                                        |
| 527 | -                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        |
| 526 | + }  | 
                                                        |
| 527 | +							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        |
| 528 | 528 | |
| 529 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
 | 
                                                        |
| 529 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
 | 
                                                        |
| 530 | 530 | |
| 531 | -                                if ($is_column) {
 | 
                                                        |
| 531 | +								if ($is_column) {
 | 
                                                        |
| 532 | 532 | |
| 533 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";  | 
                                                        |
| 533 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";  | 
                                                        |
| 534 | 534 | |
| 535 | -                                    if ($default_value != '') {
 | 
                                                        |
| 536 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 537 | - }  | 
                                                        |
| 535 | +									if ($default_value != '') {
 | 
                                                        |
| 536 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 537 | + }  | 
                                                        |
| 538 | 538 | |
| 539 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 540 | -                                } else {
 | 
                                                        |
| 539 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 540 | +								} else {
 | 
                                                        |
| 541 | 541 | |
| 542 | - $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        |
| 543 | -                                    if ($default_value != '') {
 | 
                                                        |
| 544 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 545 | - }  | 
                                                        |
| 542 | + $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        |
| 543 | +									if ($default_value != '') {
 | 
                                                        |
| 544 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 545 | + }  | 
                                                        |
| 546 | 546 | |
| 547 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);  | 
                                                        |
| 547 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);  | 
                                                        |
| 548 | 548 | |
| 549 | - }  | 
                                                        |
| 549 | + }  | 
                                                        |
| 550 | 550 | |
| 551 | - }  | 
                                                        |
| 552 | -                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
 | 
                                                        |
| 551 | + }  | 
                                                        |
| 552 | +							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
 | 
                                                        |
| 553 | 553 | |
| 554 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
 | 
                                                        |
| 555 | -                                if ($is_column) {
 | 
                                                        |
| 554 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
 | 
                                                        |
| 555 | +								if ($is_column) {
 | 
                                                        |
| 556 | 556 | |
| 557 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 557 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 558 | 558 | |
| 559 | -                                    if ($default_value != '') {
 | 
                                                        |
| 560 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 561 | - }  | 
                                                        |
| 559 | +									if ($default_value != '') {
 | 
                                                        |
| 560 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 561 | + }  | 
                                                        |
| 562 | 562 | |
| 563 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 564 | -                                } else {
 | 
                                                        |
| 563 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 564 | +								} else {
 | 
                                                        |
| 565 | 565 | |
| 566 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 567 | - $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        |
| 568 | -                                    if ($default_value != '') {
 | 
                                                        |
| 569 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 570 | - }  | 
                                                        |
| 566 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 567 | + $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        |
| 568 | +									if ($default_value != '') {
 | 
                                                        |
| 569 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 570 | + }  | 
                                                        |
| 571 | 571 | |
| 572 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);  | 
                                                        |
| 572 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);  | 
                                                        |
| 573 | 573 | |
| 574 | - }  | 
                                                        |
| 574 | + }  | 
                                                        |
| 575 | 575 | |
| 576 | 576 | |
| 577 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
 | 
                                                        |
| 577 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
 | 
                                                        |
| 578 | 578 | |
| 579 | -                                if ($is_column) {
 | 
                                                        |
| 580 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 579 | +								if ($is_column) {
 | 
                                                        |
| 580 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 581 | 581 | |
| 582 | -                                    if ($default_value != '') {
 | 
                                                        |
| 583 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 584 | - }  | 
                                                        |
| 582 | +									if ($default_value != '') {
 | 
                                                        |
| 583 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 584 | + }  | 
                                                        |
| 585 | 585 | |
| 586 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 587 | -                                } else {
 | 
                                                        |
| 586 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 587 | +								} else {
 | 
                                                        |
| 588 | 588 | |
| 589 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 590 | - $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        |
| 591 | -                                    if ($default_value != '') {
 | 
                                                        |
| 592 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 593 | - }  | 
                                                        |
| 589 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 590 | + $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        |
| 591 | +									if ($default_value != '') {
 | 
                                                        |
| 592 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 593 | + }  | 
                                                        |
| 594 | +  | 
                                                        |
| 595 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);  | 
                                                        |
| 596 | + }  | 
                                                        |
| 597 | +  | 
                                                        |
| 598 | + }  | 
                                                        |
| 599 | +							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
 | 
                                                        |
| 594 | 600 | |
| 595 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);  | 
                                                        |
| 596 | - }  | 
                                                        |
| 601 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
 | 
                                                        |
| 597 | 602 | |
| 598 | - }  | 
                                                        |
| 599 | -                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
 | 
                                                        |
| 603 | +								if ($is_column) {
 | 
                                                        |
| 604 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 600 | 605 | |
| 601 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
 | 
                                                        |
| 606 | +									if ($default_value != '') {
 | 
                                                        |
| 607 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 608 | + }  | 
                                                        |
| 602 | 609 | |
| 603 | -                                if ($is_column) {
 | 
                                                        |
| 604 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 610 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 611 | +								} else {
 | 
                                                        |
| 605 | 612 | |
| 606 | -                                    if ($default_value != '') {
 | 
                                                        |
| 607 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 608 | - }  | 
                                                        |
| 613 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 609 | 614 | |
| 610 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 611 | -                                } else {
 | 
                                                        |
| 615 | + $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        |
| 616 | +									if ($default_value != '') {
 | 
                                                        |
| 617 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 618 | + }  | 
                                                        |
| 612 | 619 | |
| 613 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 620 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);  | 
                                                        |
| 621 | + }  | 
                                                        |
| 614 | 622 | |
| 615 | - $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        |
| 616 | -                                    if ($default_value != '') {
 | 
                                                        |
| 617 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 618 | - }  | 
                                                        |
| 619 | 623 | |
| 620 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);  | 
                                                        |
| 621 | - }  | 
                                                        |
| 624 | + }  | 
                                                        |
| 625 | +							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
 | 
                                                        |
| 622 | 626 | |
| 627 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
 | 
                                                        |
| 628 | +								if ($is_column) {
 | 
                                                        |
| 629 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 623 | 630 | |
| 624 | - }  | 
                                                        |
| 625 | -                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
 | 
                                                        |
| 631 | +									if ($default_value != '') {
 | 
                                                        |
| 632 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 633 | + }  | 
                                                        |
| 634 | +  | 
                                                        |
| 635 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 636 | +  | 
                                                        |
| 637 | +								} else {
 | 
                                                        |
| 638 | +  | 
                                                        |
| 639 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 640 | +  | 
                                                        |
| 641 | + $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        |
| 642 | +									if ($default_value != '') {
 | 
                                                        |
| 643 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 644 | + }  | 
                                                        |
| 645 | +  | 
                                                        |
| 646 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);  | 
                                                        |
| 647 | + }  | 
                                                        |
| 648 | +  | 
                                                        |
| 649 | + }  | 
                                                        |
| 650 | + // show lat lng  | 
                                                        |
| 651 | +							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
 | 
                                                        |
| 652 | +								$is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
 | 
                                                        |
| 626 | 653 | |
| 627 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
 | 
                                                        |
| 628 | -                                if ($is_column) {
 | 
                                                        |
| 629 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 654 | +								if ($is_column) {
 | 
                                                        |
| 655 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 656 | + $meta_field_add .= " DEFAULT '1'";  | 
                                                        |
| 630 | 657 | |
| 631 | -                                    if ($default_value != '') {
 | 
                                                        |
| 632 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 633 | - }  | 
                                                        |
| 658 | + $wpdb->query($meta_field_add);  | 
                                                        |
| 659 | +								} else {
 | 
                                                        |
| 660 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 634 | 661 | |
| 635 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 662 | + $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        |
| 663 | + $meta_field_add .= " DEFAULT '1'";  | 
                                                        |
| 636 | 664 | |
| 637 | -                                } else {
 | 
                                                        |
| 665 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);  | 
                                                        |
| 666 | + }  | 
                                                        |
| 638 | 667 | |
| 639 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 668 | + }  | 
                                                        |
| 669 | + }// end extra  | 
                                                        |
| 640 | 670 | |
| 641 | - $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        |
| 642 | -                                    if ($default_value != '') {
 | 
                                                        |
| 643 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 644 | - }  | 
                                                        |
| 671 | + break;  | 
                                                        |
| 645 | 672 | |
| 646 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);  | 
                                                        |
| 647 | - }  | 
                                                        |
| 673 | + case 'checkbox':  | 
                                                        |
| 674 | + case 'multiselect':  | 
                                                        |
| 675 | + case 'select':  | 
                                                        |
| 676 | + case 'taxonomy':  | 
                                                        |
| 648 | 677 | |
| 649 | - }  | 
                                                        |
| 650 | - // show lat lng  | 
                                                        |
| 651 | -                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
 | 
                                                        |
| 652 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
 | 
                                                        |
| 678 | + $op_size = '500';  | 
                                                        |
| 653 | 679 | |
| 654 | -                                if ($is_column) {
 | 
                                                        |
| 655 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 656 | - $meta_field_add .= " DEFAULT '1'";  | 
                                                        |
| 680 | + // only make the field as big as it needs to be.  | 
                                                        |
| 681 | +						if(isset($option_values) && $option_values && $field_type=='select'){
 | 
                                                        |
| 682 | +							$option_values_arr = explode(',',$option_values);
 | 
                                                        |
| 683 | +							if(is_array($option_values_arr)){
 | 
                                                        |
| 684 | + $op_max = 0;  | 
                                                        |
| 685 | +								foreach($option_values_arr as $op_val){
 | 
                                                        |
| 686 | +									if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
 | 
                                                        |
| 687 | + }  | 
                                                        |
| 688 | +								if($op_max){$op_size =$op_max; }
 | 
                                                        |
| 689 | + }  | 
                                                        |
| 690 | +						}elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
 | 
                                                        |
| 691 | +							if(strlen($option_values)){
 | 
                                                        |
| 692 | + $op_size = strlen($option_values);  | 
                                                        |
| 693 | + }  | 
                                                        |
| 694 | + }  | 
                                                        |
| 657 | 695 | |
| 658 | - $wpdb->query($meta_field_add);  | 
                                                        |
| 659 | -                                } else {
 | 
                                                        |
| 660 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 696 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";  | 
                                                        |
| 661 | 697 | |
| 662 | - $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        |
| 663 | - $meta_field_add .= " DEFAULT '1'";  | 
                                                        |
| 698 | +						if ($default_value != '') {
 | 
                                                        |
| 699 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 700 | + }  | 
                                                        |
| 664 | 701 | |
| 665 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);  | 
                                                        |
| 666 | - }  | 
                                                        |
| 702 | + $alter_result = $wpdb->query($meta_field_add);  | 
                                                        |
| 703 | +						if($alter_result===false){
 | 
                                                        |
| 704 | +							return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 705 | + }  | 
                                                        |
| 667 | 706 | |
| 668 | - }  | 
                                                        |
| 669 | - }// end extra  | 
                                                        |
| 707 | + if (isset($request_field['cat_display_type']))  | 
                                                        |
| 708 | + $extra_fields = $request_field['cat_display_type'];  | 
                                                        |
| 670 | 709 | |
| 671 | - break;  | 
                                                        |
| 710 | + if (isset($request_field['multi_display_type']))  | 
                                                        |
| 711 | + $extra_fields = $request_field['multi_display_type'];  | 
                                                        |
| 672 | 712 | |
| 673 | - case 'checkbox':  | 
                                                        |
| 674 | - case 'multiselect':  | 
                                                        |
| 675 | - case 'select':  | 
                                                        |
| 676 | - case 'taxonomy':  | 
                                                        |
| 677 | 713 | |
| 678 | - $op_size = '500';  | 
                                                        |
| 714 | + break;  | 
                                                        |
| 679 | 715 | |
| 680 | - // only make the field as big as it needs to be.  | 
                                                        |
| 681 | -                        if(isset($option_values) && $option_values && $field_type=='select'){
 | 
                                                        |
| 682 | -                            $option_values_arr = explode(',',$option_values);
 | 
                                                        |
| 683 | -                            if(is_array($option_values_arr)){
 | 
                                                        |
| 684 | - $op_max = 0;  | 
                                                        |
| 685 | -                                foreach($option_values_arr as $op_val){
 | 
                                                        |
| 686 | -                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
 | 
                                                        |
| 687 | - }  | 
                                                        |
| 688 | -                                if($op_max){$op_size =$op_max; }
 | 
                                                        |
| 689 | - }  | 
                                                        |
| 690 | -                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
 | 
                                                        |
| 691 | -                            if(strlen($option_values)){
 | 
                                                        |
| 692 | - $op_size = strlen($option_values);  | 
                                                        |
| 693 | - }  | 
                                                        |
| 694 | - }  | 
                                                        |
| 716 | + case 'textarea':  | 
                                                        |
| 717 | + case 'html':  | 
                                                        |
| 718 | + case 'url':  | 
                                                        |
| 719 | + case 'file':  | 
                                                        |
| 695 | 720 | |
| 696 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";  | 
                                                        |
| 721 | +						$alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
 | 
                                                        |
| 722 | +						if($alter_result===false){
 | 
                                                        |
| 723 | +							return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 724 | + }  | 
                                                        |
| 725 | + if (isset($request_field['advanced_editor']))  | 
                                                        |
| 726 | + $extra_fields = $request_field['advanced_editor'];  | 
                                                        |
| 697 | 727 | |
| 698 | -                        if ($default_value != '') {
 | 
                                                        |
| 699 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 700 | - }  | 
                                                        |
| 728 | + break;  | 
                                                        |
| 701 | 729 | |
| 702 | - $alter_result = $wpdb->query($meta_field_add);  | 
                                                        |
| 703 | -                        if($alter_result===false){
 | 
                                                        |
| 704 | -                            return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 705 | - }  | 
                                                        |
| 730 | + case 'fieldset':  | 
                                                        |
| 731 | + // Nothig happend for fieldset  | 
                                                        |
| 732 | + break;  | 
                                                        |
| 706 | 733 | |
| 707 | - if (isset($request_field['cat_display_type']))  | 
                                                        |
| 708 | - $extra_fields = $request_field['cat_display_type'];  | 
                                                        |
| 734 | + default:  | 
                                                        |
| 735 | +						if ($data_type != 'VARCHAR' && $data_type != '') {
 | 
                                                        |
| 736 | +							if ($data_type == 'FLOAT' && $decimal_point > 0) {
 | 
                                                        |
| 737 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";  | 
                                                        |
| 738 | +							} else {
 | 
                                                        |
| 739 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";  | 
                                                        |
| 740 | + }  | 
                                                        |
| 709 | 741 | |
| 710 | - if (isset($request_field['multi_display_type']))  | 
                                                        |
| 711 | - $extra_fields = $request_field['multi_display_type'];  | 
                                                        |
| 742 | +							if (is_numeric($default_value) && $default_value != '') {
 | 
                                                        |
| 743 | + $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 744 | + }  | 
                                                        |
| 745 | +						} else {
 | 
                                                        |
| 746 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";  | 
                                                        |
| 747 | +							if ($default_value != '') {
 | 
                                                        |
| 748 | + $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 749 | + }  | 
                                                        |
| 750 | + }  | 
                                                        |
| 712 | 751 | |
| 752 | + $alter_result = $wpdb->query($default_value_add);  | 
                                                        |
| 753 | +						if($alter_result===false){
 | 
                                                        |
| 754 | +							return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 755 | + }  | 
                                                        |
| 756 | + break;  | 
                                                        |
| 757 | + endswitch;  | 
                                                        |
| 713 | 758 | |
| 714 | - break;  | 
                                                        |
| 759 | + $extra_field_query = '';  | 
                                                        |
| 760 | +				if (!empty($extra_fields)) {
 | 
                                                        |
| 761 | + $extra_field_query = serialize($extra_fields);  | 
                                                        |
| 762 | + }  | 
                                                        |
| 715 | 763 | |
| 716 | - case 'textarea':  | 
                                                        |
| 717 | - case 'html':  | 
                                                        |
| 718 | - case 'url':  | 
                                                        |
| 719 | - case 'file':  | 
                                                        |
| 764 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';  | 
                                                        |
| 720 | 765 | |
| 721 | -                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
 | 
                                                        |
| 722 | -                        if($alter_result===false){
 | 
                                                        |
| 723 | -                            return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 724 | - }  | 
                                                        |
| 725 | - if (isset($request_field['advanced_editor']))  | 
                                                        |
| 726 | - $extra_fields = $request_field['advanced_editor'];  | 
                                                        |
| 727 | -  | 
                                                        |
| 728 | - break;  | 
                                                        |
| 766 | + $wpdb->query(  | 
                                                        |
| 729 | 767 | |
| 730 | - case 'fieldset':  | 
                                                        |
| 731 | - // Nothig happend for fieldset  | 
                                                        |
| 732 | - break;  | 
                                                        |
| 768 | + $wpdb->prepare(  | 
                                                        |
| 733 | 769 | |
| 734 | - default:  | 
                                                        |
| 735 | -                        if ($data_type != 'VARCHAR' && $data_type != '') {
 | 
                                                        |
| 736 | -                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
 | 
                                                        |
| 737 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";  | 
                                                        |
| 738 | -                            } else {
 | 
                                                        |
| 739 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";  | 
                                                        |
| 740 | - }  | 
                                                        |
| 741 | -  | 
                                                        |
| 742 | -                            if (is_numeric($default_value) && $default_value != '') {
 | 
                                                        |
| 743 | - $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 744 | - }  | 
                                                        |
| 745 | -                        } else {
 | 
                                                        |
| 746 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";  | 
                                                        |
| 747 | -                            if ($default_value != '') {
 | 
                                                        |
| 748 | - $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 749 | - }  | 
                                                        |
| 750 | - }  | 
                                                        |
| 751 | -  | 
                                                        |
| 752 | - $alter_result = $wpdb->query($default_value_add);  | 
                                                        |
| 753 | -                        if($alter_result===false){
 | 
                                                        |
| 754 | -                            return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 755 | - }  | 
                                                        |
| 756 | - break;  | 
                                                        |
| 757 | - endswitch;  | 
                                                        |
| 758 | -  | 
                                                        |
| 759 | - $extra_field_query = '';  | 
                                                        |
| 760 | -                if (!empty($extra_fields)) {
 | 
                                                        |
| 761 | - $extra_field_query = serialize($extra_fields);  | 
                                                        |
| 762 | - }  | 
                                                        |
| 763 | -  | 
                                                        |
| 764 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';  | 
                                                        |
| 765 | -  | 
                                                        |
| 766 | - $wpdb->query(  | 
                                                        |
| 767 | -  | 
                                                        |
| 768 | - $wpdb->prepare(  | 
                                                        |
| 769 | -  | 
                                                        |
| 770 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 770 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 771 | 771 | post_type = %s,  | 
                                                        
| 772 | 772 | admin_title = %s,  | 
                                                        
| 773 | 773 | site_title = %s,  | 
                                                        
@@ -799,308 +799,308 @@ discard block  | 
                                                    ||
| 799 | 799 | for_admin_use = %s  | 
                                                        
| 800 | 800 | where id = %d",  | 
                                                        
| 801 | 801 | |
| 802 | - array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)  | 
                                                        |
| 803 | - )  | 
                                                        |
| 802 | + array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)  | 
                                                        |
| 803 | + )  | 
                                                        |
| 804 | 804 | |
| 805 | - );  | 
                                                        |
| 805 | + );  | 
                                                        |
| 806 | 806 | |
| 807 | - $lastid = trim($cf);  | 
                                                        |
| 807 | + $lastid = trim($cf);  | 
                                                        |
| 808 | 808 | |
| 809 | 809 | |
| 810 | - $wpdb->query(  | 
                                                        |
| 811 | - $wpdb->prepare(  | 
                                                        |
| 812 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 810 | + $wpdb->query(  | 
                                                        |
| 811 | + $wpdb->prepare(  | 
                                                        |
| 812 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 813 | 813 | site_title=%s  | 
                                                        
| 814 | 814 | where post_type = %s and htmlvar_name = %s",  | 
                                                        
| 815 | - array($site_title, $post_type, $htmlvar_name)  | 
                                                        |
| 816 | - )  | 
                                                        |
| 817 | - );  | 
                                                        |
| 818 | -  | 
                                                        |
| 819 | -  | 
                                                        |
| 820 | - if ($cat_sort == '')  | 
                                                        |
| 821 | -                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
 | 
                                                        |
| 822 | -  | 
                                                        |
| 823 | -  | 
                                                        |
| 824 | - /**  | 
                                                        |
| 825 | - * Called after all custom fields are saved for a post.  | 
                                                        |
| 826 | - *  | 
                                                        |
| 827 | - * @since 1.0.0  | 
                                                        |
| 828 | - * @param int $lastid The post ID.  | 
                                                        |
| 829 | - */  | 
                                                        |
| 830 | -                do_action('geodir_after_custom_fields_updated', $lastid);
 | 
                                                        |
| 831 | -  | 
                                                        |
| 832 | -            } else {
 | 
                                                        |
| 833 | -  | 
                                                        |
| 834 | - switch ($field_type):  | 
                                                        |
| 835 | -  | 
                                                        |
| 836 | - case 'address':  | 
                                                        |
| 837 | -  | 
                                                        |
| 838 | - $data_type = '';  | 
                                                        |
| 839 | -  | 
                                                        |
| 840 | -                        if ($htmlvar_name != '') {
 | 
                                                        |
| 841 | - $prefix = $htmlvar_name . '_';  | 
                                                        |
| 842 | - }  | 
                                                        |
| 843 | - $old_prefix = $old_html_variable;  | 
                                                        |
| 844 | -  | 
                                                        |
| 845 | - //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";  | 
                                                        |
| 846 | -  | 
                                                        |
| 847 | - $meta_field_add = "VARCHAR( 254 ) NULL";  | 
                                                        |
| 848 | -                        if ($default_value != '') {
 | 
                                                        |
| 849 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 850 | - }  | 
                                                        |
| 851 | -  | 
                                                        |
| 852 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);  | 
                                                        |
| 853 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 854 | -  | 
                                                        |
| 855 | -  | 
                                                        |
| 856 | -                        if (!empty($extra_fields)) {
 | 
                                                        |
| 815 | + array($site_title, $post_type, $htmlvar_name)  | 
                                                        |
| 816 | + )  | 
                                                        |
| 817 | + );  | 
                                                        |
| 818 | +  | 
                                                        |
| 819 | +  | 
                                                        |
| 820 | + if ($cat_sort == '')  | 
                                                        |
| 821 | +					$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
 | 
                                                        |
| 822 | +  | 
                                                        |
| 823 | +  | 
                                                        |
| 824 | + /**  | 
                                                        |
| 825 | + * Called after all custom fields are saved for a post.  | 
                                                        |
| 826 | + *  | 
                                                        |
| 827 | + * @since 1.0.0  | 
                                                        |
| 828 | + * @param int $lastid The post ID.  | 
                                                        |
| 829 | + */  | 
                                                        |
| 830 | +				do_action('geodir_after_custom_fields_updated', $lastid);
 | 
                                                        |
| 831 | +  | 
                                                        |
| 832 | +			} else {
 | 
                                                        |
| 833 | +  | 
                                                        |
| 834 | + switch ($field_type):  | 
                                                        |
| 835 | +  | 
                                                        |
| 836 | + case 'address':  | 
                                                        |
| 837 | +  | 
                                                        |
| 838 | + $data_type = '';  | 
                                                        |
| 839 | +  | 
                                                        |
| 840 | +						if ($htmlvar_name != '') {
 | 
                                                        |
| 841 | + $prefix = $htmlvar_name . '_';  | 
                                                        |
| 842 | + }  | 
                                                        |
| 843 | + $old_prefix = $old_html_variable;  | 
                                                        |
| 844 | +  | 
                                                        |
| 845 | + //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL";  | 
                                                        |
| 846 | +  | 
                                                        |
| 847 | + $meta_field_add = "VARCHAR( 254 ) NULL";  | 
                                                        |
| 848 | +						if ($default_value != '') {
 | 
                                                        |
| 849 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 850 | + }  | 
                                                        |
| 851 | +  | 
                                                        |
| 852 | + geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);  | 
                                                        |
| 853 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 854 | +  | 
                                                        |
| 855 | +  | 
                                                        |
| 856 | +						if (!empty($extra_fields)) {
 | 
                                                        |
| 857 | +  | 
                                                        |
| 858 | +							if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
 | 
                                                        |
| 859 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";  | 
                                                        |
| 860 | + $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        |
| 861 | +								if ($default_value != '') {
 | 
                                                        |
| 862 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 863 | + }  | 
                                                        |
| 864 | +  | 
                                                        |
| 865 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);  | 
                                                        |
| 866 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 867 | + }  | 
                                                        |
| 868 | +							if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
 | 
                                                        |
| 869 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";  | 
                                                        |
| 870 | + $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        |
| 871 | +								if ($default_value != '') {
 | 
                                                        |
| 872 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 873 | + }  | 
                                                        |
| 874 | +  | 
                                                        |
| 875 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);  | 
                                                        |
| 876 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 877 | + }  | 
                                                        |
| 878 | +							if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
 | 
                                                        |
| 879 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";  | 
                                                        |
| 880 | +  | 
                                                        |
| 881 | + $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        |
| 882 | +								if ($default_value != '') {
 | 
                                                        |
| 883 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 884 | + }  | 
                                                        |
| 885 | +  | 
                                                        |
| 886 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);  | 
                                                        |
| 887 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 888 | + }  | 
                                                        |
| 889 | +							if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        |
| 890 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";  | 
                                                        |
| 891 | + $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        |
| 892 | +								if ($default_value != '') {
 | 
                                                        |
| 893 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 894 | + }  | 
                                                        |
| 895 | +  | 
                                                        |
| 896 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);  | 
                                                        |
| 897 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 898 | + }  | 
                                                        |
| 899 | +							if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
 | 
                                                        |
| 900 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 901 | + $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        |
| 902 | +								if ($default_value != '') {
 | 
                                                        |
| 903 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 904 | + }  | 
                                                        |
| 905 | +  | 
                                                        |
| 906 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);  | 
                                                        |
| 907 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 908 | +  | 
                                                        |
| 909 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 857 | 910 | |
| 858 | -                            if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
 | 
                                                        |
| 859 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";  | 
                                                        |
| 860 | - $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        |
| 861 | -                                if ($default_value != '') {
 | 
                                                        |
| 862 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 863 | - }  | 
                                                        |
| 864 | -  | 
                                                        |
| 865 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);  | 
                                                        |
| 866 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 867 | - }  | 
                                                        |
| 868 | -                            if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
 | 
                                                        |
| 869 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";  | 
                                                        |
| 870 | - $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        |
| 871 | -                                if ($default_value != '') {
 | 
                                                        |
| 872 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 873 | - }  | 
                                                        |
| 874 | -  | 
                                                        |
| 875 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);  | 
                                                        |
| 876 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 877 | - }  | 
                                                        |
| 878 | -                            if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
 | 
                                                        |
| 879 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";  | 
                                                        |
| 880 | -  | 
                                                        |
| 881 | - $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        |
| 882 | -                                if ($default_value != '') {
 | 
                                                        |
| 883 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 884 | - }  | 
                                                        |
| 885 | -  | 
                                                        |
| 886 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);  | 
                                                        |
| 887 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 888 | - }  | 
                                                        |
| 889 | -                            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        |
| 890 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";  | 
                                                        |
| 891 | - $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        |
| 892 | -                                if ($default_value != '') {
 | 
                                                        |
| 893 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 894 | - }  | 
                                                        |
| 895 | -  | 
                                                        |
| 896 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);  | 
                                                        |
| 897 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 898 | - }  | 
                                                        |
| 899 | -                            if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
 | 
                                                        |
| 900 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 901 | - $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        |
| 902 | -                                if ($default_value != '') {
 | 
                                                        |
| 903 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 904 | - }  | 
                                                        |
| 905 | -  | 
                                                        |
| 906 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);  | 
                                                        |
| 907 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 908 | -  | 
                                                        |
| 909 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 910 | -  | 
                                                        |
| 911 | - $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        |
| 912 | -                                if ($default_value != '') {
 | 
                                                        |
| 913 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 914 | - }  | 
                                                        |
| 915 | -  | 
                                                        |
| 916 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);  | 
                                                        |
| 917 | -  | 
                                                        |
| 918 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 919 | - }  | 
                                                        |
| 920 | -                            if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
 | 
                                                        |
| 921 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 922 | -  | 
                                                        |
| 923 | - $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        |
| 924 | -                                if ($default_value != '') {
 | 
                                                        |
| 925 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 926 | - }  | 
                                                        |
| 927 | -  | 
                                                        |
| 928 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);  | 
                                                        |
| 929 | -  | 
                                                        |
| 930 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 931 | - }  | 
                                                        |
| 932 | -                            if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
 | 
                                                        |
| 933 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 934 | -  | 
                                                        |
| 935 | - $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        |
| 936 | -                                if ($default_value != '') {
 | 
                                                        |
| 937 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 938 | - }  | 
                                                        |
| 939 | -  | 
                                                        |
| 940 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);  | 
                                                        |
| 941 | -  | 
                                                        |
| 942 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 943 | - }  | 
                                                        |
| 944 | - // show lat lng  | 
                                                        |
| 945 | -                            if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
 | 
                                                        |
| 946 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 947 | -  | 
                                                        |
| 948 | - $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        |
| 949 | - $meta_field_add .= " DEFAULT '1'";  | 
                                                        |
| 950 | -  | 
                                                        |
| 951 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);  | 
                                                        |
| 952 | - //$wpdb->query($meta_field_add);  | 
                                                        |
| 953 | - }  | 
                                                        |
| 954 | - }  | 
                                                        |
| 955 | -  | 
                                                        |
| 956 | - break;  | 
                                                        |
| 957 | -  | 
                                                        |
| 958 | - case 'checkbox':  | 
                                                        |
| 959 | - $data_type = 'TINYINT';  | 
                                                        |
| 960 | -  | 
                                                        |
| 961 | - $meta_field_add = $data_type . "( 1 ) NOT NULL ";  | 
                                                        |
| 962 | -                        if ((int)$default_value === 1) {
 | 
                                                        |
| 963 | - $meta_field_add .= " DEFAULT '1'";  | 
                                                        |
| 964 | - }  | 
                                                        |
| 965 | -  | 
                                                        |
| 966 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 967 | -                        if ($add_result === false) {
 | 
                                                        |
| 968 | -                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
 | 
                                                        |
| 969 | - }  | 
                                                        |
| 970 | - break;  | 
                                                        |
| 971 | - case 'multiselect':  | 
                                                        |
| 972 | - case 'select':  | 
                                                        |
| 973 | - $data_type = 'VARCHAR';  | 
                                                        |
| 974 | - $op_size = '500';  | 
                                                        |
| 975 | -  | 
                                                        |
| 976 | - // only make the field as big as it needs to be.  | 
                                                        |
| 977 | -                        if (isset($option_values) && $option_values && $field_type == 'select') {
 | 
                                                        |
| 978 | -                            $option_values_arr = explode(',', $option_values);
 | 
                                                        |
| 979 | -  | 
                                                        |
| 980 | -                            if (is_array($option_values_arr)) {
 | 
                                                        |
| 981 | - $op_max = 0;  | 
                                                        |
| 982 | -  | 
                                                        |
| 983 | -                                foreach ($option_values_arr as $op_val) {
 | 
                                                        |
| 984 | -                                    if (strlen($op_val) && strlen($op_val) > $op_max) {
 | 
                                                        |
| 985 | - $op_max = strlen($op_val);  | 
                                                        |
| 986 | - }  | 
                                                        |
| 987 | - }  | 
                                                        |
| 988 | -  | 
                                                        |
| 989 | -                                if ($op_max) {
 | 
                                                        |
| 990 | - $op_size = $op_max;  | 
                                                        |
| 991 | - }  | 
                                                        |
| 992 | - }  | 
                                                        |
| 993 | -                        } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
 | 
                                                        |
| 994 | -                            if (strlen($option_values)) {
 | 
                                                        |
| 995 | - $op_size = strlen($option_values);  | 
                                                        |
| 996 | - }  | 
                                                        |
| 997 | -  | 
                                                        |
| 998 | -                            if (isset($request_field['multi_display_type'])) {
 | 
                                                        |
| 999 | - $extra_fields = $request_field['multi_display_type'];  | 
                                                        |
| 1000 | - }  | 
                                                        |
| 1001 | - }  | 
                                                        |
| 1002 | -  | 
                                                        |
| 1003 | - $meta_field_add = $data_type . "( $op_size ) NULL ";  | 
                                                        |
| 1004 | -                        if ($default_value != '') {
 | 
                                                        |
| 1005 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1006 | - }  | 
                                                        |
| 1007 | -  | 
                                                        |
| 1008 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1009 | -                        if ($add_result === false) {
 | 
                                                        |
| 1010 | -                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
 | 
                                                        |
| 1011 | - }  | 
                                                        |
| 1012 | - break;  | 
                                                        |
| 1013 | - case 'textarea':  | 
                                                        |
| 1014 | - case 'html':  | 
                                                        |
| 1015 | - case 'url':  | 
                                                        |
| 1016 | - case 'file':  | 
                                                        |
| 1017 | -  | 
                                                        |
| 1018 | - $data_type = 'TEXT';  | 
                                                        |
| 1019 | -  | 
                                                        |
| 1020 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1021 | -  | 
                                                        |
| 1022 | - $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1023 | - /*if($default_value != '')  | 
                                                        |
| 911 | + $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        |
| 912 | +								if ($default_value != '') {
 | 
                                                        |
| 913 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 914 | + }  | 
                                                        |
| 915 | +  | 
                                                        |
| 916 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);  | 
                                                        |
| 917 | +  | 
                                                        |
| 918 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 919 | + }  | 
                                                        |
| 920 | +							if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
 | 
                                                        |
| 921 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 922 | +  | 
                                                        |
| 923 | + $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        |
| 924 | +								if ($default_value != '') {
 | 
                                                        |
| 925 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 926 | + }  | 
                                                        |
| 927 | +  | 
                                                        |
| 928 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);  | 
                                                        |
| 929 | +  | 
                                                        |
| 930 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 931 | + }  | 
                                                        |
| 932 | +							if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
 | 
                                                        |
| 933 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 934 | +  | 
                                                        |
| 935 | + $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        |
| 936 | +								if ($default_value != '') {
 | 
                                                        |
| 937 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 938 | + }  | 
                                                        |
| 939 | +  | 
                                                        |
| 940 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);  | 
                                                        |
| 941 | +  | 
                                                        |
| 942 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 943 | + }  | 
                                                        |
| 944 | + // show lat lng  | 
                                                        |
| 945 | +							if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
 | 
                                                        |
| 946 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 947 | +  | 
                                                        |
| 948 | + $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        |
| 949 | + $meta_field_add .= " DEFAULT '1'";  | 
                                                        |
| 950 | +  | 
                                                        |
| 951 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);  | 
                                                        |
| 952 | + //$wpdb->query($meta_field_add);  | 
                                                        |
| 953 | + }  | 
                                                        |
| 954 | + }  | 
                                                        |
| 955 | +  | 
                                                        |
| 956 | + break;  | 
                                                        |
| 957 | +  | 
                                                        |
| 958 | + case 'checkbox':  | 
                                                        |
| 959 | + $data_type = 'TINYINT';  | 
                                                        |
| 960 | +  | 
                                                        |
| 961 | + $meta_field_add = $data_type . "( 1 ) NOT NULL ";  | 
                                                        |
| 962 | +						if ((int)$default_value === 1) {
 | 
                                                        |
| 963 | + $meta_field_add .= " DEFAULT '1'";  | 
                                                        |
| 964 | + }  | 
                                                        |
| 965 | +  | 
                                                        |
| 966 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 967 | +						if ($add_result === false) {
 | 
                                                        |
| 968 | +							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
 | 
                                                        |
| 969 | + }  | 
                                                        |
| 970 | + break;  | 
                                                        |
| 971 | + case 'multiselect':  | 
                                                        |
| 972 | + case 'select':  | 
                                                        |
| 973 | + $data_type = 'VARCHAR';  | 
                                                        |
| 974 | + $op_size = '500';  | 
                                                        |
| 975 | +  | 
                                                        |
| 976 | + // only make the field as big as it needs to be.  | 
                                                        |
| 977 | +						if (isset($option_values) && $option_values && $field_type == 'select') {
 | 
                                                        |
| 978 | +							$option_values_arr = explode(',', $option_values);
 | 
                                                        |
| 979 | +  | 
                                                        |
| 980 | +							if (is_array($option_values_arr)) {
 | 
                                                        |
| 981 | + $op_max = 0;  | 
                                                        |
| 982 | +  | 
                                                        |
| 983 | +								foreach ($option_values_arr as $op_val) {
 | 
                                                        |
| 984 | +									if (strlen($op_val) && strlen($op_val) > $op_max) {
 | 
                                                        |
| 985 | + $op_max = strlen($op_val);  | 
                                                        |
| 986 | + }  | 
                                                        |
| 987 | + }  | 
                                                        |
| 988 | +  | 
                                                        |
| 989 | +								if ($op_max) {
 | 
                                                        |
| 990 | + $op_size = $op_max;  | 
                                                        |
| 991 | + }  | 
                                                        |
| 992 | + }  | 
                                                        |
| 993 | +						} elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
 | 
                                                        |
| 994 | +							if (strlen($option_values)) {
 | 
                                                        |
| 995 | + $op_size = strlen($option_values);  | 
                                                        |
| 996 | + }  | 
                                                        |
| 997 | +  | 
                                                        |
| 998 | +							if (isset($request_field['multi_display_type'])) {
 | 
                                                        |
| 999 | + $extra_fields = $request_field['multi_display_type'];  | 
                                                        |
| 1000 | + }  | 
                                                        |
| 1001 | + }  | 
                                                        |
| 1002 | +  | 
                                                        |
| 1003 | + $meta_field_add = $data_type . "( $op_size ) NULL ";  | 
                                                        |
| 1004 | +						if ($default_value != '') {
 | 
                                                        |
| 1005 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1006 | + }  | 
                                                        |
| 1007 | +  | 
                                                        |
| 1008 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1009 | +						if ($add_result === false) {
 | 
                                                        |
| 1010 | +							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
 | 
                                                        |
| 1011 | + }  | 
                                                        |
| 1012 | + break;  | 
                                                        |
| 1013 | + case 'textarea':  | 
                                                        |
| 1014 | + case 'html':  | 
                                                        |
| 1015 | + case 'url':  | 
                                                        |
| 1016 | + case 'file':  | 
                                                        |
| 1017 | +  | 
                                                        |
| 1018 | + $data_type = 'TEXT';  | 
                                                        |
| 1019 | +  | 
                                                        |
| 1020 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1021 | +  | 
                                                        |
| 1022 | + $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1023 | + /*if($default_value != '')  | 
                                                        |
| 1024 | 1024 |  					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
 | 
                                                        
| 1025 | 1025 | |
| 1026 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1027 | -                        if ($add_result === false) {
 | 
                                                        |
| 1028 | -                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
 | 
                                                        |
| 1029 | - }  | 
                                                        |
| 1026 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1027 | +						if ($add_result === false) {
 | 
                                                        |
| 1028 | +							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
 | 
                                                        |
| 1029 | + }  | 
                                                        |
| 1030 | 1030 | |
| 1031 | - break;  | 
                                                        |
| 1031 | + break;  | 
                                                        |
| 1032 | 1032 | |
| 1033 | - case 'datepicker':  | 
                                                        |
| 1033 | + case 'datepicker':  | 
                                                        |
| 1034 | 1034 | |
| 1035 | - $data_type = 'DATE';  | 
                                                        |
| 1035 | + $data_type = 'DATE';  | 
                                                        |
| 1036 | 1036 | |
| 1037 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1037 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1038 | 1038 | |
| 1039 | - $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1039 | + $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1040 | 1040 | |
| 1041 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1042 | -                        if ($add_result === false) {
 | 
                                                        |
| 1043 | -                            return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
 | 
                                                        |
| 1044 | - }  | 
                                                        |
| 1041 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1042 | +						if ($add_result === false) {
 | 
                                                        |
| 1043 | +							return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
 | 
                                                        |
| 1044 | + }  | 
                                                        |
| 1045 | 1045 | |
| 1046 | - break;  | 
                                                        |
| 1046 | + break;  | 
                                                        |
| 1047 | 1047 | |
| 1048 | - case 'time':  | 
                                                        |
| 1048 | + case 'time':  | 
                                                        |
| 1049 | 1049 | |
| 1050 | - $data_type = 'TIME';  | 
                                                        |
| 1050 | + $data_type = 'TIME';  | 
                                                        |
| 1051 | 1051 | |
| 1052 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1052 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1053 | 1053 | |
| 1054 | - $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1054 | + $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1055 | 1055 | |
| 1056 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1057 | -                        if ($add_result === false) {
 | 
                                                        |
| 1058 | -                            return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
 | 
                                                        |
| 1059 | - }  | 
                                                        |
| 1056 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1057 | +						if ($add_result === false) {
 | 
                                                        |
| 1058 | +							return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
 | 
                                                        |
| 1059 | + }  | 
                                                        |
| 1060 | 1060 | |
| 1061 | - break;  | 
                                                        |
| 1061 | + break;  | 
                                                        |
| 1062 | 1062 | |
| 1063 | - default:  | 
                                                        |
| 1063 | + default:  | 
                                                        |
| 1064 | 1064 | |
| 1065 | -                        if ($data_type != 'VARCHAR' && $data_type != '') {
 | 
                                                        |
| 1066 | - $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1065 | +						if ($data_type != 'VARCHAR' && $data_type != '') {
 | 
                                                        |
| 1066 | + $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1067 | 1067 | |
| 1068 | -                            if ($data_type == 'FLOAT' && $decimal_point > 0) {
 | 
                                                        |
| 1069 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";  | 
                                                        |
| 1070 | - }  | 
                                                        |
| 1068 | +							if ($data_type == 'FLOAT' && $decimal_point > 0) {
 | 
                                                        |
| 1069 | + $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";  | 
                                                        |
| 1070 | + }  | 
                                                        |
| 1071 | 1071 | |
| 1072 | -                            if (is_numeric($default_value) && $default_value != '') {
 | 
                                                        |
| 1073 | - $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1074 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1075 | - }  | 
                                                        |
| 1076 | -                        } else {
 | 
                                                        |
| 1077 | - $meta_field_add = " VARCHAR( 254 ) NULL ";  | 
                                                        |
| 1072 | +							if (is_numeric($default_value) && $default_value != '') {
 | 
                                                        |
| 1073 | + $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1074 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1075 | + }  | 
                                                        |
| 1076 | +						} else {
 | 
                                                        |
| 1077 | + $meta_field_add = " VARCHAR( 254 ) NULL ";  | 
                                                        |
| 1078 | 1078 | |
| 1079 | -                            if ($default_value != '') {
 | 
                                                        |
| 1080 | - $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1081 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1082 | - }  | 
                                                        |
| 1083 | - }  | 
                                                        |
| 1079 | +							if ($default_value != '') {
 | 
                                                        |
| 1080 | + $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1081 | + $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1082 | + }  | 
                                                        |
| 1083 | + }  | 
                                                        |
| 1084 | 1084 | |
| 1085 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1086 | -                        if ($add_result === false) {
 | 
                                                        |
| 1087 | -                            return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
 | 
                                                        |
| 1088 | - }  | 
                                                        |
| 1089 | - break;  | 
                                                        |
| 1090 | - endswitch;  | 
                                                        |
| 1085 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        |
| 1086 | +						if ($add_result === false) {
 | 
                                                        |
| 1087 | +							return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
 | 
                                                        |
| 1088 | + }  | 
                                                        |
| 1089 | + break;  | 
                                                        |
| 1090 | + endswitch;  | 
                                                        |
| 1091 | 1091 | |
| 1092 | - $extra_field_query = '';  | 
                                                        |
| 1093 | -                if (!empty($extra_fields)) {
 | 
                                                        |
| 1094 | - $extra_field_query = serialize($extra_fields);  | 
                                                        |
| 1095 | - }  | 
                                                        |
| 1092 | + $extra_field_query = '';  | 
                                                        |
| 1093 | +				if (!empty($extra_fields)) {
 | 
                                                        |
| 1094 | + $extra_field_query = serialize($extra_fields);  | 
                                                        |
| 1095 | + }  | 
                                                        |
| 1096 | 1096 | |
| 1097 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';  | 
                                                        |
| 1097 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : '';  | 
                                                        |
| 1098 | 1098 | |
| 1099 | - $wpdb->query(  | 
                                                        |
| 1099 | + $wpdb->query(  | 
                                                        |
| 1100 | 1100 | |
| 1101 | - $wpdb->prepare(  | 
                                                        |
| 1101 | + $wpdb->prepare(  | 
                                                        |
| 1102 | 1102 | |
| 1103 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 1103 | + "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 1104 | 1104 | post_type = %s,  | 
                                                        
| 1105 | 1105 | admin_title = %s,  | 
                                                        
| 1106 | 1106 | site_title = %s,  | 
                                                        
@@ -1131,26 +1131,26 @@ discard block  | 
                                                    ||
| 1131 | 1131 | validation_msg = %s,  | 
                                                        
| 1132 | 1132 | for_admin_use = %s ",  | 
                                                        
| 1133 | 1133 | |
| 1134 | - array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)  | 
                                                        |
| 1134 | + array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)  | 
                                                        |
| 1135 | 1135 | |
| 1136 | - )  | 
                                                        |
| 1136 | + )  | 
                                                        |
| 1137 | 1137 | |
| 1138 | - );  | 
                                                        |
| 1138 | + );  | 
                                                        |
| 1139 | 1139 | |
| 1140 | - $lastid = $wpdb->insert_id;  | 
                                                        |
| 1140 | + $lastid = $wpdb->insert_id;  | 
                                                        |
| 1141 | 1141 | |
| 1142 | - $lastid = trim($lastid);  | 
                                                        |
| 1142 | + $lastid = trim($lastid);  | 
                                                        |
| 1143 | 1143 | |
| 1144 | - }  | 
                                                        |
| 1144 | + }  | 
                                                        |
| 1145 | 1145 | |
| 1146 | - return (int)$lastid;  | 
                                                        |
| 1146 | + return (int)$lastid;  | 
                                                        |
| 1147 | 1147 | |
| 1148 | 1148 | |
| 1149 | -        } else {
 | 
                                                        |
| 1150 | - return 'HTML Variable Name should be a unique name';  | 
                                                        |
| 1151 | - }  | 
                                                        |
| 1149 | +		} else {
 | 
                                                        |
| 1150 | + return 'HTML Variable Name should be a unique name';  | 
                                                        |
| 1151 | + }  | 
                                                        |
| 1152 | 1152 | |
| 1153 | - }  | 
                                                        |
| 1153 | + }  | 
                                                        |
| 1154 | 1154 | }  | 
                                                        
| 1155 | 1155 | |
| 1156 | 1156 | /**  | 
                                                        
@@ -1165,30 +1165,30 @@ discard block  | 
                                                    ||
| 1165 | 1165 | function godir_set_field_order($field_ids = array())  | 
                                                        
| 1166 | 1166 |  {
 | 
                                                        
| 1167 | 1167 | |
| 1168 | - global $wpdb;  | 
                                                        |
| 1168 | + global $wpdb;  | 
                                                        |
| 1169 | 1169 | |
| 1170 | - $count = 0;  | 
                                                        |
| 1171 | - if (!empty($field_ids)):  | 
                                                        |
| 1172 | - $post_meta_info = false;  | 
                                                        |
| 1173 | -        foreach ($field_ids as $id) {
 | 
                                                        |
| 1170 | + $count = 0;  | 
                                                        |
| 1171 | + if (!empty($field_ids)):  | 
                                                        |
| 1172 | + $post_meta_info = false;  | 
                                                        |
| 1173 | +		foreach ($field_ids as $id) {
 | 
                                                        |
| 1174 | 1174 | |
| 1175 | - $cf = trim($id, '_');  | 
                                                        |
| 1175 | + $cf = trim($id, '_');  | 
                                                        |
| 1176 | 1176 | |
| 1177 | - $post_meta_info = $wpdb->query(  | 
                                                        |
| 1178 | - $wpdb->prepare(  | 
                                                        |
| 1179 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 1177 | + $post_meta_info = $wpdb->query(  | 
                                                        |
| 1178 | + $wpdb->prepare(  | 
                                                        |
| 1179 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 1180 | 1180 | sort_order=%d  | 
                                                        
| 1181 | 1181 | where id= %d",  | 
                                                        
| 1182 | - array($count, $cf)  | 
                                                        |
| 1183 | - )  | 
                                                        |
| 1184 | - );  | 
                                                        |
| 1185 | - $count++;  | 
                                                        |
| 1186 | - }  | 
                                                        |
| 1187 | -  | 
                                                        |
| 1188 | - return $post_meta_info;  | 
                                                        |
| 1189 | - else:  | 
                                                        |
| 1190 | - return false;  | 
                                                        |
| 1191 | - endif;  | 
                                                        |
| 1182 | + array($count, $cf)  | 
                                                        |
| 1183 | + )  | 
                                                        |
| 1184 | + );  | 
                                                        |
| 1185 | + $count++;  | 
                                                        |
| 1186 | + }  | 
                                                        |
| 1187 | +  | 
                                                        |
| 1188 | + return $post_meta_info;  | 
                                                        |
| 1189 | + else:  | 
                                                        |
| 1190 | + return false;  | 
                                                        |
| 1191 | + endif;  | 
                                                        |
| 1192 | 1192 | }  | 
                                                        
| 1193 | 1193 | |
| 1194 | 1194 | |
@@ -1208,140 +1208,140 @@ discard block  | 
                                                    ||
| 1208 | 1208 | * @param string $post_type Optional. The wordpress post type.  | 
                                                        
| 1209 | 1209 | */  | 
                                                        
| 1210 | 1210 |  function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
 | 
                                                        
| 1211 | - global $is_default, $mapzoom, $gd_session;  | 
                                                        |
| 1212 | -  | 
                                                        |
| 1213 | - $show_editors = array();  | 
                                                        |
| 1214 | - $listing_type = $post_type;  | 
                                                        |
| 1215 | -  | 
                                                        |
| 1216 | - $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);  | 
                                                        |
| 1217 | -  | 
                                                        |
| 1218 | - $fieldset_id = '';  | 
                                                        |
| 1219 | - $fieldset_field_class = 'gd-fieldset-details';  | 
                                                        |
| 1220 | -    foreach ($custom_fields as $key => $val) {
 | 
                                                        |
| 1221 | - $val = stripslashes_deep($val); // strip slashes from labels  | 
                                                        |
| 1222 | - $name = $val['name'];  | 
                                                        |
| 1223 | - $site_title = $val['site_title'];  | 
                                                        |
| 1224 | - $type = $val['type'];  | 
                                                        |
| 1225 | - $admin_desc = $val['desc'];  | 
                                                        |
| 1226 | - $option_values = $val['option_values'];  | 
                                                        |
| 1227 | - $is_required = $val['is_required'];  | 
                                                        |
| 1228 | - $is_default = $val['is_default'];  | 
                                                        |
| 1229 | - $is_admin = $val['is_admin'];  | 
                                                        |
| 1230 | - $required_msg = $val['required_msg'];  | 
                                                        |
| 1231 | - $extra_fields = unserialize($val['extra_fields']);  | 
                                                        |
| 1232 | - $value = '';  | 
                                                        |
| 1233 | -  | 
                                                        |
| 1234 | - /* field available to site admin only for edit */  | 
                                                        |
| 1235 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;  | 
                                                        |
| 1236 | -        if ($for_admin_use && !is_super_admin()) {
 | 
                                                        |
| 1237 | - continue;  | 
                                                        |
| 1238 | - }  | 
                                                        |
| 1239 | -  | 
                                                        |
| 1240 | -        if (is_admin()) {
 | 
                                                        |
| 1241 | - global $post;  | 
                                                        |
| 1242 | -  | 
                                                        |
| 1243 | - if (isset($_REQUEST['post']))  | 
                                                        |
| 1244 | - $_REQUEST['pid'] = $_REQUEST['post'];  | 
                                                        |
| 1245 | - }  | 
                                                        |
| 1246 | -  | 
                                                        |
| 1247 | -        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
 | 
                                                        |
| 1248 | - $post = $gd_ses_listing;  | 
                                                        |
| 1249 | - $value = isset($post[$name]) ? $post[$name] : '';  | 
                                                        |
| 1250 | -        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        |
| 1251 | - $value = geodir_get_post_meta($_REQUEST['pid'], $name, true);  | 
                                                        |
| 1252 | -        } else {
 | 
                                                        |
| 1253 | -            if ($value == '') {
 | 
                                                        |
| 1254 | - $value = $val['default'];  | 
                                                        |
| 1255 | - }  | 
                                                        |
| 1256 | - }  | 
                                                        |
| 1257 | -  | 
                                                        |
| 1258 | - /**  | 
                                                        |
| 1259 | - * Called before the custom fields info is output for submitting a post.  | 
                                                        |
| 1260 | - *  | 
                                                        |
| 1261 | - * Used dynamic hook type geodir_before_custom_form_field_$name.  | 
                                                        |
| 1262 | - *  | 
                                                        |
| 1263 | - * @since 1.0.0  | 
                                                        |
| 1264 | - * @param string $listing_type The post post type.  | 
                                                        |
| 1265 | - * @param int $package_id The price package ID for the post.  | 
                                                        |
| 1266 | -         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
 | 
                                                        |
| 1267 | - * @see 'geodir_after_custom_form_field_$name'  | 
                                                        |
| 1268 | - */  | 
                                                        |
| 1269 | -        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
 | 
                                                        |
| 1270 | -  | 
                                                        |
| 1271 | -        if ($type == 'fieldset') {
 | 
                                                        |
| 1272 | - $fieldset_id = (int)$val['id'];  | 
                                                        |
| 1273 | - $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;  | 
                                                        |
| 1274 | - ?>  | 
                                                        |
| 1211 | + global $is_default, $mapzoom, $gd_session;  | 
                                                        |
| 1212 | +  | 
                                                        |
| 1213 | + $show_editors = array();  | 
                                                        |
| 1214 | + $listing_type = $post_type;  | 
                                                        |
| 1215 | +  | 
                                                        |
| 1216 | + $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);  | 
                                                        |
| 1217 | +  | 
                                                        |
| 1218 | + $fieldset_id = '';  | 
                                                        |
| 1219 | + $fieldset_field_class = 'gd-fieldset-details';  | 
                                                        |
| 1220 | +	foreach ($custom_fields as $key => $val) {
 | 
                                                        |
| 1221 | + $val = stripslashes_deep($val); // strip slashes from labels  | 
                                                        |
| 1222 | + $name = $val['name'];  | 
                                                        |
| 1223 | + $site_title = $val['site_title'];  | 
                                                        |
| 1224 | + $type = $val['type'];  | 
                                                        |
| 1225 | + $admin_desc = $val['desc'];  | 
                                                        |
| 1226 | + $option_values = $val['option_values'];  | 
                                                        |
| 1227 | + $is_required = $val['is_required'];  | 
                                                        |
| 1228 | + $is_default = $val['is_default'];  | 
                                                        |
| 1229 | + $is_admin = $val['is_admin'];  | 
                                                        |
| 1230 | + $required_msg = $val['required_msg'];  | 
                                                        |
| 1231 | + $extra_fields = unserialize($val['extra_fields']);  | 
                                                        |
| 1232 | + $value = '';  | 
                                                        |
| 1233 | +  | 
                                                        |
| 1234 | + /* field available to site admin only for edit */  | 
                                                        |
| 1235 | + $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;  | 
                                                        |
| 1236 | +		if ($for_admin_use && !is_super_admin()) {
 | 
                                                        |
| 1237 | + continue;  | 
                                                        |
| 1238 | + }  | 
                                                        |
| 1239 | +  | 
                                                        |
| 1240 | +		if (is_admin()) {
 | 
                                                        |
| 1241 | + global $post;  | 
                                                        |
| 1242 | +  | 
                                                        |
| 1243 | + if (isset($_REQUEST['post']))  | 
                                                        |
| 1244 | + $_REQUEST['pid'] = $_REQUEST['post'];  | 
                                                        |
| 1245 | + }  | 
                                                        |
| 1246 | +  | 
                                                        |
| 1247 | +		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
 | 
                                                        |
| 1248 | + $post = $gd_ses_listing;  | 
                                                        |
| 1249 | + $value = isset($post[$name]) ? $post[$name] : '';  | 
                                                        |
| 1250 | +		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        |
| 1251 | + $value = geodir_get_post_meta($_REQUEST['pid'], $name, true);  | 
                                                        |
| 1252 | +		} else {
 | 
                                                        |
| 1253 | +			if ($value == '') {
 | 
                                                        |
| 1254 | + $value = $val['default'];  | 
                                                        |
| 1255 | + }  | 
                                                        |
| 1256 | + }  | 
                                                        |
| 1257 | +  | 
                                                        |
| 1258 | + /**  | 
                                                        |
| 1259 | + * Called before the custom fields info is output for submitting a post.  | 
                                                        |
| 1260 | + *  | 
                                                        |
| 1261 | + * Used dynamic hook type geodir_before_custom_form_field_$name.  | 
                                                        |
| 1262 | + *  | 
                                                        |
| 1263 | + * @since 1.0.0  | 
                                                        |
| 1264 | + * @param string $listing_type The post post type.  | 
                                                        |
| 1265 | + * @param int $package_id The price package ID for the post.  | 
                                                        |
| 1266 | +		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
 | 
                                                        |
| 1267 | + * @see 'geodir_after_custom_form_field_$name'  | 
                                                        |
| 1268 | + */  | 
                                                        |
| 1269 | +		do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
 | 
                                                        |
| 1270 | +  | 
                                                        |
| 1271 | +		if ($type == 'fieldset') {
 | 
                                                        |
| 1272 | + $fieldset_id = (int)$val['id'];  | 
                                                        |
| 1273 | + $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;  | 
                                                        |
| 1274 | + ?>  | 
                                                        |
| 1275 | 1275 | <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>  | 
                                                        
| 1276 | 1276 | <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>  | 
                                                        
| 1277 | 1277 | <?php  | 
                                                        
| 1278 | -        } else if ($type == 'address') {
 | 
                                                        |
| 1279 | - $prefix = $name . '_';  | 
                                                        |
| 1280 | -  | 
                                                        |
| 1281 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');  | 
                                                        |
| 1282 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');  | 
                                                        |
| 1283 | -            ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
 | 
                                                        |
| 1284 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');  | 
                                                        |
| 1285 | -  | 
                                                        |
| 1286 | - $address = '';  | 
                                                        |
| 1287 | - $zip = '';  | 
                                                        |
| 1288 | - $mapview = '';  | 
                                                        |
| 1289 | - $mapzoom = '';  | 
                                                        |
| 1290 | - $lat = '';  | 
                                                        |
| 1291 | - $lng = '';  | 
                                                        |
| 1292 | -  | 
                                                        |
| 1293 | -            if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
 | 
                                                        |
| 1294 | - $post = $gd_ses_listing;  | 
                                                        |
| 1295 | - $address = $post[$prefix . 'address'];  | 
                                                        |
| 1296 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';  | 
                                                        |
| 1297 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';  | 
                                                        |
| 1298 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';  | 
                                                        |
| 1299 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';  | 
                                                        |
| 1300 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';  | 
                                                        |
| 1301 | -            } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
 | 
                                                        |
| 1302 | - $post_info = (array)$post_info;  | 
                                                        |
| 1303 | -  | 
                                                        |
| 1304 | - $address = $post_info[$prefix . 'address'];  | 
                                                        |
| 1305 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';  | 
                                                        |
| 1306 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';  | 
                                                        |
| 1307 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';  | 
                                                        |
| 1308 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';  | 
                                                        |
| 1309 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';  | 
                                                        |
| 1310 | - }  | 
                                                        |
| 1311 | -  | 
                                                        |
| 1312 | - $location = geodir_get_default_location();  | 
                                                        |
| 1313 | - if (empty($city)) $city = isset($location->city) ? $location->city : '';  | 
                                                        |
| 1314 | - if (empty($region)) $region = isset($location->region) ? $location->region : '';  | 
                                                        |
| 1315 | - if (empty($country)) $country = isset($location->country) ? $location->country : '';  | 
                                                        |
| 1316 | -  | 
                                                        |
| 1317 | - $lat_lng_blank = false;  | 
                                                        |
| 1318 | -            if (empty($lat) && empty($lng)) {
 | 
                                                        |
| 1319 | - $lat_lng_blank = true;  | 
                                                        |
| 1320 | - }  | 
                                                        |
| 1321 | -  | 
                                                        |
| 1322 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';  | 
                                                        |
| 1323 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';  | 
                                                        |
| 1324 | -  | 
                                                        |
| 1325 | - /**  | 
                                                        |
| 1326 | - * Filter the default latitude.  | 
                                                        |
| 1327 | - *  | 
                                                        |
| 1328 | - * @since 1.0.0  | 
                                                        |
| 1329 | - *  | 
                                                        |
| 1330 | - * @param float $lat Default latitude.  | 
                                                        |
| 1331 | - * @param bool $is_admin For admin use only?.  | 
                                                        |
| 1332 | - */  | 
                                                        |
| 1333 | -            $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
 | 
                                                        |
| 1334 | - /**  | 
                                                        |
| 1335 | - * Filter the default longitude.  | 
                                                        |
| 1336 | - *  | 
                                                        |
| 1337 | - * @since 1.0.0  | 
                                                        |
| 1338 | - *  | 
                                                        |
| 1339 | - * @param float $lat Default longitude.  | 
                                                        |
| 1340 | - * @param bool $is_admin For admin use only?.  | 
                                                        |
| 1341 | - */  | 
                                                        |
| 1342 | -            $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
 | 
                                                        |
| 1343 | -  | 
                                                        |
| 1344 | - ?>  | 
                                                        |
| 1278 | +		} else if ($type == 'address') {
 | 
                                                        |
| 1279 | + $prefix = $name . '_';  | 
                                                        |
| 1280 | +  | 
                                                        |
| 1281 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');  | 
                                                        |
| 1282 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');  | 
                                                        |
| 1283 | +			($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
 | 
                                                        |
| 1284 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');  | 
                                                        |
| 1285 | +  | 
                                                        |
| 1286 | + $address = '';  | 
                                                        |
| 1287 | + $zip = '';  | 
                                                        |
| 1288 | + $mapview = '';  | 
                                                        |
| 1289 | + $mapzoom = '';  | 
                                                        |
| 1290 | + $lat = '';  | 
                                                        |
| 1291 | + $lng = '';  | 
                                                        |
| 1292 | +  | 
                                                        |
| 1293 | +			if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
 | 
                                                        |
| 1294 | + $post = $gd_ses_listing;  | 
                                                        |
| 1295 | + $address = $post[$prefix . 'address'];  | 
                                                        |
| 1296 | + $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';  | 
                                                        |
| 1297 | + $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';  | 
                                                        |
| 1298 | + $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';  | 
                                                        |
| 1299 | + $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';  | 
                                                        |
| 1300 | + $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';  | 
                                                        |
| 1301 | +			} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
 | 
                                                        |
| 1302 | + $post_info = (array)$post_info;  | 
                                                        |
| 1303 | +  | 
                                                        |
| 1304 | + $address = $post_info[$prefix . 'address'];  | 
                                                        |
| 1305 | + $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';  | 
                                                        |
| 1306 | + $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';  | 
                                                        |
| 1307 | + $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';  | 
                                                        |
| 1308 | + $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';  | 
                                                        |
| 1309 | + $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';  | 
                                                        |
| 1310 | + }  | 
                                                        |
| 1311 | +  | 
                                                        |
| 1312 | + $location = geodir_get_default_location();  | 
                                                        |
| 1313 | + if (empty($city)) $city = isset($location->city) ? $location->city : '';  | 
                                                        |
| 1314 | + if (empty($region)) $region = isset($location->region) ? $location->region : '';  | 
                                                        |
| 1315 | + if (empty($country)) $country = isset($location->country) ? $location->country : '';  | 
                                                        |
| 1316 | +  | 
                                                        |
| 1317 | + $lat_lng_blank = false;  | 
                                                        |
| 1318 | +			if (empty($lat) && empty($lng)) {
 | 
                                                        |
| 1319 | + $lat_lng_blank = true;  | 
                                                        |
| 1320 | + }  | 
                                                        |
| 1321 | +  | 
                                                        |
| 1322 | + if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';  | 
                                                        |
| 1323 | + if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';  | 
                                                        |
| 1324 | +  | 
                                                        |
| 1325 | + /**  | 
                                                        |
| 1326 | + * Filter the default latitude.  | 
                                                        |
| 1327 | + *  | 
                                                        |
| 1328 | + * @since 1.0.0  | 
                                                        |
| 1329 | + *  | 
                                                        |
| 1330 | + * @param float $lat Default latitude.  | 
                                                        |
| 1331 | + * @param bool $is_admin For admin use only?.  | 
                                                        |
| 1332 | + */  | 
                                                        |
| 1333 | +			$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
 | 
                                                        |
| 1334 | + /**  | 
                                                        |
| 1335 | + * Filter the default longitude.  | 
                                                        |
| 1336 | + *  | 
                                                        |
| 1337 | + * @since 1.0.0  | 
                                                        |
| 1338 | + *  | 
                                                        |
| 1339 | + * @param float $lat Default longitude.  | 
                                                        |
| 1340 | + * @param bool $is_admin For admin use only?.  | 
                                                        |
| 1341 | + */  | 
                                                        |
| 1342 | +			$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
 | 
                                                        |
| 1343 | +  | 
                                                        |
| 1344 | + ?>  | 
                                                        |
| 1345 | 1345 | |
| 1346 | 1346 | <div id="geodir_<?php echo $prefix . 'address';?>_row"  | 
                                                        
| 1347 | 1347 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
@@ -1360,17 +1360,17 @@ discard block  | 
                                                    ||
| 1360 | 1360 | |
| 1361 | 1361 | |
| 1362 | 1362 | <?php  | 
                                                        
| 1363 | - /**  | 
                                                        |
| 1364 | - * Called after the address input on the add listings.  | 
                                                        |
| 1365 | - *  | 
                                                        |
| 1366 | - * This is used by the location manage to add further locations info etc.  | 
                                                        |
| 1367 | - *  | 
                                                        |
| 1368 | - * @since 1.0.0  | 
                                                        |
| 1369 | -             * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}.
 | 
                                                        |
| 1370 | - */  | 
                                                        |
| 1371 | -            do_action('geodir_address_extra_listing_fields', $val);
 | 
                                                        |
| 1372 | -  | 
                                                        |
| 1373 | -            if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
 | 
                                                        |
| 1363 | + /**  | 
                                                        |
| 1364 | + * Called after the address input on the add listings.  | 
                                                        |
| 1365 | + *  | 
                                                        |
| 1366 | + * This is used by the location manage to add further locations info etc.  | 
                                                        |
| 1367 | + *  | 
                                                        |
| 1368 | + * @since 1.0.0  | 
                                                        |
| 1369 | +			 * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}.
 | 
                                                        |
| 1370 | + */  | 
                                                        |
| 1371 | +			do_action('geodir_address_extra_listing_fields', $val);
 | 
                                                        |
| 1372 | +  | 
                                                        |
| 1373 | +			if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
 | 
                                                        |
| 1374 | 1374 | |
| 1375 | 1375 | <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"  | 
                                                        
| 1376 | 1376 | class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
@@ -1391,22 +1391,22 @@ discard block  | 
                                                    ||
| 1391 | 1391 | |
| 1392 | 1392 | <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1393 | 1393 | <?php  | 
                                                        
| 1394 | - /**  | 
                                                        |
| 1395 | - * Contains add listing page map functions.  | 
                                                        |
| 1396 | - *  | 
                                                        |
| 1397 | - * @since 1.0.0  | 
                                                        |
| 1398 | - */  | 
                                                        |
| 1399 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");  | 
                                                        |
| 1400 | -                    if ($lat_lng_blank) {
 | 
                                                        |
| 1401 | - $lat = '';  | 
                                                        |
| 1402 | - $lng = '';  | 
                                                        |
| 1403 | - }  | 
                                                        |
| 1404 | - ?>  | 
                                                        |
| 1394 | + /**  | 
                                                        |
| 1395 | + * Contains add listing page map functions.  | 
                                                        |
| 1396 | + *  | 
                                                        |
| 1397 | + * @since 1.0.0  | 
                                                        |
| 1398 | + */  | 
                                                        |
| 1399 | + include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");  | 
                                                        |
| 1400 | +					if ($lat_lng_blank) {
 | 
                                                        |
| 1401 | + $lat = '';  | 
                                                        |
| 1402 | + $lng = '';  | 
                                                        |
| 1403 | + }  | 
                                                        |
| 1404 | + ?>  | 
                                                        |
| 1405 | 1405 | <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span>  | 
                                                        
| 1406 | 1406 | </div>  | 
                                                        
| 1407 | 1407 | <?php  | 
                                                        
| 1408 | - /* show lat lng */  | 
                                                        |
| 1409 | - $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>  | 
                                                        |
| 1408 | + /* show lat lng */  | 
                                                        |
| 1409 | + $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>  | 
                                                        |
| 1410 | 1410 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"  | 
                                                        
| 1411 | 1411 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>  | 
                                                        
| 1412 | 1412 | <label>  | 
                                                        
@@ -1447,27 +1447,27 @@ discard block  | 
                                                    ||
| 1447 | 1447 | class="gd-checkbox"  | 
                                                        
| 1448 | 1448 | name="<?php echo $prefix . 'mapview'; ?>"  | 
                                                        
| 1449 | 1449 |                                                              id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
 | 
                                                        
| 1450 | - echo 'checked="checked"';  | 
                                                        |
| 1451 | -                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
 | 
                                                        |
| 1450 | + echo 'checked="checked"';  | 
                                                        |
| 1451 | +						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
 | 
                                                        |
| 1452 | 1452 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"  | 
                                                        
| 1453 | 1453 | class="gd-checkbox"  | 
                                                        
| 1454 | 1454 | name="<?php echo $prefix . 'mapview'; ?>"  | 
                                                        
| 1455 | 1455 |                                                               id="map_view1" <?php if ($mapview == 'SATELLITE') {
 | 
                                                        
| 1456 | - echo 'checked="checked"';  | 
                                                        |
| 1457 | -                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
 | 
                                                        |
| 1456 | + echo 'checked="checked"';  | 
                                                        |
| 1457 | +						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
 | 
                                                        |
| 1458 | 1458 | |
| 1459 | 1459 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"  | 
                                                        
| 1460 | 1460 | class="gd-checkbox"  | 
                                                        
| 1461 | 1461 | name="<?php echo $prefix . 'mapview'; ?>"  | 
                                                        
| 1462 | 1462 |                                                              id="map_view2" <?php if ($mapview == 'HYBRID') {
 | 
                                                        
| 1463 | - echo 'checked="checked"';  | 
                                                        |
| 1464 | -                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
 | 
                                                        |
| 1463 | + echo 'checked="checked"';  | 
                                                        |
| 1464 | +						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
 | 
                                                        |
| 1465 | 1465 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"  | 
                                                        
| 1466 | 1466 | class="gd-checkbox"  | 
                                                        
| 1467 | 1467 | name="<?php echo $prefix . 'mapview'; ?>"  | 
                                                        
| 1468 | 1468 |                                                              id="map_view3" <?php if ($mapview == 'TERRAIN') {
 | 
                                                        
| 1469 | - echo 'checked="checked"';  | 
                                                        |
| 1470 | -                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
 | 
                                                        |
| 1469 | + echo 'checked="checked"';  | 
                                                        |
| 1470 | +						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
 | 
                                                        |
| 1471 | 1471 | |
| 1472 | 1472 | |
| 1473 | 1473 | </div>  | 
                                                        
@@ -1475,31 +1475,31 @@ discard block  | 
                                                    ||
| 1475 | 1475 | |
| 1476 | 1476 |              <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
 | 
                                                        
| 1477 | 1477 |                  <input type="hidden" value="<?php if (isset($mapzoom)) {
 | 
                                                        
| 1478 | - echo esc_attr($mapzoom);  | 
                                                        |
| 1479 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>  | 
                                                        |
| 1478 | + echo esc_attr($mapzoom);  | 
                                                        |
| 1479 | + } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>  | 
                                                        |
| 1480 | 1480 | <?php }?>  | 
                                                        
| 1481 | 1481 |          <?php } elseif ($type == 'text') {
 | 
                                                        
| 1482 | 1482 | |
| 1483 | - //number and float validation $validation_pattern  | 
                                                        |
| 1484 | -            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
 | 
                                                        |
| 1485 | -            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
 | 
                                                        |
| 1486 | - //print_r($val);  | 
                                                        |
| 1487 | - //validation  | 
                                                        |
| 1488 | -            if(isset($val['validation_pattern']) && $val['validation_pattern']){
 | 
                                                        |
| 1489 | - $validation = 'pattern="'.$val['validation_pattern'].'"';  | 
                                                        |
| 1490 | -            }else{$validation='';}
 | 
                                                        |
| 1491 | -  | 
                                                        |
| 1492 | - // validation message  | 
                                                        |
| 1493 | -            if(isset($val['validation_msg']) && $val['validation_msg']){
 | 
                                                        |
| 1494 | - $validation_msg = 'title="'.$val['validation_msg'].'"';  | 
                                                        |
| 1495 | -            }else{$validation_msg='';}
 | 
                                                        |
| 1496 | - ?>  | 
                                                        |
| 1483 | + //number and float validation $validation_pattern  | 
                                                        |
| 1484 | +			if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
 | 
                                                        |
| 1485 | +			elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
 | 
                                                        |
| 1486 | + //print_r($val);  | 
                                                        |
| 1487 | + //validation  | 
                                                        |
| 1488 | +			if(isset($val['validation_pattern']) && $val['validation_pattern']){
 | 
                                                        |
| 1489 | + $validation = 'pattern="'.$val['validation_pattern'].'"';  | 
                                                        |
| 1490 | +			}else{$validation='';}
 | 
                                                        |
| 1491 | +  | 
                                                        |
| 1492 | + // validation message  | 
                                                        |
| 1493 | +			if(isset($val['validation_msg']) && $val['validation_msg']){
 | 
                                                        |
| 1494 | + $validation_msg = 'title="'.$val['validation_msg'].'"';  | 
                                                        |
| 1495 | +			}else{$validation_msg='';}
 | 
                                                        |
| 1496 | + ?>  | 
                                                        |
| 1497 | 1497 | |
| 1498 | 1498 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1499 | 1499 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1500 | 1500 | <label>  | 
                                                        
| 1501 | 1501 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1502 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1502 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1503 | 1503 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1504 | 1504 | </label>  | 
                                                        
| 1505 | 1505 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
@@ -1511,15 +1511,15 @@ discard block  | 
                                                    ||
| 1511 | 1511 | </div>  | 
                                                        
| 1512 | 1512 | |
| 1513 | 1513 |          <?php } elseif ($type == 'email') {
 | 
                                                        
| 1514 | -            if ($value == $val['default']) {
 | 
                                                        |
| 1515 | - $value = '';  | 
                                                        |
| 1516 | - }?>  | 
                                                        |
| 1514 | +			if ($value == $val['default']) {
 | 
                                                        |
| 1515 | + $value = '';  | 
                                                        |
| 1516 | + }?>  | 
                                                        |
| 1517 | 1517 | |
| 1518 | 1518 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1519 | 1519 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1520 | 1520 | <label>  | 
                                                        
| 1521 | 1521 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1522 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1522 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1523 | 1523 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1524 | 1524 | </label>  | 
                                                        
| 1525 | 1525 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
@@ -1531,15 +1531,15 @@ discard block  | 
                                                    ||
| 1531 | 1531 | </div>  | 
                                                        
| 1532 | 1532 | |
| 1533 | 1533 |          <?php } elseif ($type == 'phone') {
 | 
                                                        
| 1534 | -            if ($value == $val['default']) {
 | 
                                                        |
| 1535 | - $value = '';  | 
                                                        |
| 1536 | - } ?>  | 
                                                        |
| 1534 | +			if ($value == $val['default']) {
 | 
                                                        |
| 1535 | + $value = '';  | 
                                                        |
| 1536 | + } ?>  | 
                                                        |
| 1537 | 1537 | |
| 1538 | 1538 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1539 | 1539 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1540 | 1540 | <label>  | 
                                                        
| 1541 | 1541 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1542 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1542 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1543 | 1543 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1544 | 1544 | </label>  | 
                                                        
| 1545 | 1545 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
@@ -1551,15 +1551,15 @@ discard block  | 
                                                    ||
| 1551 | 1551 | </div>  | 
                                                        
| 1552 | 1552 | |
| 1553 | 1553 |          <?php } elseif ($type == 'url') {
 | 
                                                        
| 1554 | -            if ($value == $val['default']) {
 | 
                                                        |
| 1555 | - $value = '';  | 
                                                        |
| 1556 | - }?>  | 
                                                        |
| 1554 | +			if ($value == $val['default']) {
 | 
                                                        |
| 1555 | + $value = '';  | 
                                                        |
| 1556 | + }?>  | 
                                                        |
| 1557 | 1557 | |
| 1558 | 1558 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1559 | 1559 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1560 | 1560 | <label>  | 
                                                        
| 1561 | 1561 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1562 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1562 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1563 | 1563 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1564 | 1564 | </label>  | 
                                                        
| 1565 | 1565 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
@@ -1578,23 +1578,23 @@ discard block  | 
                                                    ||
| 1578 | 1578 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1579 | 1579 | <label>  | 
                                                        
| 1580 | 1580 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1581 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1581 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1582 | 1582 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1583 | 1583 | </label>  | 
                                                        
| 1584 | 1584 |                  <?php if ($option_values) {
 | 
                                                        
| 1585 | - $option_values = geodir_string_values_to_options($option_values, true);  | 
                                                        |
| 1585 | + $option_values = geodir_string_values_to_options($option_values, true);  | 
                                                        |
| 1586 | 1586 | |
| 1587 | -                    if (!empty($option_values)) {
 | 
                                                        |
| 1588 | -                        foreach ($option_values as $option_value) {
 | 
                                                        |
| 1589 | -                            if (empty($option_value['optgroup'])) {
 | 
                                                        |
| 1590 | - ?>  | 
                                                        |
| 1587 | +					if (!empty($option_values)) {
 | 
                                                        |
| 1588 | +						foreach ($option_values as $option_value) {
 | 
                                                        |
| 1589 | +							if (empty($option_value['optgroup'])) {
 | 
                                                        |
| 1590 | + ?>  | 
                                                        |
| 1591 | 1591 | <span class="gd-radios"><input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?></span>  | 
                                                        
| 1592 | 1592 | <?php  | 
                                                        
| 1593 | - }  | 
                                                        |
| 1594 | - }  | 
                                                        |
| 1595 | - }  | 
                                                        |
| 1596 | - }  | 
                                                        |
| 1597 | - ?>  | 
                                                        |
| 1593 | + }  | 
                                                        |
| 1594 | + }  | 
                                                        |
| 1595 | + }  | 
                                                        |
| 1596 | + }  | 
                                                        |
| 1597 | + ?>  | 
                                                        |
| 1598 | 1598 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        
| 1599 | 1599 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1600 | 1600 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
@@ -1607,16 +1607,16 @@ discard block  | 
                                                    ||
| 1607 | 1607 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1608 | 1608 | <label>  | 
                                                        
| 1609 | 1609 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1610 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1610 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1611 | 1611 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1612 | 1612 | </label>  | 
                                                        
| 1613 | 1613 |                  <?php if ($value != '1') {
 | 
                                                        
| 1614 | - $value = '0';  | 
                                                        |
| 1615 | - }?>  | 
                                                        |
| 1614 | + $value = '0';  | 
                                                        |
| 1615 | + }?>  | 
                                                        |
| 1616 | 1616 | <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/>  | 
                                                        
| 1617 | 1617 |                  <input  <?php if ($value == '1') {
 | 
                                                        
| 1618 | - echo 'checked="checked"';  | 
                                                        |
| 1619 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"  | 
                                                        |
| 1618 | + echo 'checked="checked"';  | 
                                                        |
| 1619 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"  | 
                                                        |
| 1620 | 1620 |                       onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
 | 
                                                        
| 1621 | 1621 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        
| 1622 | 1622 |                  <?php if ($is_required) { ?>
 | 
                                                        
@@ -1625,31 +1625,31 @@ discard block  | 
                                                    ||
| 1625 | 1625 | </div>  | 
                                                        
| 1626 | 1626 | |
| 1627 | 1627 |          <?php } elseif ($type == 'textarea') {
 | 
                                                        
| 1628 | - ?>  | 
                                                        |
| 1628 | + ?>  | 
                                                        |
| 1629 | 1629 | |
| 1630 | 1630 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1631 | 1631 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1632 | 1632 | <label>  | 
                                                        
| 1633 | 1633 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1634 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1634 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1635 | 1635 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1636 | 1636 | </label><?php  | 
                                                        
| 1637 | 1637 | |
| 1638 | 1638 | |
| 1639 | -                if (is_array($extra_fields) && in_array('1', $extra_fields)) {
 | 
                                                        |
| 1639 | +				if (is_array($extra_fields) && in_array('1', $extra_fields)) {
 | 
                                                        |
| 1640 | 1640 | |
| 1641 | -                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
 | 
                                                        |
| 1641 | +					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
 | 
                                                        |
| 1642 | 1642 | |
| 1643 | 1643 | <div class="editor" field_id="<?php echo $name;?>" field_type="editor">  | 
                                                        
| 1644 | 1644 | <?php wp_editor(stripslashes($value), $name, $editor_settings); ?>  | 
                                                        
| 1645 | 1645 | </div><?php  | 
                                                        
| 1646 | 1646 | |
| 1647 | -                } else {
 | 
                                                        |
| 1647 | +				} else {
 | 
                                                        |
| 1648 | 1648 | |
| 1649 | - ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"  | 
                                                        |
| 1649 | + ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"  | 
                                                        |
| 1650 | 1650 | id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php  | 
                                                        
| 1651 | 1651 | |
| 1652 | - }?>  | 
                                                        |
| 1652 | + }?>  | 
                                                        |
| 1653 | 1653 | |
| 1654 | 1654 | |
| 1655 | 1655 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        
@@ -1663,28 +1663,28 @@ discard block  | 
                                                    ||
| 1663 | 1663 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1664 | 1664 | <label>  | 
                                                        
| 1665 | 1665 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1666 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1666 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1667 | 1667 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1668 | 1668 | </label>  | 
                                                        
| 1669 | 1669 | <?php  | 
                                                        
| 1670 | - $option_values_arr = geodir_string_values_to_options($option_values, true);  | 
                                                        |
| 1671 | - $select_options = '';  | 
                                                        |
| 1672 | -                if (!empty($option_values_arr)) {
 | 
                                                        |
| 1673 | -                    foreach ($option_values_arr as $option_row) {
 | 
                                                        |
| 1674 | -                        if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
 | 
                                                        |
| 1675 | - $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        |
| 1676 | -  | 
                                                        |
| 1677 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';  | 
                                                        |
| 1678 | -                        } else {
 | 
                                                        |
| 1679 | - $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        |
| 1680 | - $option_value = isset($option_row['value']) ? $option_row['value'] : '';  | 
                                                        |
| 1681 | - $selected = $option_value == $value ? 'selected="selected"' : '';  | 
                                                        |
| 1682 | -  | 
                                                        |
| 1683 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';  | 
                                                        |
| 1684 | - }  | 
                                                        |
| 1685 | - }  | 
                                                        |
| 1686 | - }  | 
                                                        |
| 1687 | - ?>  | 
                                                        |
| 1670 | + $option_values_arr = geodir_string_values_to_options($option_values, true);  | 
                                                        |
| 1671 | + $select_options = '';  | 
                                                        |
| 1672 | +				if (!empty($option_values_arr)) {
 | 
                                                        |
| 1673 | +					foreach ($option_values_arr as $option_row) {
 | 
                                                        |
| 1674 | +						if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
 | 
                                                        |
| 1675 | + $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        |
| 1676 | +  | 
                                                        |
| 1677 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';  | 
                                                        |
| 1678 | +						} else {
 | 
                                                        |
| 1679 | + $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        |
| 1680 | + $option_value = isset($option_row['value']) ? $option_row['value'] : '';  | 
                                                        |
| 1681 | + $selected = $option_value == $value ? 'selected="selected"' : '';  | 
                                                        |
| 1682 | +  | 
                                                        |
| 1683 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';  | 
                                                        |
| 1684 | + }  | 
                                                        |
| 1685 | + }  | 
                                                        |
| 1686 | + }  | 
                                                        |
| 1687 | + ?>  | 
                                                        |
| 1688 | 1688 | <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
| 1689 | 1689 | class="geodir_textfield textfield_x chosen_select"  | 
                                                        
| 1690 | 1690 |                          data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>"
 | 
                                                        
@@ -1696,17 +1696,17 @@ discard block  | 
                                                    ||
| 1696 | 1696 | </div>  | 
                                                        
| 1697 | 1697 | |
| 1698 | 1698 | <?php  | 
                                                        
| 1699 | -        } else if ($type == 'multiselect') {
 | 
                                                        |
| 1700 | - $multi_display = 'select';  | 
                                                        |
| 1701 | -            if (!empty($val['extra_fields'])) {
 | 
                                                        |
| 1702 | - $multi_display = unserialize($val['extra_fields']);  | 
                                                        |
| 1703 | - }  | 
                                                        |
| 1704 | - ?>  | 
                                                        |
| 1699 | +		} else if ($type == 'multiselect') {
 | 
                                                        |
| 1700 | + $multi_display = 'select';  | 
                                                        |
| 1701 | +			if (!empty($val['extra_fields'])) {
 | 
                                                        |
| 1702 | + $multi_display = unserialize($val['extra_fields']);  | 
                                                        |
| 1703 | + }  | 
                                                        |
| 1704 | + ?>  | 
                                                        |
| 1705 | 1705 | <div id="<?php echo $name; ?>_row"  | 
                                                        
| 1706 | 1706 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1707 | 1707 | <label>  | 
                                                        
| 1708 | 1708 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1709 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1709 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1710 | 1710 | <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        
| 1711 | 1711 | </label>  | 
                                                        
| 1712 | 1712 | <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/>  | 
                                                        
@@ -1717,55 +1717,55 @@ discard block  | 
                                                    ||
| 1717 | 1717 |                              data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
 | 
                                                        
| 1718 | 1718 | option-ajaxchosen="false">  | 
                                                        
| 1719 | 1719 | <?php  | 
                                                        
| 1720 | -                        } else {
 | 
                                                        |
| 1721 | - echo '<ul class="gd_multi_choice">';  | 
                                                        |
| 1722 | - }  | 
                                                        |
| 1723 | -  | 
                                                        |
| 1724 | - $option_values_arr = geodir_string_values_to_options($option_values, true);  | 
                                                        |
| 1725 | - $select_options = '';  | 
                                                        |
| 1726 | -                        if (!empty($option_values_arr)) {
 | 
                                                        |
| 1727 | -                            foreach ($option_values_arr as $option_row) {
 | 
                                                        |
| 1728 | -                                if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
 | 
                                                        |
| 1729 | - $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        |
| 1730 | -  | 
                                                        |
| 1731 | -                                    if ($multi_display == 'select') {
 | 
                                                        |
| 1732 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';  | 
                                                        |
| 1733 | -                                    } else {
 | 
                                                        |
| 1734 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';  | 
                                                        |
| 1735 | - }  | 
                                                        |
| 1736 | -                                } else {
 | 
                                                        |
| 1737 | - $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        |
| 1738 | - $option_value = isset($option_row['value']) ? $option_row['value'] : '';  | 
                                                        |
| 1739 | - $selected = $option_value == $value ? 'selected="selected"' : '';  | 
                                                        |
| 1740 | - $selected = '';  | 
                                                        |
| 1741 | - $checked = '';  | 
                                                        |
| 1742 | -  | 
                                                        |
| 1743 | -                                    if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
 | 
                                                        |
| 1744 | -                                        if (!is_array($value)) {
 | 
                                                        |
| 1745 | -                                            $value_array = explode(',', $value);
 | 
                                                        |
| 1746 | -                                        } else {
 | 
                                                        |
| 1747 | - $value_array = $value;  | 
                                                        |
| 1748 | - }  | 
                                                        |
| 1749 | -  | 
                                                        |
| 1750 | -                                        if (is_array($value_array)) {
 | 
                                                        |
| 1751 | -                                            if (in_array($option_value, $value_array)) {
 | 
                                                        |
| 1752 | - $selected = 'selected="selected"';  | 
                                                        |
| 1753 | - $checked = 'checked="checked"';  | 
                                                        |
| 1754 | - }  | 
                                                        |
| 1755 | - }  | 
                                                        |
| 1756 | - }  | 
                                                        |
| 1757 | -  | 
                                                        |
| 1758 | -                                    if ($multi_display == 'select') {
 | 
                                                        |
| 1759 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';  | 
                                                        |
| 1760 | -                                    } else {
 | 
                                                        |
| 1761 | - $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>';  | 
                                                        |
| 1762 | - }  | 
                                                        |
| 1763 | - }  | 
                                                        |
| 1764 | - }  | 
                                                        |
| 1765 | - }  | 
                                                        |
| 1766 | - echo $select_options;  | 
                                                        |
| 1767 | -  | 
                                                        |
| 1768 | -                        if ($multi_display == 'select') { ?></select></div>
 | 
                                                        |
| 1720 | +						} else {
 | 
                                                        |
| 1721 | + echo '<ul class="gd_multi_choice">';  | 
                                                        |
| 1722 | + }  | 
                                                        |
| 1723 | +  | 
                                                        |
| 1724 | + $option_values_arr = geodir_string_values_to_options($option_values, true);  | 
                                                        |
| 1725 | + $select_options = '';  | 
                                                        |
| 1726 | +						if (!empty($option_values_arr)) {
 | 
                                                        |
| 1727 | +							foreach ($option_values_arr as $option_row) {
 | 
                                                        |
| 1728 | +								if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
 | 
                                                        |
| 1729 | + $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        |
| 1730 | +  | 
                                                        |
| 1731 | +									if ($multi_display == 'select') {
 | 
                                                        |
| 1732 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';  | 
                                                        |
| 1733 | +									} else {
 | 
                                                        |
| 1734 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';  | 
                                                        |
| 1735 | + }  | 
                                                        |
| 1736 | +								} else {
 | 
                                                        |
| 1737 | + $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        |
| 1738 | + $option_value = isset($option_row['value']) ? $option_row['value'] : '';  | 
                                                        |
| 1739 | + $selected = $option_value == $value ? 'selected="selected"' : '';  | 
                                                        |
| 1740 | + $selected = '';  | 
                                                        |
| 1741 | + $checked = '';  | 
                                                        |
| 1742 | +  | 
                                                        |
| 1743 | +									if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
 | 
                                                        |
| 1744 | +										if (!is_array($value)) {
 | 
                                                        |
| 1745 | +											$value_array = explode(',', $value);
 | 
                                                        |
| 1746 | +										} else {
 | 
                                                        |
| 1747 | + $value_array = $value;  | 
                                                        |
| 1748 | + }  | 
                                                        |
| 1749 | +  | 
                                                        |
| 1750 | +										if (is_array($value_array)) {
 | 
                                                        |
| 1751 | +											if (in_array($option_value, $value_array)) {
 | 
                                                        |
| 1752 | + $selected = 'selected="selected"';  | 
                                                        |
| 1753 | + $checked = 'checked="checked"';  | 
                                                        |
| 1754 | + }  | 
                                                        |
| 1755 | + }  | 
                                                        |
| 1756 | + }  | 
                                                        |
| 1757 | +  | 
                                                        |
| 1758 | +									if ($multi_display == 'select') {
 | 
                                                        |
| 1759 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';  | 
                                                        |
| 1760 | +									} else {
 | 
                                                        |
| 1761 | + $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>';  | 
                                                        |
| 1762 | + }  | 
                                                        |
| 1763 | + }  | 
                                                        |
| 1764 | + }  | 
                                                        |
| 1765 | + }  | 
                                                        |
| 1766 | + echo $select_options;  | 
                                                        |
| 1767 | +  | 
                                                        |
| 1768 | +						if ($multi_display == 'select') { ?></select></div>
 | 
                                                        |
| 1769 | 1769 |              <?php } else { ?></ul><?php } ?>
 | 
                                                        
| 1770 | 1770 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        
| 1771 | 1771 |                  <?php if ($is_required) { ?>
 | 
                                                        
@@ -1773,14 +1773,14 @@ discard block  | 
                                                    ||
| 1773 | 1773 | <?php } ?>  | 
                                                        
| 1774 | 1774 | </div>  | 
                                                        
| 1775 | 1775 | <?php  | 
                                                        
| 1776 | -        } else if ($type == 'html') {
 | 
                                                        |
| 1777 | - ?>  | 
                                                        |
| 1776 | +		} else if ($type == 'html') {
 | 
                                                        |
| 1777 | + ?>  | 
                                                        |
| 1778 | 1778 | |
| 1779 | 1779 | <div id="<?php echo $name; ?>_row"  | 
                                                        
| 1780 | 1780 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1781 | 1781 | <label>  | 
                                                        
| 1782 | 1782 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1783 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1783 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1784 | 1784 | <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        
| 1785 | 1785 | </label>  | 
                                                        
| 1786 | 1786 | |
@@ -1798,44 +1798,44 @@ discard block  | 
                                                    ||
| 1798 | 1798 | </div>  | 
                                                        
| 1799 | 1799 |          <?php } elseif ($type == 'datepicker') {
 | 
                                                        
| 1800 | 1800 | |
| 1801 | - if ($extra_fields['date_format'] == '')  | 
                                                        |
| 1802 | - $extra_fields['date_format'] = 'yy-mm-dd';  | 
                                                        |
| 1801 | + if ($extra_fields['date_format'] == '')  | 
                                                        |
| 1802 | + $extra_fields['date_format'] = 'yy-mm-dd';  | 
                                                        |
| 1803 | 1803 | |
| 1804 | - $date_format = $extra_fields['date_format'];  | 
                                                        |
| 1805 | - $jquery_date_format = $date_format;  | 
                                                        |
| 1804 | + $date_format = $extra_fields['date_format'];  | 
                                                        |
| 1805 | + $jquery_date_format = $date_format;  | 
                                                        |
| 1806 | 1806 | |
| 1807 | 1807 | |
| 1808 | - // check if we need to change the format or not  | 
                                                        |
| 1809 | -            $date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        |
| 1810 | -            if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 1808 | + // check if we need to change the format or not  | 
                                                        |
| 1809 | +			$date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        |
| 1810 | +			if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 1811 | 1811 | |
| 1812 | -                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 1813 | -                $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 1812 | +				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 1813 | +				$replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 1814 | 1814 | |
| 1815 | - $date_format = str_replace($search, $replace, $date_format);  | 
                                                        |
| 1816 | -            }else{
 | 
                                                        |
| 1817 | - $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );  | 
                                                        |
| 1818 | - }  | 
                                                        |
| 1815 | + $date_format = str_replace($search, $replace, $date_format);  | 
                                                        |
| 1816 | +			}else{
 | 
                                                        |
| 1817 | + $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );  | 
                                                        |
| 1818 | + }  | 
                                                        |
| 1819 | 1819 | |
| 1820 | -            if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
 | 
                                                        |
| 1821 | -            if($value && !isset($_REQUEST['backandedit'])) {
 | 
                                                        |
| 1822 | - $time = strtotime($value);  | 
                                                        |
| 1823 | - $value = date_i18n($date_format, $time);  | 
                                                        |
| 1824 | - }  | 
                                                        |
| 1820 | +			if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
 | 
                                                        |
| 1821 | +			if($value && !isset($_REQUEST['backandedit'])) {
 | 
                                                        |
| 1822 | + $time = strtotime($value);  | 
                                                        |
| 1823 | + $value = date_i18n($date_format, $time);  | 
                                                        |
| 1824 | + }  | 
                                                        |
| 1825 | 1825 | |
| 1826 | - ?>  | 
                                                        |
| 1826 | + ?>  | 
                                                        |
| 1827 | 1827 | <script type="text/javascript">  | 
                                                        
| 1828 | 1828 | |
| 1829 | 1829 |                  jQuery(function () {
 | 
                                                        
| 1830 | 1830 | |
| 1831 | 1831 |                      jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
 | 
                                                        
| 1832 | - /**  | 
                                                        |
| 1833 | - * Used to add extra option to datepicker per custom field.  | 
                                                        |
| 1834 | - *  | 
                                                        |
| 1835 | - * @since 1.5.7  | 
                                                        |
| 1836 | - * @param string $name The custom field name.  | 
                                                        |
| 1837 | - */  | 
                                                        |
| 1838 | -                        echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
 | 
                                                        |
| 1832 | + /**  | 
                                                        |
| 1833 | + * Used to add extra option to datepicker per custom field.  | 
                                                        |
| 1834 | + *  | 
                                                        |
| 1835 | + * @since 1.5.7  | 
                                                        |
| 1836 | + * @param string $name The custom field name.  | 
                                                        |
| 1837 | + */  | 
                                                        |
| 1838 | +						echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
 | 
                                                        |
| 1839 | 1839 | |
| 1840 | 1840 |                      jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
 | 
                                                        
| 1841 | 1841 | |
@@ -1851,7 +1851,7 @@ discard block  | 
                                                    ||
| 1851 | 1851 | <label>  | 
                                                        
| 1852 | 1852 | |
| 1853 | 1853 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1854 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1854 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1855 | 1855 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1856 | 1856 | </label>  | 
                                                        
| 1857 | 1857 | |
@@ -1866,9 +1866,9 @@ discard block  | 
                                                    ||
| 1866 | 1866 | |
| 1867 | 1867 |          <?php } elseif ($type == 'time') {
 | 
                                                        
| 1868 | 1868 | |
| 1869 | - if ($value != '')  | 
                                                        |
| 1870 | -                $value = date('H:i', strtotime($value));
 | 
                                                        |
| 1871 | - ?>  | 
                                                        |
| 1869 | + if ($value != '')  | 
                                                        |
| 1870 | +				$value = date('H:i', strtotime($value));
 | 
                                                        |
| 1871 | + ?>  | 
                                                        |
| 1872 | 1872 | <script type="text/javascript">  | 
                                                        
| 1873 | 1873 |                  jQuery(document).ready(function () {
 | 
                                                        
| 1874 | 1874 | |
@@ -1884,7 +1884,7 @@ discard block  | 
                                                    ||
| 1884 | 1884 | <label>  | 
                                                        
| 1885 | 1885 | |
| 1886 | 1886 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1887 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1887 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1888 | 1888 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1889 | 1889 | </label>  | 
                                                        
| 1890 | 1890 | <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"  | 
                                                        
@@ -1897,110 +1897,110 @@ discard block  | 
                                                    ||
| 1897 | 1897 | </div>  | 
                                                        
| 1898 | 1898 | |
| 1899 | 1899 |          <?php } elseif ($type == 'taxonomy') {
 | 
                                                        
| 1900 | -            if ($value == $val['default']) {
 | 
                                                        |
| 1901 | - $value = '';  | 
                                                        |
| 1902 | - } ?>  | 
                                                        |
| 1900 | +			if ($value == $val['default']) {
 | 
                                                        |
| 1901 | + $value = '';  | 
                                                        |
| 1902 | + } ?>  | 
                                                        |
| 1903 | 1903 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1904 | 1904 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
| 1905 | 1905 | <label>  | 
                                                        
| 1906 | 1906 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1907 | - echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1907 | + echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        |
| 1908 | 1908 | <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        
| 1909 | 1909 | </label>  | 
                                                        
| 1910 | 1910 | |
| 1911 | 1911 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">  | 
                                                        
| 1912 | 1912 | <?php  | 
                                                        
| 1913 | - global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;  | 
                                                        |
| 1913 | + global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;  | 
                                                        |
| 1914 | 1914 | |
| 1915 | - $exclude_cats = array();  | 
                                                        |
| 1915 | + $exclude_cats = array();  | 
                                                        |
| 1916 | 1916 | |
| 1917 | -                    if ($is_admin == '1') {
 | 
                                                        |
| 1917 | +					if ($is_admin == '1') {
 | 
                                                        |
| 1918 | 1918 | |
| 1919 | - $post_type = get_post_type();  | 
                                                        |
| 1919 | + $post_type = get_post_type();  | 
                                                        |
| 1920 | 1920 | |
| 1921 | - $package_info = array();  | 
                                                        |
| 1921 | + $package_info = array();  | 
                                                        |
| 1922 | 1922 | |
| 1923 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);  | 
                                                        |
| 1923 | + $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);  | 
                                                        |
| 1924 | 1924 | |
| 1925 | -                        if (!empty($package_info)) {
 | 
                                                        |
| 1925 | +						if (!empty($package_info)) {
 | 
                                                        |
| 1926 | 1926 | |
| 1927 | -                            if (isset($package_info['cat']) && $package_info['cat'] != '') {
 | 
                                                        |
| 1927 | +							if (isset($package_info['cat']) && $package_info['cat'] != '') {
 | 
                                                        |
| 1928 | 1928 | |
| 1929 | -                                $exclude_cats = explode(',', $package_info['cat']);
 | 
                                                        |
| 1929 | +								$exclude_cats = explode(',', $package_info['cat']);
 | 
                                                        |
| 1930 | 1930 | |
| 1931 | - }  | 
                                                        |
| 1932 | - }  | 
                                                        |
| 1933 | - }  | 
                                                        |
| 1931 | + }  | 
                                                        |
| 1932 | + }  | 
                                                        |
| 1933 | + }  | 
                                                        |
| 1934 | 1934 | |
| 1935 | - $cat_display = unserialize($val['extra_fields']);  | 
                                                        |
| 1935 | + $cat_display = unserialize($val['extra_fields']);  | 
                                                        |
| 1936 | 1936 | |
| 1937 | -                    if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
 | 
                                                        |
| 1937 | +					if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
 | 
                                                        |
| 1938 | 1938 | |
| 1939 | -                        $post_cat = implode(",", $post_cat[$name]);
 | 
                                                        |
| 1939 | +						$post_cat = implode(",", $post_cat[$name]);
 | 
                                                        |
| 1940 | 1940 | |
| 1941 | -                    } else {
 | 
                                                        |
| 1942 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')  | 
                                                        |
| 1943 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);  | 
                                                        |
| 1944 | - }  | 
                                                        |
| 1941 | +					} else {
 | 
                                                        |
| 1942 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')  | 
                                                        |
| 1943 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);  | 
                                                        |
| 1944 | + }  | 
                                                        |
| 1945 | 1945 | |
| 1946 | 1946 | |
| 1947 | - global $geodir_addon_list;  | 
                                                        |
| 1948 | -                    if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
 | 
                                                        |
| 1947 | + global $geodir_addon_list;  | 
                                                        |
| 1948 | +					if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
 | 
                                                        |
| 1949 | 1949 | |
| 1950 | - $catadd_limit = $wpdb->get_var(  | 
                                                        |
| 1951 | - $wpdb->prepare(  | 
                                                        |
| 1952 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",  | 
                                                        |
| 1953 | - array($package_id)  | 
                                                        |
| 1954 | - )  | 
                                                        |
| 1955 | - );  | 
                                                        |
| 1950 | + $catadd_limit = $wpdb->get_var(  | 
                                                        |
| 1951 | + $wpdb->prepare(  | 
                                                        |
| 1952 | + "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",  | 
                                                        |
| 1953 | + array($package_id)  | 
                                                        |
| 1954 | + )  | 
                                                        |
| 1955 | + );  | 
                                                        |
| 1956 | 1956 | |
| 1957 | 1957 | |
| 1958 | -                    } else {
 | 
                                                        |
| 1959 | - $catadd_limit = 0;  | 
                                                        |
| 1960 | - }  | 
                                                        |
| 1958 | +					} else {
 | 
                                                        |
| 1959 | + $catadd_limit = 0;  | 
                                                        |
| 1960 | + }  | 
                                                        |
| 1961 | 1961 | |
| 1962 | 1962 | |
| 1963 | -                    if ($cat_display != '' && $cat_display != 'ajax_chained') {
 | 
                                                        |
| 1963 | +					if ($cat_display != '' && $cat_display != 'ajax_chained') {
 | 
                                                        |
| 1964 | 1964 | |
| 1965 | - $required_limit_msg = '';  | 
                                                        |
| 1966 | -                        if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
 | 
                                                        |
| 1965 | + $required_limit_msg = '';  | 
                                                        |
| 1966 | +						if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
 | 
                                                        |
| 1967 | 1967 | |
| 1968 | -                            $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
 | 
                                                        |
| 1968 | +							$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
 | 
                                                        |
| 1969 | 1969 | |
| 1970 | -                        } else {
 | 
                                                        |
| 1971 | - $required_limit_msg = $required_msg;  | 
                                                        |
| 1972 | - }  | 
                                                        |
| 1970 | +						} else {
 | 
                                                        |
| 1971 | + $required_limit_msg = $required_msg;  | 
                                                        |
| 1972 | + }  | 
                                                        |
| 1973 | 1973 | |
| 1974 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />';  | 
                                                        |
| 1974 | + echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />';  | 
                                                        |
| 1975 | 1975 | |
| 1976 | 1976 | |
| 1977 | -                        if ($cat_display == 'select' || $cat_display == 'multiselect') {
 | 
                                                        |
| 1977 | +						if ($cat_display == 'select' || $cat_display == 'multiselect') {
 | 
                                                        |
| 1978 | 1978 | |
| 1979 | - $cat_display == '';  | 
                                                        |
| 1980 | - $multiple = '';  | 
                                                        |
| 1981 | - if ($cat_display == 'multiselect')  | 
                                                        |
| 1982 | - $multiple = 'multiple="multiple"';  | 
                                                        |
| 1979 | + $cat_display == '';  | 
                                                        |
| 1980 | + $multiple = '';  | 
                                                        |
| 1981 | + if ($cat_display == 'multiselect')  | 
                                                        |
| 1982 | + $multiple = 'multiple="multiple"';  | 
                                                        |
| 1983 | 1983 | |
| 1984 | -                            echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
 | 
                                                        |
| 1984 | +							echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
 | 
                                                        |
| 1985 | 1985 | |
| 1986 | 1986 | |
| 1987 | - if ($cat_display == 'select')  | 
                                                        |
| 1988 | -                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
 | 
                                                        |
| 1987 | + if ($cat_display == 'select')  | 
                                                        |
| 1988 | +								echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
 | 
                                                        |
| 1989 | 1989 | |
| 1990 | - }  | 
                                                        |
| 1990 | + }  | 
                                                        |
| 1991 | 1991 | |
| 1992 | - echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);  | 
                                                        |
| 1992 | + echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);  | 
                                                        |
| 1993 | 1993 | |
| 1994 | - if ($cat_display == 'select' || $cat_display == 'multiselect')  | 
                                                        |
| 1995 | - echo '</select>';  | 
                                                        |
| 1994 | + if ($cat_display == 'select' || $cat_display == 'multiselect')  | 
                                                        |
| 1995 | + echo '</select>';  | 
                                                        |
| 1996 | 1996 | |
| 1997 | -                    } else {
 | 
                                                        |
| 1997 | +					} else {
 | 
                                                        |
| 1998 | 1998 | |
| 1999 | - echo geodir_custom_taxonomy_walker2($name, $catadd_limit);  | 
                                                        |
| 1999 | + echo geodir_custom_taxonomy_walker2($name, $catadd_limit);  | 
                                                        |
| 2000 | 2000 | |
| 2001 | - }  | 
                                                        |
| 2001 | + }  | 
                                                        |
| 2002 | 2002 | |
| 2003 | - ?>  | 
                                                        |
| 2003 | + ?>  | 
                                                        |
| 2004 | 2004 | </div>  | 
                                                        
| 2005 | 2005 | |
| 2006 | 2006 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        
@@ -2015,46 +2015,46 @@ discard block  | 
                                                    ||
| 2015 | 2015 | |
| 2016 | 2016 | |
| 2017 | 2017 | |
| 2018 | - // adjust values here  | 
                                                        |
| 2019 | - $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls  | 
                                                        |
| 2018 | + // adjust values here  | 
                                                        |
| 2019 | + $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls  | 
                                                        |
| 2020 | 2020 | |
| 2021 | -            if ($value != '') {
 | 
                                                        |
| 2021 | +			if ($value != '') {
 | 
                                                        |
| 2022 | 2022 | |
| 2023 | - $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.  | 
                                                        |
| 2023 | + $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.  | 
                                                        |
| 2024 | 2024 | |
| 2025 | - } else  | 
                                                        |
| 2026 | - $file_value = '';  | 
                                                        |
| 2025 | + } else  | 
                                                        |
| 2026 | + $file_value = '';  | 
                                                        |
| 2027 | 2027 | |
| 2028 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])  | 
                                                        |
| 2029 | - $file_multiple = true; // allow multiple files upload  | 
                                                        |
| 2030 | - else  | 
                                                        |
| 2031 | - $file_multiple = false;  | 
                                                        |
| 2028 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])  | 
                                                        |
| 2029 | + $file_multiple = true; // allow multiple files upload  | 
                                                        |
| 2030 | + else  | 
                                                        |
| 2031 | + $file_multiple = false;  | 
                                                        |
| 2032 | 2032 | |
| 2033 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])  | 
                                                        |
| 2034 | - $file_image_limit = $extra_fields['image_limit'];  | 
                                                        |
| 2035 | - else  | 
                                                        |
| 2036 | - $file_image_limit = 1;  | 
                                                        |
| 2033 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])  | 
                                                        |
| 2034 | + $file_image_limit = $extra_fields['image_limit'];  | 
                                                        |
| 2035 | + else  | 
                                                        |
| 2036 | + $file_image_limit = 1;  | 
                                                        |
| 2037 | 2037 | |
| 2038 | - $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)  | 
                                                        |
| 2038 | + $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)  | 
                                                        |
| 2039 | 2039 | |
| 2040 | - $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)  | 
                                                        |
| 2040 | + $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)  | 
                                                        |
| 2041 | 2041 | |
| 2042 | -            if (!empty($file_value)) {
 | 
                                                        |
| 2043 | -                $curImages = explode(',', $file_value);
 | 
                                                        |
| 2044 | - if (!empty($curImages))  | 
                                                        |
| 2045 | - $file_totImg = count($curImages);  | 
                                                        |
| 2046 | - }  | 
                                                        |
| 2042 | +			if (!empty($file_value)) {
 | 
                                                        |
| 2043 | +				$curImages = explode(',', $file_value);
 | 
                                                        |
| 2044 | + if (!empty($curImages))  | 
                                                        |
| 2045 | + $file_totImg = count($curImages);  | 
                                                        |
| 2046 | + }  | 
                                                        |
| 2047 | 2047 | |
| 2048 | -            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
 | 
                                                        |
| 2049 | -            $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
 | 
                                                        |
| 2048 | +			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
 | 
                                                        |
| 2049 | +			$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
 | 
                                                        |
| 2050 | 2050 | |
| 2051 | - ?>  | 
                                                        |
| 2051 | + ?>  | 
                                                        |
| 2052 | 2052 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>  | 
                                                        
| 2053 | 2053 |  				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
 | 
                                                        
| 2054 | 2054 |  				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
 | 
                                                        
| 2055 | 2055 |  				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
 | 
                                                        
| 2056 | 2056 | </h5> <?php */  | 
                                                        
| 2057 | - ?>  | 
                                                        |
| 2057 | + ?>  | 
                                                        |
| 2058 | 2058 | |
| 2059 | 2059 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 2060 | 2060 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        
@@ -2062,7 +2062,7 @@ discard block  | 
                                                    ||
| 2062 | 2062 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">  | 
                                                        
| 2063 | 2063 | <label  | 
                                                        
| 2064 | 2064 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 2065 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>  | 
                                                        |
| 2065 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>  | 
                                                        |
| 2066 | 2066 | <input class="geodir-custom-file-upload" field_type="file" type="hidden"  | 
                                                        
| 2067 | 2067 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"  | 
                                                        
| 2068 | 2068 | value="<?php echo esc_attr($file_value); ?>"/>  | 
                                                        
@@ -2074,17 +2074,17 @@ discard block  | 
                                                    ||
| 2074 | 2074 | <?php } ?>  | 
                                                        
| 2075 | 2075 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"  | 
                                                        
| 2076 | 2076 |                             value="<?php if (isset($file_totImg)) {
 | 
                                                        
| 2077 | - echo esc_attr($file_totImg);  | 
                                                        |
| 2078 | -                           } else {
 | 
                                                        |
| 2079 | - echo '0';  | 
                                                        |
| 2080 | - } ?>"/>  | 
                                                        |
| 2077 | + echo esc_attr($file_totImg);  | 
                                                        |
| 2078 | +						   } else {
 | 
                                                        |
| 2079 | + echo '0';  | 
                                                        |
| 2080 | + } ?>"/>  | 
                                                        |
| 2081 | 2081 | |
| 2082 | 2082 | <div style="float:left; width:55%;">  | 
                                                        
| 2083 | 2083 | <div  | 
                                                        
| 2084 | 2084 | class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"  | 
                                                        
| 2085 | 2085 | id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">  | 
                                                        
| 2086 | 2086 |                              <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
 | 
                                                        
| 2087 | - ?>  | 
                                                        |
| 2087 | + ?>  | 
                                                        |
| 2088 | 2088 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"  | 
                                                        
| 2089 | 2089 |                                     value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
 | 
                                                        
| 2090 | 2090 | class="geodir_button" style="margin-top:10px;"/>  | 
                                                        
@@ -2103,7 +2103,7 @@ discard block  | 
                                                    ||
| 2103 | 2103 | style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">  | 
                                                        
| 2104 | 2104 | </div>  | 
                                                        
| 2105 | 2105 |                          <?php /*?><span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span><?php */
 | 
                                                        
| 2106 | - ?>  | 
                                                        |
| 2106 | + ?>  | 
                                                        |
| 2107 | 2107 | |
| 2108 | 2108 | <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>  | 
                                                        
| 2109 | 2109 | |
@@ -2117,178 +2117,178 @@ discard block  | 
                                                    ||
| 2117 | 2117 | |
| 2118 | 2118 | |
| 2119 | 2119 | <?php }  | 
                                                        
| 2120 | - /**  | 
                                                        |
| 2121 | - * Called after the custom fields info is output for submitting a post.  | 
                                                        |
| 2122 | - *  | 
                                                        |
| 2123 | - * Used dynamic hook type geodir_after_custom_form_field_$name.  | 
                                                        |
| 2124 | - *  | 
                                                        |
| 2125 | - * @since 1.0.0  | 
                                                        |
| 2126 | - * @param string $listing_type The post post type.  | 
                                                        |
| 2127 | - * @param int $package_id The price package ID for the post.  | 
                                                        |
| 2128 | -         * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
 | 
                                                        |
| 2129 | - * @see 'geodir_before_custom_form_field_$name'  | 
                                                        |
| 2130 | - */  | 
                                                        |
| 2131 | -        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
 | 
                                                        |
| 2132 | -  | 
                                                        |
| 2133 | - }  | 
                                                        |
| 2120 | + /**  | 
                                                        |
| 2121 | + * Called after the custom fields info is output for submitting a post.  | 
                                                        |
| 2122 | + *  | 
                                                        |
| 2123 | + * Used dynamic hook type geodir_after_custom_form_field_$name.  | 
                                                        |
| 2124 | + *  | 
                                                        |
| 2125 | + * @since 1.0.0  | 
                                                        |
| 2126 | + * @param string $listing_type The post post type.  | 
                                                        |
| 2127 | + * @param int $package_id The price package ID for the post.  | 
                                                        |
| 2128 | +		 * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
 | 
                                                        |
| 2129 | + * @see 'geodir_before_custom_form_field_$name'  | 
                                                        |
| 2130 | + */  | 
                                                        |
| 2131 | +		do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
 | 
                                                        |
| 2132 | +  | 
                                                        |
| 2133 | + }  | 
                                                        |
| 2134 | 2134 | |
| 2135 | 2135 | }  | 
                                                        
| 2136 | 2136 | |
| 2137 | 2137 | |
| 2138 | 2138 |  if (!function_exists('geodir_get_field_infoby')) {
 | 
                                                        
| 2139 | - /**  | 
                                                        |
| 2140 | - * Get custom field using key and value.  | 
                                                        |
| 2141 | - *  | 
                                                        |
| 2142 | - * @since 1.0.0  | 
                                                        |
| 2143 | - * @package GeoDirectory  | 
                                                        |
| 2144 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2145 | - * @param string $key The key you want to look for.  | 
                                                        |
| 2146 | - * @param string $value The value of the key you want to look for.  | 
                                                        |
| 2147 | - * @param string $geodir_post_type The post type.  | 
                                                        |
| 2148 | - * @return bool|mixed Returns field info when available. otherwise returns false.  | 
                                                        |
| 2149 | - */  | 
                                                        |
| 2150 | - function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')  | 
                                                        |
| 2151 | -    {
 | 
                                                        |
| 2152 | -  | 
                                                        |
| 2153 | - global $wpdb;  | 
                                                        |
| 2154 | -  | 
                                                        |
| 2155 | - $filter = $wpdb->get_row(  | 
                                                        |
| 2156 | - $wpdb->prepare(  | 
                                                        |
| 2157 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",  | 
                                                        |
| 2158 | - array($geodir_post_type)  | 
                                                        |
| 2159 | - )  | 
                                                        |
| 2160 | - );  | 
                                                        |
| 2161 | -  | 
                                                        |
| 2162 | -        if ($filter) {
 | 
                                                        |
| 2163 | - return $filter;  | 
                                                        |
| 2164 | -        } else {
 | 
                                                        |
| 2165 | - return false;  | 
                                                        |
| 2166 | - }  | 
                                                        |
| 2167 | -  | 
                                                        |
| 2168 | - }  | 
                                                        |
| 2139 | + /**  | 
                                                        |
| 2140 | + * Get custom field using key and value.  | 
                                                        |
| 2141 | + *  | 
                                                        |
| 2142 | + * @since 1.0.0  | 
                                                        |
| 2143 | + * @package GeoDirectory  | 
                                                        |
| 2144 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2145 | + * @param string $key The key you want to look for.  | 
                                                        |
| 2146 | + * @param string $value The value of the key you want to look for.  | 
                                                        |
| 2147 | + * @param string $geodir_post_type The post type.  | 
                                                        |
| 2148 | + * @return bool|mixed Returns field info when available. otherwise returns false.  | 
                                                        |
| 2149 | + */  | 
                                                        |
| 2150 | + function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')  | 
                                                        |
| 2151 | +	{
 | 
                                                        |
| 2152 | +  | 
                                                        |
| 2153 | + global $wpdb;  | 
                                                        |
| 2154 | +  | 
                                                        |
| 2155 | + $filter = $wpdb->get_row(  | 
                                                        |
| 2156 | + $wpdb->prepare(  | 
                                                        |
| 2157 | + "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",  | 
                                                        |
| 2158 | + array($geodir_post_type)  | 
                                                        |
| 2159 | + )  | 
                                                        |
| 2160 | + );  | 
                                                        |
| 2161 | +  | 
                                                        |
| 2162 | +		if ($filter) {
 | 
                                                        |
| 2163 | + return $filter;  | 
                                                        |
| 2164 | +		} else {
 | 
                                                        |
| 2165 | + return false;  | 
                                                        |
| 2166 | + }  | 
                                                        |
| 2167 | +  | 
                                                        |
| 2168 | + }  | 
                                                        |
| 2169 | 2169 | }  | 
                                                        
| 2170 | 2170 | |
| 2171 | 2171 | |
| 2172 | 2172 |  if (!function_exists('geodir_show_listing_info')) {
 | 
                                                        
| 2173 | - /**  | 
                                                        |
| 2174 | - * Show listing info depending on field location.  | 
                                                        |
| 2175 | - *  | 
                                                        |
| 2176 | - * @since 1.0.0  | 
                                                        |
| 2177 | - * @since 1.5.7 Custom fields option values added to db translation.  | 
                                                        |
| 2178 | - * Changes to display url fields title.  | 
                                                        |
| 2179 | - * @package GeoDirectory  | 
                                                        |
| 2180 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2181 | - * @global object $post The current post object.  | 
                                                        |
| 2182 | - * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.  | 
                                                        |
| 2183 | - *  | 
                                                        |
| 2184 | - * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.  | 
                                                        |
| 2185 | - * @return string Returns listing info html.  | 
                                                        |
| 2186 | - */  | 
                                                        |
| 2187 | -    function geodir_show_listing_info($fields_location = '') {
 | 
                                                        |
| 2188 | - global $post, $preview, $wpdb, $send_to_friend;  | 
                                                        |
| 2189 | -  | 
                                                        |
| 2190 | - $payment_info = array();  | 
                                                        |
| 2191 | - $package_info = array();  | 
                                                        |
| 2192 | -  | 
                                                        |
| 2193 | - $package_info = geodir_post_package_info($package_info, $post);  | 
                                                        |
| 2194 | - $post_package_id = $package_info->pid;  | 
                                                        |
| 2195 | - $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type;  | 
                                                        |
| 2196 | - $send_to_friend = false;  | 
                                                        |
| 2197 | -  | 
                                                        |
| 2198 | - ob_start();  | 
                                                        |
| 2199 | - $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location);  | 
                                                        |
| 2200 | -  | 
                                                        |
| 2201 | -        if (!empty($fields_info)) {
 | 
                                                        |
| 2202 | - $post = stripslashes_deep($post); // strip slashes  | 
                                                        |
| 2173 | + /**  | 
                                                        |
| 2174 | + * Show listing info depending on field location.  | 
                                                        |
| 2175 | + *  | 
                                                        |
| 2176 | + * @since 1.0.0  | 
                                                        |
| 2177 | + * @since 1.5.7 Custom fields option values added to db translation.  | 
                                                        |
| 2178 | + * Changes to display url fields title.  | 
                                                        |
| 2179 | + * @package GeoDirectory  | 
                                                        |
| 2180 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2181 | + * @global object $post The current post object.  | 
                                                        |
| 2182 | + * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.  | 
                                                        |
| 2183 | + *  | 
                                                        |
| 2184 | + * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.  | 
                                                        |
| 2185 | + * @return string Returns listing info html.  | 
                                                        |
| 2186 | + */  | 
                                                        |
| 2187 | +	function geodir_show_listing_info($fields_location = '') {
 | 
                                                        |
| 2188 | + global $post, $preview, $wpdb, $send_to_friend;  | 
                                                        |
| 2189 | +  | 
                                                        |
| 2190 | + $payment_info = array();  | 
                                                        |
| 2191 | + $package_info = array();  | 
                                                        |
| 2192 | +  | 
                                                        |
| 2193 | + $package_info = geodir_post_package_info($package_info, $post);  | 
                                                        |
| 2194 | + $post_package_id = $package_info->pid;  | 
                                                        |
| 2195 | + $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type;  | 
                                                        |
| 2196 | + $send_to_friend = false;  | 
                                                        |
| 2197 | +  | 
                                                        |
| 2198 | + ob_start();  | 
                                                        |
| 2199 | + $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location);  | 
                                                        |
| 2200 | +  | 
                                                        |
| 2201 | +		if (!empty($fields_info)) {
 | 
                                                        |
| 2202 | + $post = stripslashes_deep($post); // strip slashes  | 
                                                        |
| 2203 | 2203 | |
| 2204 | - //echo '<div class="geodir-company_info field-group">';  | 
                                                        |
| 2205 | - $field_set_start = 0;  | 
                                                        |
| 2204 | + //echo '<div class="geodir-company_info field-group">';  | 
                                                        |
| 2205 | + $field_set_start = 0;  | 
                                                        |
| 2206 | 2206 | |
| 2207 | 2207 | |
| 2208 | - if ($fields_location == 'detail')  | 
                                                        |
| 2208 | + if ($fields_location == 'detail')  | 
                                                        |
| 2209 | 2209 | |
| 2210 | - $i = 1;  | 
                                                        |
| 2211 | -            foreach ($fields_info as $type) {
 | 
                                                        |
| 2212 | - $type = stripslashes_deep($type); // strip slashes  | 
                                                        |
| 2213 | - $html = '';  | 
                                                        |
| 2214 | - $html_var = '';  | 
                                                        |
| 2215 | - $field_icon = '';  | 
                                                        |
| 2210 | + $i = 1;  | 
                                                        |
| 2211 | +			foreach ($fields_info as $type) {
 | 
                                                        |
| 2212 | + $type = stripslashes_deep($type); // strip slashes  | 
                                                        |
| 2213 | + $html = '';  | 
                                                        |
| 2214 | + $html_var = '';  | 
                                                        |
| 2215 | + $field_icon = '';  | 
                                                        |
| 2216 | 2216 | |
| 2217 | - $variables_array = array();  | 
                                                        |
| 2217 | + $variables_array = array();  | 
                                                        |
| 2218 | 2218 | |
| 2219 | -                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
 | 
                                                        |
| 2220 | - continue;  | 
                                                        |
| 2221 | - }  | 
                                                        |
| 2219 | +				if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
 | 
                                                        |
| 2220 | + continue;  | 
                                                        |
| 2221 | + }  | 
                                                        |
| 2222 | 2222 | |
| 2223 | - if ($type['type'] != 'fieldset'):  | 
                                                        |
| 2224 | - $variables_array['post_id'] = $post->ID;  | 
                                                        |
| 2225 | - $variables_array['label'] = __($type['site_title'], 'geodirectory');  | 
                                                        |
| 2226 | - $variables_array['value'] = '';  | 
                                                        |
| 2227 | -                    if (isset($post->{$type['htmlvar_name']}))
 | 
                                                        |
| 2228 | -                        $variables_array['value'] = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2229 | - endif;  | 
                                                        |
| 2223 | + if ($type['type'] != 'fieldset'):  | 
                                                        |
| 2224 | + $variables_array['post_id'] = $post->ID;  | 
                                                        |
| 2225 | + $variables_array['label'] = __($type['site_title'], 'geodirectory');  | 
                                                        |
| 2226 | + $variables_array['value'] = '';  | 
                                                        |
| 2227 | +					if (isset($post->{$type['htmlvar_name']}))
 | 
                                                        |
| 2228 | +						$variables_array['value'] = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2229 | + endif;  | 
                                                        |
| 2230 | 2230 | |
| 2231 | - //if($type['field_icon'])  | 
                                                        |
| 2231 | + //if($type['field_icon'])  | 
                                                        |
| 2232 | 2232 | |
| 2233 | -                if (strpos($type['field_icon'], 'http') !== false) {
 | 
                                                        |
| 2234 | -                    $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
 | 
                                                        |
| 2235 | -                } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
 | 
                                                        |
| 2236 | - $field_icon = '<i class="' . $type['field_icon'] . '"></i>';  | 
                                                        |
| 2237 | - }  | 
                                                        |
| 2238 | -                //else{$field_icon = $type['field_icon'];}
 | 
                                                        |
| 2233 | +				if (strpos($type['field_icon'], 'http') !== false) {
 | 
                                                        |
| 2234 | +					$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
 | 
                                                        |
| 2235 | +				} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
 | 
                                                        |
| 2236 | + $field_icon = '<i class="' . $type['field_icon'] . '"></i>';  | 
                                                        |
| 2237 | + }  | 
                                                        |
| 2238 | +				//else{$field_icon = $type['field_icon'];}
 | 
                                                        |
| 2239 | 2239 | |
| 2240 | 2240 | |
| 2241 | -                switch ($type['type']) {
 | 
                                                        |
| 2241 | +				switch ($type['type']) {
 | 
                                                        |
| 2242 | 2242 | |
| 2243 | - case 'fieldset':  | 
                                                        |
| 2243 | + case 'fieldset':  | 
                                                        |
| 2244 | 2244 | |
| 2245 | - $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']);  | 
                                                        |
| 2245 | + $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']);  | 
                                                        |
| 2246 | 2246 | |
| 2247 | -                        if ($field_set_start == 1) {
 | 
                                                        |
| 2248 | - echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';  | 
                                                        |
| 2249 | -                        } else {
 | 
                                                        |
| 2250 | - echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';  | 
                                                        |
| 2251 | - $field_set_start = 1;  | 
                                                        |
| 2252 | - }  | 
                                                        |
| 2247 | +						if ($field_set_start == 1) {
 | 
                                                        |
| 2248 | + echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';  | 
                                                        |
| 2249 | +						} else {
 | 
                                                        |
| 2250 | + echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';  | 
                                                        |
| 2251 | + $field_set_start = 1;  | 
                                                        |
| 2252 | + }  | 
                                                        |
| 2253 | 2253 | |
| 2254 | - break;  | 
                                                        |
| 2254 | + break;  | 
                                                        |
| 2255 | 2255 | |
| 2256 | - case 'address':  | 
                                                        |
| 2256 | + case 'address':  | 
                                                        |
| 2257 | 2257 | |
| 2258 | - $html_var = $type['htmlvar_name'] . '_address';  | 
                                                        |
| 2258 | + $html_var = $type['htmlvar_name'] . '_address';  | 
                                                        |
| 2259 | 2259 | |
| 2260 | -                        if ($type['extra_fields']) {
 | 
                                                        |
| 2260 | +						if ($type['extra_fields']) {
 | 
                                                        |
| 2261 | 2261 | |
| 2262 | - $extra_fields = unserialize($type['extra_fields']);  | 
                                                        |
| 2262 | + $extra_fields = unserialize($type['extra_fields']);  | 
                                                        |
| 2263 | 2263 | |
| 2264 | - $addition_fields = '';  | 
                                                        |
| 2264 | + $addition_fields = '';  | 
                                                        |
| 2265 | 2265 | |
| 2266 | -                            if (!empty($extra_fields)) {
 | 
                                                        |
| 2267 | - /**  | 
                                                        |
| 2268 | - * Filter "show city in address" value.  | 
                                                        |
| 2269 | - *  | 
                                                        |
| 2270 | - * @since 1.0.0  | 
                                                        |
| 2271 | - */  | 
                                                        |
| 2272 | -                                $show_city_in_address = apply_filters('geodir_show_city_in_address', false);
 | 
                                                        |
| 2273 | -                                if (isset($extra_fields['show_city']) && $extra_fields['show_city'] && $show_city_in_address) {
 | 
                                                        |
| 2274 | - $field = $type['htmlvar_name'] . '_city';  | 
                                                        |
| 2275 | -                                    if ($post->{$field}) {
 | 
                                                        |
| 2276 | -                                        $addition_fields .= ', ' . $post->{$field};
 | 
                                                        |
| 2277 | - }  | 
                                                        |
| 2278 | - }  | 
                                                        |
| 2266 | +							if (!empty($extra_fields)) {
 | 
                                                        |
| 2267 | + /**  | 
                                                        |
| 2268 | + * Filter "show city in address" value.  | 
                                                        |
| 2269 | + *  | 
                                                        |
| 2270 | + * @since 1.0.0  | 
                                                        |
| 2271 | + */  | 
                                                        |
| 2272 | +								$show_city_in_address = apply_filters('geodir_show_city_in_address', false);
 | 
                                                        |
| 2273 | +								if (isset($extra_fields['show_city']) && $extra_fields['show_city'] && $show_city_in_address) {
 | 
                                                        |
| 2274 | + $field = $type['htmlvar_name'] . '_city';  | 
                                                        |
| 2275 | +									if ($post->{$field}) {
 | 
                                                        |
| 2276 | +										$addition_fields .= ', ' . $post->{$field};
 | 
                                                        |
| 2277 | + }  | 
                                                        |
| 2278 | + }  | 
                                                        |
| 2279 | 2279 | |
| 2280 | 2280 | |
| 2281 | -                                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        |
| 2282 | - $field = $type['htmlvar_name'] . '_zip';  | 
                                                        |
| 2283 | -                                    if ($post->{$field}) {
 | 
                                                        |
| 2284 | -                                        $addition_fields .= ', ' . $post->{$field};
 | 
                                                        |
| 2285 | - }  | 
                                                        |
| 2286 | - }  | 
                                                        |
| 2281 | +								if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        |
| 2282 | + $field = $type['htmlvar_name'] . '_zip';  | 
                                                        |
| 2283 | +									if ($post->{$field}) {
 | 
                                                        |
| 2284 | +										$addition_fields .= ', ' . $post->{$field};
 | 
                                                        |
| 2285 | + }  | 
                                                        |
| 2286 | + }  | 
                                                        |
| 2287 | 2287 | |
| 2288 | - }  | 
                                                        |
| 2288 | + }  | 
                                                        |
| 2289 | 2289 | |
| 2290 | - }  | 
                                                        |
| 2291 | - /*if($type['extra_fields'])  | 
                                                        |
| 2290 | + }  | 
                                                        |
| 2291 | + /*if($type['extra_fields'])  | 
                                                        |
| 2292 | 2292 |  						{
 | 
                                                        
| 2293 | 2293 | |
| 2294 | 2294 | $extra_fields = unserialize($type['extra_fields']);  | 
                                                        
@@ -2337,1034 +2337,1034 @@ discard block  | 
                                                    ||
| 2337 | 2337 | |
| 2338 | 2338 | }*/  | 
                                                        
| 2339 | 2339 | |
| 2340 | -                        if ($post->{$html_var}):
 | 
                                                        |
| 2340 | +						if ($post->{$html_var}):
 | 
                                                        |
| 2341 | +  | 
                                                        |
| 2342 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2343 | + $field_icon_af = '';  | 
                                                        |
| 2344 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2345 | + $field_icon_af = '<i class="fa fa-home"></i>';  | 
                                                        |
| 2346 | +							} else {
 | 
                                                        |
| 2347 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2348 | + $field_icon = '';  | 
                                                        |
| 2349 | + }  | 
                                                        |
| 2350 | +  | 
                                                        |
| 2351 | + $geodir_odd_even = '';  | 
                                                        |
| 2352 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2353 | +  | 
                                                        |
| 2354 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2355 | + if ($i % 2 == 0)  | 
                                                        |
| 2356 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2357 | +  | 
                                                        |
| 2358 | + $i++;  | 
                                                        |
| 2359 | + }  | 
                                                        |
| 2360 | +  | 
                                                        |
| 2361 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;" itemscope itemtype="http://schema.org/PostalAddress">';  | 
                                                        |
| 2362 | + $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2363 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2364 | + $html .= '</span>';  | 
                                                        |
| 2365 | +  | 
                                                        |
| 2366 | +							if ($preview) {
 | 
                                                        |
| 2367 | +								$html .= $post->{$html_var} . $addition_fields . '</p></div>';
 | 
                                                        |
| 2368 | +							} else {
 | 
                                                        |
| 2369 | +								if ($post->post_address) {
 | 
                                                        |
| 2370 | + $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';  | 
                                                        |
| 2371 | + }  | 
                                                        |
| 2372 | +								if ($post->post_city) {
 | 
                                                        |
| 2373 | + $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';  | 
                                                        |
| 2374 | + }  | 
                                                        |
| 2375 | +								if ($post->post_region) {
 | 
                                                        |
| 2376 | + $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';  | 
                                                        |
| 2377 | + }  | 
                                                        |
| 2378 | +								if ($post->post_zip) {
 | 
                                                        |
| 2379 | + $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';  | 
                                                        |
| 2380 | + }  | 
                                                        |
| 2381 | +								if ($post->post_country) {
 | 
                                                        |
| 2382 | + $html .= '<span itemprop="addressCountry">' . __($post->post_country, 'geodirectory') . '</span><br>';  | 
                                                        |
| 2383 | + }  | 
                                                        |
| 2384 | + $html .= '</div>';  | 
                                                        |
| 2385 | + }  | 
                                                        |
| 2386 | +  | 
                                                        |
| 2387 | +  | 
                                                        |
| 2388 | + endif;  | 
                                                        |
| 2389 | +  | 
                                                        |
| 2390 | +						$variables_array['value'] = $post->{$html_var};
 | 
                                                        |
| 2391 | +  | 
                                                        |
| 2392 | + break;  | 
                                                        |
| 2393 | +  | 
                                                        |
| 2394 | + case 'url':  | 
                                                        |
| 2395 | +  | 
                                                        |
| 2396 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2397 | +  | 
                                                        |
| 2398 | +						if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2399 | +  | 
                                                        |
| 2400 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2401 | + $field_icon_af = '';  | 
                                                        |
| 2402 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2403 | +  | 
                                                        |
| 2404 | +								if ($type['name'] == 'geodir_facebook') {
 | 
                                                        |
| 2405 | + $field_icon_af = '<i class="fa fa-facebook-square"></i>';  | 
                                                        |
| 2406 | +								} elseif ($type['name'] == 'geodir_twitter') {
 | 
                                                        |
| 2407 | + $field_icon_af = '<i class="fa fa-twitter-square"></i>';  | 
                                                        |
| 2408 | +								} else {
 | 
                                                        |
| 2409 | + $field_icon_af = '<i class="fa fa-link"></i>';  | 
                                                        |
| 2410 | + }  | 
                                                        |
| 2411 | +  | 
                                                        |
| 2412 | +							} else {
 | 
                                                        |
| 2413 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2414 | + $field_icon = '';  | 
                                                        |
| 2415 | + }  | 
                                                        |
| 2416 | +  | 
                                                        |
| 2417 | +							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
 | 
                                                        |
| 2418 | +  | 
                                                        |
| 2419 | +  | 
                                                        |
| 2420 | + $website = !empty($a_url['url']) ? $a_url['url'] : '';  | 
                                                        |
| 2421 | + $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];  | 
                                                        |
| 2422 | +							if(!empty($type['default_value'])){$title = $type['default_value'];}
 | 
                                                        |
| 2423 | + $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';  | 
                                                        |
| 2341 | 2424 | |
| 2342 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2343 | - $field_icon_af = '';  | 
                                                        |
| 2344 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2345 | - $field_icon_af = '<i class="fa fa-home"></i>';  | 
                                                        |
| 2346 | -                            } else {
 | 
                                                        |
| 2347 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2348 | - $field_icon = '';  | 
                                                        |
| 2349 | - }  | 
                                                        |
| 2350 | -  | 
                                                        |
| 2351 | - $geodir_odd_even = '';  | 
                                                        |
| 2352 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2353 | 2425 | |
| 2354 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2355 | - if ($i % 2 == 0)  | 
                                                        |
| 2356 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2426 | + $geodir_odd_even = '';  | 
                                                        |
| 2427 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2357 | 2428 | |
| 2358 | - $i++;  | 
                                                        |
| 2359 | - }  | 
                                                        |
| 2429 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2430 | + if ($i % 2 == 0)  | 
                                                        |
| 2431 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2360 | 2432 | |
| 2361 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;" itemscope itemtype="http://schema.org/PostalAddress">';  | 
                                                        |
| 2362 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2363 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2364 | - $html .= '</span>';  | 
                                                        |
| 2433 | + $i++;  | 
                                                        |
| 2434 | + }  | 
                                                        |
| 2435 | +  | 
                                                        |
| 2436 | +  | 
                                                        |
| 2437 | + // all search engines that use the nofollow value exclude links that use it from their ranking calculation  | 
                                                        |
| 2438 | + $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';  | 
                                                        |
| 2439 | + /**  | 
                                                        |
| 2440 | + * Filter custom field website name.  | 
                                                        |
| 2441 | + *  | 
                                                        |
| 2442 | + * @since 1.0.0  | 
                                                        |
| 2443 | + *  | 
                                                        |
| 2444 | + * @param string $title Website Title.  | 
                                                        |
| 2445 | + * @param string $website Website URL.  | 
                                                        |
| 2446 | + * @param int $post->ID Post ID.  | 
                                                        |
| 2447 | + */  | 
                                                        |
| 2448 | +							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
 | 
                                                        |
| 2449 | +  | 
                                                        |
| 2450 | + endif;  | 
                                                        |
| 2451 | +  | 
                                                        |
| 2452 | + break;  | 
                                                        |
| 2453 | +  | 
                                                        |
| 2454 | + case 'phone':  | 
                                                        |
| 2455 | +  | 
                                                        |
| 2456 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2457 | +  | 
                                                        |
| 2458 | +						if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2459 | +  | 
                                                        |
| 2460 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2461 | + $field_icon_af = '';  | 
                                                        |
| 2462 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2463 | + $field_icon_af = '<i class="fa fa-phone"></i>';  | 
                                                        |
| 2464 | +							} else {
 | 
                                                        |
| 2465 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2466 | + $field_icon = '';  | 
                                                        |
| 2467 | + }  | 
                                                        |
| 2468 | +  | 
                                                        |
| 2469 | + $geodir_odd_even = '';  | 
                                                        |
| 2470 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2471 | +  | 
                                                        |
| 2472 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2473 | + if ($i % 2 == 0)  | 
                                                        |
| 2474 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2475 | +  | 
                                                        |
| 2476 | + $i++;  | 
                                                        |
| 2477 | + }  | 
                                                        |
| 2478 | +  | 
                                                        |
| 2479 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .  | 
                                                        |
| 2480 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2481 | +							$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}) . '">' . $post->{$type['htmlvar_name']} . '</a></div>';
 | 
                                                        |
| 2482 | +  | 
                                                        |
| 2483 | + endif;  | 
                                                        |
| 2484 | +  | 
                                                        |
| 2485 | + break;  | 
                                                        |
| 2486 | +  | 
                                                        |
| 2487 | + case 'time':  | 
                                                        |
| 2488 | +  | 
                                                        |
| 2489 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2490 | +  | 
                                                        |
| 2491 | +						if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2492 | +  | 
                                                        |
| 2493 | + $value = '';  | 
                                                        |
| 2494 | +							if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2495 | +								//$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2496 | +								$value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2497 | +  | 
                                                        |
| 2498 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2499 | + $field_icon_af = '';  | 
                                                        |
| 2500 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2501 | + $field_icon_af = '<i class="fa fa-clock-o"></i>';  | 
                                                        |
| 2502 | +							} else {
 | 
                                                        |
| 2503 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2504 | + $field_icon = '';  | 
                                                        |
| 2505 | + }  | 
                                                        |
| 2506 | +  | 
                                                        |
| 2507 | + $geodir_odd_even = '';  | 
                                                        |
| 2508 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2509 | +  | 
                                                        |
| 2510 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2511 | + if ($i % 2 == 0)  | 
                                                        |
| 2512 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2513 | +  | 
                                                        |
| 2514 | + $i++;  | 
                                                        |
| 2515 | + }  | 
                                                        |
| 2516 | +  | 
                                                        |
| 2517 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2518 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2519 | + $html .= '</span>' . $value . '</div>';  | 
                                                        |
| 2520 | +  | 
                                                        |
| 2521 | + endif;  | 
                                                        |
| 2522 | +  | 
                                                        |
| 2523 | + break;  | 
                                                        |
| 2524 | +  | 
                                                        |
| 2525 | + case 'datepicker':  | 
                                                        |
| 2526 | +  | 
                                                        |
| 2527 | +						if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2528 | +  | 
                                                        |
| 2529 | + $date_format = geodir_default_date_format();  | 
                                                        |
| 2530 | +							if ($type['extra_fields'] != '') {
 | 
                                                        |
| 2531 | + $date_format = unserialize($type['extra_fields']);  | 
                                                        |
| 2532 | + $date_format = $date_format['date_format'];  | 
                                                        |
| 2533 | + }  | 
                                                        |
| 2534 | + // check if we need to change the format or not  | 
                                                        |
| 2535 | +							$date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        |
| 2536 | +							if($date_format_len>5){// if greater then 4 then it's the old style format.
 | 
                                                        |
| 2537 | +  | 
                                                        |
| 2538 | +								$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 2539 | +								$replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 2540 | +  | 
                                                        |
| 2541 | + $date_format = str_replace($search, $replace, $date_format);  | 
                                                        |
| 2542 | +  | 
                                                        |
| 2543 | +								$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        |
| 2544 | +							}else{
 | 
                                                        |
| 2545 | +								$post_htmlvar_value = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2546 | + }  | 
                                                        |
| 2547 | +  | 
                                                        |
| 2548 | +							if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
 | 
                                                        |
| 2549 | + $value = date_i18n($date_format, strtotime($post_htmlvar_value));  | 
                                                        |
| 2550 | +							}else{
 | 
                                                        |
| 2551 | + continue;  | 
                                                        |
| 2552 | + }  | 
                                                        |
| 2553 | +  | 
                                                        |
| 2554 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2555 | + $field_icon_af = '';  | 
                                                        |
| 2556 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2557 | + $field_icon_af = '<i class="fa fa-calendar"></i>';  | 
                                                        |
| 2558 | +							} else {
 | 
                                                        |
| 2559 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2560 | + $field_icon = '';  | 
                                                        |
| 2561 | + }  | 
                                                        |
| 2562 | +  | 
                                                        |
| 2563 | + $geodir_odd_even = '';  | 
                                                        |
| 2564 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2565 | +  | 
                                                        |
| 2566 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2567 | + if ($i % 2 == 0)  | 
                                                        |
| 2568 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2569 | +  | 
                                                        |
| 2570 | + $i++;  | 
                                                        |
| 2571 | + }  | 
                                                        |
| 2572 | +  | 
                                                        |
| 2573 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2574 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2575 | + $html .= '</span>' . $value . '</div>';  | 
                                                        |
| 2576 | +  | 
                                                        |
| 2577 | + endif;  | 
                                                        |
| 2578 | +  | 
                                                        |
| 2579 | + break;  | 
                                                        |
| 2580 | +  | 
                                                        |
| 2581 | + case 'text':  | 
                                                        |
| 2582 | +  | 
                                                        |
| 2583 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2584 | +  | 
                                                        |
| 2585 | +						if (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']} != '' && $type['htmlvar_name'] == 'geodir_timing'):
 | 
                                                        |
| 2586 | +  | 
                                                        |
| 2587 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2588 | + $field_icon_af = '';  | 
                                                        |
| 2589 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2590 | + $field_icon_af = '<i class="fa fa-clock-o"></i>';  | 
                                                        |
| 2591 | +							} else {
 | 
                                                        |
| 2592 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2593 | + $field_icon = '';  | 
                                                        |
| 2594 | + }  | 
                                                        |
| 2595 | +  | 
                                                        |
| 2596 | + $geodir_odd_even = '';  | 
                                                        |
| 2597 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2598 | +  | 
                                                        |
| 2599 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2600 | + if ($i % 2 == 0)  | 
                                                        |
| 2601 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2602 | +  | 
                                                        |
| 2603 | + $i++;  | 
                                                        |
| 2604 | + }  | 
                                                        |
| 2605 | +  | 
                                                        |
| 2606 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2607 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2608 | +							$html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2609 | +  | 
                                                        |
| 2610 | +						elseif (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2611 | +  | 
                                                        |
| 2612 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2613 | + $field_icon_af = '';  | 
                                                        |
| 2614 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2615 | + $field_icon_af = '';  | 
                                                        |
| 2616 | +							} else {
 | 
                                                        |
| 2617 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2618 | + $field_icon = '';  | 
                                                        |
| 2619 | + }  | 
                                                        |
| 2620 | +  | 
                                                        |
| 2621 | + $geodir_odd_even = '';  | 
                                                        |
| 2622 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2623 | +  | 
                                                        |
| 2624 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2625 | + if ($i % 2 == 0)  | 
                                                        |
| 2626 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2627 | +  | 
                                                        |
| 2628 | + $i++;  | 
                                                        |
| 2629 | + }  | 
                                                        |
| 2630 | +  | 
                                                        |
| 2631 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2632 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2633 | +							$html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2634 | +  | 
                                                        |
| 2635 | + endif;  | 
                                                        |
| 2636 | +  | 
                                                        |
| 2637 | + break;  | 
                                                        |
| 2638 | +  | 
                                                        |
| 2639 | + case 'radio':  | 
                                                        |
| 2640 | +  | 
                                                        |
| 2641 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2642 | +						if(!isset($post->{$type['htmlvar_name']})){continue;}
 | 
                                                        |
| 2643 | +						$html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        |
| 2644 | +						if ($post->{$type['htmlvar_name']} != ''):
 | 
                                                        |
| 2645 | +  | 
                                                        |
| 2646 | +							if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
 | 
                                                        |
| 2647 | +								$html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2648 | +							} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
 | 
                                                        |
| 2649 | +								$html_val = __('Yes', 'geodirectory');
 | 
                                                        |
| 2650 | +							} else {
 | 
                                                        |
| 2651 | +								if (!empty($type['option_values'])) {
 | 
                                                        |
| 2652 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2653 | +  | 
                                                        |
| 2654 | +									if (!empty($cf_option_values)) {
 | 
                                                        |
| 2655 | +										foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2656 | +											if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2657 | + $html_val = $cf_option_value['label'];  | 
                                                        |
| 2658 | + }  | 
                                                        |
| 2659 | + }  | 
                                                        |
| 2660 | + }  | 
                                                        |
| 2661 | + }  | 
                                                        |
| 2662 | + }  | 
                                                        |
| 2663 | +  | 
                                                        |
| 2664 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2665 | + $field_icon_af = '';  | 
                                                        |
| 2666 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2667 | + $field_icon_af = '';  | 
                                                        |
| 2668 | +							} else {
 | 
                                                        |
| 2669 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2670 | + $field_icon = '';  | 
                                                        |
| 2671 | + }  | 
                                                        |
| 2365 | 2672 | |
| 2366 | -                            if ($preview) {
 | 
                                                        |
| 2367 | -                                $html .= $post->{$html_var} . $addition_fields . '</p></div>';
 | 
                                                        |
| 2368 | -                            } else {
 | 
                                                        |
| 2369 | -                                if ($post->post_address) {
 | 
                                                        |
| 2370 | - $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';  | 
                                                        |
| 2371 | - }  | 
                                                        |
| 2372 | -                                if ($post->post_city) {
 | 
                                                        |
| 2373 | - $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';  | 
                                                        |
| 2374 | - }  | 
                                                        |
| 2375 | -                                if ($post->post_region) {
 | 
                                                        |
| 2376 | - $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';  | 
                                                        |
| 2377 | - }  | 
                                                        |
| 2378 | -                                if ($post->post_zip) {
 | 
                                                        |
| 2379 | - $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';  | 
                                                        |
| 2380 | - }  | 
                                                        |
| 2381 | -                                if ($post->post_country) {
 | 
                                                        |
| 2382 | - $html .= '<span itemprop="addressCountry">' . __($post->post_country, 'geodirectory') . '</span><br>';  | 
                                                        |
| 2383 | - }  | 
                                                        |
| 2384 | - $html .= '</div>';  | 
                                                        |
| 2385 | - }  | 
                                                        |
| 2673 | + $geodir_odd_even = '';  | 
                                                        |
| 2674 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2386 | 2675 | |
| 2676 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2677 | + if ($i % 2 == 0)  | 
                                                        |
| 2678 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2387 | 2679 | |
| 2388 | - endif;  | 
                                                        |
| 2680 | + $i++;  | 
                                                        |
| 2681 | + }  | 
                                                        |
| 2682 | +  | 
                                                        |
| 2683 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2684 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2685 | + $html .= '</span>' . $html_val . '</div>';  | 
                                                        |
| 2686 | + endif;  | 
                                                        |
| 2687 | +  | 
                                                        |
| 2688 | + break;  | 
                                                        |
| 2689 | +  | 
                                                        |
| 2690 | + case 'checkbox':  | 
                                                        |
| 2691 | +  | 
                                                        |
| 2692 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2693 | +  | 
                                                        |
| 2694 | +						if ((int)$post->{$html_var} == 1):
 | 
                                                        |
| 2695 | +  | 
                                                        |
| 2696 | +							if ($post->{$type['htmlvar_name']} == '1'):
 | 
                                                        |
| 2697 | +								$html_val = __('Yes', 'geodirectory');
 | 
                                                        |
| 2698 | + else:  | 
                                                        |
| 2699 | +								$html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2700 | + endif;  | 
                                                        |
| 2701 | +  | 
                                                        |
| 2702 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2703 | + $field_icon_af = '';  | 
                                                        |
| 2704 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2705 | + $field_icon_af = '';  | 
                                                        |
| 2706 | +							} else {
 | 
                                                        |
| 2707 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2708 | + $field_icon = '';  | 
                                                        |
| 2709 | + }  | 
                                                        |
| 2710 | +  | 
                                                        |
| 2711 | + $geodir_odd_even = '';  | 
                                                        |
| 2712 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2713 | +  | 
                                                        |
| 2714 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2715 | + if ($i % 2 == 0)  | 
                                                        |
| 2716 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2717 | +  | 
                                                        |
| 2718 | + $i++;  | 
                                                        |
| 2719 | + }  | 
                                                        |
| 2720 | +  | 
                                                        |
| 2721 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2722 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2723 | + $html .= '</span>' . $html_val . '</div>';  | 
                                                        |
| 2724 | + endif;  | 
                                                        |
| 2725 | +  | 
                                                        |
| 2726 | + break;  | 
                                                        |
| 2727 | +  | 
                                                        |
| 2728 | + case 'select':  | 
                                                        |
| 2729 | +  | 
                                                        |
| 2730 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2731 | +						if(!isset($post->{$type['htmlvar_name']})){continue;}
 | 
                                                        |
| 2732 | +						if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2733 | +							$field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        |
| 2734 | +  | 
                                                        |
| 2735 | +							if (!empty($type['option_values'])) {
 | 
                                                        |
| 2736 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2737 | +  | 
                                                        |
| 2738 | +								if (!empty($cf_option_values)) {
 | 
                                                        |
| 2739 | +									foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2740 | +										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2741 | + //$field_value = $cf_option_value['label']; // no longer needed here.  | 
                                                        |
| 2742 | + }  | 
                                                        |
| 2743 | + }  | 
                                                        |
| 2744 | + }  | 
                                                        |
| 2745 | + }  | 
                                                        |
| 2746 | +  | 
                                                        |
| 2747 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2748 | + $field_icon_af = '';  | 
                                                        |
| 2749 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2750 | + $field_icon_af = '';  | 
                                                        |
| 2751 | +							} else {
 | 
                                                        |
| 2752 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2753 | + $field_icon = '';  | 
                                                        |
| 2754 | + }  | 
                                                        |
| 2755 | +  | 
                                                        |
| 2756 | + $geodir_odd_even = '';  | 
                                                        |
| 2757 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2758 | +  | 
                                                        |
| 2759 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2760 | + if ($i % 2 == 0)  | 
                                                        |
| 2761 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2762 | +  | 
                                                        |
| 2763 | + $i++;  | 
                                                        |
| 2764 | + }  | 
                                                        |
| 2765 | +  | 
                                                        |
| 2766 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2767 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2768 | + $html .= '</span>' . $field_value . '</div>';  | 
                                                        |
| 2769 | + endif;  | 
                                                        |
| 2770 | +  | 
                                                        |
| 2771 | + break;  | 
                                                        |
| 2772 | +  | 
                                                        |
| 2773 | +  | 
                                                        |
| 2774 | + case 'multiselect':  | 
                                                        |
| 2775 | +  | 
                                                        |
| 2776 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2777 | +  | 
                                                        |
| 2778 | +						if (!empty($post->{$type['htmlvar_name']})):
 | 
                                                        |
| 2779 | +  | 
                                                        |
| 2780 | +							if (is_array($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2781 | +								$post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2782 | + }  | 
                                                        |
| 2783 | +  | 
                                                        |
| 2784 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2785 | + $field_icon_af = '';  | 
                                                        |
| 2786 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2787 | + $field_icon_af = '';  | 
                                                        |
| 2788 | +							} else {
 | 
                                                        |
| 2789 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2790 | + $field_icon = '';  | 
                                                        |
| 2791 | + }  | 
                                                        |
| 2792 | +  | 
                                                        |
| 2793 | +							$field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
 | 
                                                        |
| 2389 | 2794 | |
| 2390 | -                        $variables_array['value'] = $post->{$html_var};
 | 
                                                        |
| 2795 | + $option_values = array();  | 
                                                        |
| 2796 | +							if (!empty($type['option_values'])) {
 | 
                                                        |
| 2797 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2391 | 2798 | |
| 2392 | - break;  | 
                                                        |
| 2799 | +								if (!empty($cf_option_values)) {
 | 
                                                        |
| 2800 | +									foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2801 | +										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
 | 
                                                        |
| 2802 | + $option_values[] = $cf_option_value['label'];  | 
                                                        |
| 2803 | + }  | 
                                                        |
| 2804 | + }  | 
                                                        |
| 2805 | + }  | 
                                                        |
| 2806 | + }  | 
                                                        |
| 2393 | 2807 | |
| 2394 | - case 'url':  | 
                                                        |
| 2808 | + $geodir_odd_even = '';  | 
                                                        |
| 2809 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2395 | 2810 | |
| 2396 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2811 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2812 | + if ($i % 2 == 0)  | 
                                                        |
| 2813 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2397 | 2814 | |
| 2398 | -                        if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2815 | + $i++;  | 
                                                        |
| 2816 | + }  | 
                                                        |
| 2399 | 2817 | |
| 2400 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2401 | - $field_icon_af = '';  | 
                                                        |
| 2402 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2818 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2819 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2820 | + $html .= '</span>';  | 
                                                        |
| 2403 | 2821 | |
| 2404 | -                                if ($type['name'] == 'geodir_facebook') {
 | 
                                                        |
| 2405 | - $field_icon_af = '<i class="fa fa-facebook-square"></i>';  | 
                                                        |
| 2406 | -                                } elseif ($type['name'] == 'geodir_twitter') {
 | 
                                                        |
| 2407 | - $field_icon_af = '<i class="fa fa-twitter-square"></i>';  | 
                                                        |
| 2408 | -                                } else {
 | 
                                                        |
| 2409 | - $field_icon_af = '<i class="fa fa-link"></i>';  | 
                                                        |
| 2410 | - }  | 
                                                        |
| 2822 | +							if (count($option_values) > 1) {
 | 
                                                        |
| 2823 | + $html .= '<ul>';  | 
                                                        |
| 2411 | 2824 | |
| 2412 | -                            } else {
 | 
                                                        |
| 2413 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2414 | - $field_icon = '';  | 
                                                        |
| 2415 | - }  | 
                                                        |
| 2825 | +								foreach ($option_values as $val) {
 | 
                                                        |
| 2826 | + $html .= '<li>' . $val . '</li>';  | 
                                                        |
| 2827 | + }  | 
                                                        |
| 2416 | 2828 | |
| 2417 | -                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
 | 
                                                        |
| 2829 | + $html .= '</ul>';  | 
                                                        |
| 2830 | +							} else {
 | 
                                                        |
| 2831 | +								$html .= $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2832 | + }  | 
                                                        |
| 2418 | 2833 | |
| 2834 | + $html .= '</div>';  | 
                                                        |
| 2835 | + endif;  | 
                                                        |
| 2836 | + break;  | 
                                                        |
| 2837 | + case 'email':  | 
                                                        |
| 2838 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2839 | +						if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
 | 
                                                        |
| 2840 | + continue; // Remove Send Enquiry | Send To Friend from listings page  | 
                                                        |
| 2841 | + }  | 
                                                        |
| 2842 | +  | 
                                                        |
| 2843 | +						if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2844 | + $send_to_friend = true;  | 
                                                        |
| 2845 | + $b_send_inquiry = '';  | 
                                                        |
| 2846 | + $b_sendtofriend = '';  | 
                                                        |
| 2847 | +  | 
                                                        |
| 2848 | + $html = '';  | 
                                                        |
| 2849 | +							if (!$preview) {
 | 
                                                        |
| 2850 | + $b_send_inquiry = 'b_send_inquiry';  | 
                                                        |
| 2851 | + $b_sendtofriend = 'b_sendtofriend';  | 
                                                        |
| 2852 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';  | 
                                                        |
| 2853 | + }  | 
                                                        |
| 2419 | 2854 | |
| 2420 | - $website = !empty($a_url['url']) ? $a_url['url'] : '';  | 
                                                        |
| 2421 | - $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];  | 
                                                        |
| 2422 | -                            if(!empty($type['default_value'])){$title = $type['default_value'];}
 | 
                                                        |
| 2423 | - $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';  | 
                                                        |
| 2855 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2856 | + $field_icon_af = '';  | 
                                                        |
| 2857 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2858 | + $field_icon_af = '<i class="fa fa-envelope"></i>';  | 
                                                        |
| 2859 | +							} else {
 | 
                                                        |
| 2860 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2861 | + $field_icon = '';  | 
                                                        |
| 2862 | + }  | 
                                                        |
| 2424 | 2863 | |
| 2864 | + $geodir_odd_even = '';  | 
                                                        |
| 2865 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2425 | 2866 | |
| 2426 | - $geodir_odd_even = '';  | 
                                                        |
| 2427 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2867 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2868 | + if ($i % 2 == 0)  | 
                                                        |
| 2869 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2428 | 2870 | |
| 2429 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2430 | - if ($i % 2 == 0)  | 
                                                        |
| 2431 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2871 | + $i++;  | 
                                                        |
| 2872 | + }  | 
                                                        |
| 2432 | 2873 | |
| 2433 | - $i++;  | 
                                                        |
| 2434 | - }  | 
                                                        |
| 2874 | + $html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2875 | + $seperator = '';  | 
                                                        |
| 2876 | +							if ($post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2877 | + $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';  | 
                                                        |
| 2878 | + $seperator = ' | ';  | 
                                                        |
| 2879 | + }  | 
                                                        |
| 2435 | 2880 | |
| 2881 | +							if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
 | 
                                                        |
| 2882 | + $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';  | 
                                                        |
| 2883 | + }  | 
                                                        |
| 2436 | 2884 | |
| 2437 | - // all search engines that use the nofollow value exclude links that use it from their ranking calculation  | 
                                                        |
| 2438 | - $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';  | 
                                                        |
| 2439 | - /**  | 
                                                        |
| 2440 | - * Filter custom field website name.  | 
                                                        |
| 2441 | - *  | 
                                                        |
| 2442 | - * @since 1.0.0  | 
                                                        |
| 2443 | - *  | 
                                                        |
| 2444 | - * @param string $title Website Title.  | 
                                                        |
| 2445 | - * @param string $website Website URL.  | 
                                                        |
| 2446 | - * @param int $post->ID Post ID.  | 
                                                        |
| 2447 | - */  | 
                                                        |
| 2448 | -                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
 | 
                                                        |
| 2885 | + $html .= '</span></div>';  | 
                                                        |
| 2449 | 2886 | |
| 2450 | - endif;  | 
                                                        |
| 2451 | 2887 | |
| 2452 | - break;  | 
                                                        |
| 2888 | +							if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
 | 
                                                        |
| 2889 | + $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';  | 
                                                        |
| 2890 | +							} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
 | 
                                                        |
| 2891 | + $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';  | 
                                                        |
| 2892 | +							} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
 | 
                                                        |
| 2893 | + $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';  | 
                                                        |
| 2894 | + }  | 
                                                        |
| 2453 | 2895 | |
| 2454 | - case 'phone':  | 
                                                        |
| 2896 | +							/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
 | 
                                                        |
| 2455 | 2897 | |
| 2456 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2898 | +						} else {
 | 
                                                        |
| 2457 | 2899 | |
| 2458 | -                        if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2900 | +							if ($post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2901 | +								if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2902 | + $field_icon_af = '';  | 
                                                        |
| 2903 | +								} elseif ($field_icon == '') {
 | 
                                                        |
| 2904 | + $field_icon_af = '<i class="fa fa-envelope"></i>';  | 
                                                        |
| 2905 | +								} else {
 | 
                                                        |
| 2906 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2907 | + $field_icon = '';  | 
                                                        |
| 2908 | + }  | 
                                                        |
| 2459 | 2909 | |
| 2460 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2461 | - $field_icon_af = '';  | 
                                                        |
| 2462 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2463 | - $field_icon_af = '<i class="fa fa-phone"></i>';  | 
                                                        |
| 2464 | -                            } else {
 | 
                                                        |
| 2465 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2466 | - $field_icon = '';  | 
                                                        |
| 2467 | - }  | 
                                                        |
| 2910 | + $geodir_odd_even = '';  | 
                                                        |
| 2911 | +								if ($fields_location == 'detail') {
 | 
                                                        |
| 2468 | 2912 | |
| 2469 | - $geodir_odd_even = '';  | 
                                                        |
| 2470 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2913 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2914 | + if ($i % 2 == 0)  | 
                                                        |
| 2915 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2471 | 2916 | |
| 2472 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2473 | - if ($i % 2 == 0)  | 
                                                        |
| 2474 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2917 | + $i++;  | 
                                                        |
| 2918 | + }  | 
                                                        |
| 2475 | 2919 | |
| 2476 | - $i++;  | 
                                                        |
| 2477 | - }  | 
                                                        |
| 2920 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2921 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2922 | + $html .= '</span><span class="geodir-email-address-output">';  | 
                                                        |
| 2923 | +								$email = $post->{$type['htmlvar_name']} ;
 | 
                                                        |
| 2924 | +								if($e_split = explode('@',$email)){
 | 
                                                        |
| 2925 | + /**  | 
                                                        |
| 2926 | + * Filter email custom field name output.  | 
                                                        |
| 2927 | + *  | 
                                                        |
| 2928 | + * @since 1.5.3  | 
                                                        |
| 2929 | + *  | 
                                                        |
| 2930 | + * @param string $email The email string being output.  | 
                                                        |
| 2931 | + * @param array $type Custom field variables array.  | 
                                                        |
| 2932 | + */  | 
                                                        |
| 2933 | +									$email_name = apply_filters('geodir_email_field_name_output',$email,$type);
 | 
                                                        |
| 2934 | +									$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
 | 
                                                        |
| 2935 | +								}else{
 | 
                                                        |
| 2936 | + $html .= $email;  | 
                                                        |
| 2937 | + }  | 
                                                        |
| 2938 | + $html .= '</span></div>';  | 
                                                        |
| 2939 | + }  | 
                                                        |
| 2478 | 2940 | |
| 2479 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .  | 
                                                        |
| 2480 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2481 | -                            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}) . '">' . $post->{$type['htmlvar_name']} . '</a></div>';
 | 
                                                        |
| 2941 | + }  | 
                                                        |
| 2482 | 2942 | |
| 2483 | - endif;  | 
                                                        |
| 2943 | + break;  | 
                                                        |
| 2484 | 2944 | |
| 2485 | - break;  | 
                                                        |
| 2486 | 2945 | |
| 2487 | - case 'time':  | 
                                                        |
| 2946 | + case 'file':  | 
                                                        |
| 2488 | 2947 | |
| 2489 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2948 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2490 | 2949 | |
| 2491 | -                        if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2950 | +						if (!empty($post->{$type['htmlvar_name']})):
 | 
                                                        |
| 2492 | 2951 | |
| 2493 | - $value = '';  | 
                                                        |
| 2494 | -                            if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2495 | -                                //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2496 | -                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2952 | +							$files = explode(",", $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2953 | + if (!empty($files)):  | 
                                                        |
| 2497 | 2954 | |
| 2498 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2499 | - $field_icon_af = '';  | 
                                                        |
| 2500 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2501 | - $field_icon_af = '<i class="fa fa-clock-o"></i>';  | 
                                                        |
| 2502 | -                            } else {
 | 
                                                        |
| 2503 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2504 | - $field_icon = '';  | 
                                                        |
| 2505 | - }  | 
                                                        |
| 2955 | + $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;  | 
                                                        |
| 2956 | +								$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 2506 | 2957 | |
| 2507 | - $geodir_odd_even = '';  | 
                                                        |
| 2508 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2958 | + $file_paths = '';  | 
                                                        |
| 2959 | +								foreach ($files as $file) {
 | 
                                                        |
| 2960 | +									if (!empty($file)) {
 | 
                                                        |
| 2509 | 2961 | |
| 2510 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2511 | - if ($i % 2 == 0)  | 
                                                        |
| 2512 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2962 | + // $filetype = wp_check_filetype($file);  | 
                                                        |
| 2513 | 2963 | |
| 2514 | - $i++;  | 
                                                        |
| 2515 | - }  | 
                                                        |
| 2964 | +										$image_name_arr = explode('/', $file);
 | 
                                                        |
| 2965 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];  | 
                                                        |
| 2966 | + $filename = end($image_name_arr);  | 
                                                        |
| 2967 | +										$img_name_arr = explode('.', $filename);
 | 
                                                        |
| 2516 | 2968 | |
| 2517 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2518 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2519 | - $html .= '</span>' . $value . '</div>';  | 
                                                        |
| 2969 | + $arr_file_type = wp_check_filetype($filename);  | 
                                                        |
| 2970 | +										if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
 | 
                                                        |
| 2971 | + continue;  | 
                                                        |
| 2972 | + }  | 
                                                        |
| 2520 | 2973 | |
| 2521 | - endif;  | 
                                                        |
| 2974 | + $uploaded_file_type = $arr_file_type['type'];  | 
                                                        |
| 2975 | + $uploaded_file_ext = $arr_file_type['ext'];  | 
                                                        |
| 2522 | 2976 | |
| 2523 | - break;  | 
                                                        |
| 2977 | +										if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
 | 
                                                        |
| 2978 | + continue; // Invalid file type.  | 
                                                        |
| 2979 | + }  | 
                                                        |
| 2524 | 2980 | |
| 2525 | - case 'datepicker':  | 
                                                        |
| 2981 | +										//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
 | 
                                                        |
| 2982 | +										$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
 | 
                                                        |
| 2526 | 2983 | |
| 2527 | -                        if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2984 | + // If the uploaded file is image  | 
                                                        |
| 2985 | +										if (in_array($uploaded_file_type, $image_file_types)) {
 | 
                                                        |
| 2986 | + $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';  | 
                                                        |
| 2987 | + $file_paths .= '<a href="'.$file.'">';  | 
                                                        |
| 2988 | +											$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
 | 
                                                        |
| 2989 | + $file_paths .= '</a>';  | 
                                                        |
| 2990 | + //$file_paths .= '<img src="'.$file.'" />';  | 
                                                        |
| 2991 | + $file_paths .= '</div>';  | 
                                                        |
| 2992 | +										} else {
 | 
                                                        |
| 2993 | + $ext_path = '_' . $html_var . '_';  | 
                                                        |
| 2994 | + $filename = explode($ext_path, $filename);  | 
                                                        |
| 2995 | + $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';  | 
                                                        |
| 2996 | + }  | 
                                                        |
| 2997 | + }  | 
                                                        |
| 2998 | + }  | 
                                                        |
| 2528 | 2999 | |
| 2529 | - $date_format = geodir_default_date_format();  | 
                                                        |
| 2530 | -                            if ($type['extra_fields'] != '') {
 | 
                                                        |
| 2531 | - $date_format = unserialize($type['extra_fields']);  | 
                                                        |
| 2532 | - $date_format = $date_format['date_format'];  | 
                                                        |
| 2533 | - }  | 
                                                        |
| 2534 | - // check if we need to change the format or not  | 
                                                        |
| 2535 | -                            $date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        |
| 2536 | -                            if($date_format_len>5){// if greater then 4 then it's the old style format.
 | 
                                                        |
| 3000 | +								if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 3001 | + $field_icon_af = '';  | 
                                                        |
| 3002 | +								} elseif ($field_icon == '') {
 | 
                                                        |
| 3003 | + $field_icon_af = '';  | 
                                                        |
| 3004 | +								} else {
 | 
                                                        |
| 3005 | + $field_icon_af = $field_icon;  | 
                                                        |
| 3006 | + $field_icon = '';  | 
                                                        |
| 3007 | + }  | 
                                                        |
| 2537 | 3008 | |
| 2538 | -                                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 2539 | -                                $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 3009 | + $geodir_odd_even = '';  | 
                                                        |
| 3010 | +								if ($fields_location == 'detail') {
 | 
                                                        |
| 2540 | 3011 | |
| 2541 | - $date_format = str_replace($search, $replace, $date_format);  | 
                                                        |
| 3012 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 3013 | + if ($i % 2 == 0)  | 
                                                        |
| 3014 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2542 | 3015 | |
| 2543 | -                                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        |
| 2544 | -                            }else{
 | 
                                                        |
| 2545 | -                                $post_htmlvar_value = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2546 | - }  | 
                                                        |
| 3016 | + $i++;  | 
                                                        |
| 3017 | + }  | 
                                                        |
| 2547 | 3018 | |
| 2548 | -                            if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
 | 
                                                        |
| 2549 | - $value = date_i18n($date_format, strtotime($post_htmlvar_value));  | 
                                                        |
| 2550 | -                            }else{
 | 
                                                        |
| 2551 | - continue;  | 
                                                        |
| 2552 | - }  | 
                                                        |
| 3019 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' geodir-custom-file-box ' . $type['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3020 | + $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';  | 
                                                        |
| 3021 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3022 | + $html .= '</span>';  | 
                                                        |
| 3023 | + $html .= $file_paths . '</div></div>';  | 
                                                        |
| 2553 | 3024 | |
| 2554 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2555 | - $field_icon_af = '';  | 
                                                        |
| 2556 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2557 | - $field_icon_af = '<i class="fa fa-calendar"></i>';  | 
                                                        |
| 2558 | -                            } else {
 | 
                                                        |
| 2559 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2560 | - $field_icon = '';  | 
                                                        |
| 2561 | - }  | 
                                                        |
| 3025 | + endif;  | 
                                                        |
| 3026 | + endif;  | 
                                                        |
| 2562 | 3027 | |
| 2563 | - $geodir_odd_even = '';  | 
                                                        |
| 2564 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 3028 | + break;  | 
                                                        |
| 2565 | 3029 | |
| 2566 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2567 | - if ($i % 2 == 0)  | 
                                                        |
| 2568 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3030 | + case 'textarea':  | 
                                                        |
| 3031 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2569 | 3032 | |
| 2570 | - $i++;  | 
                                                        |
| 2571 | - }  | 
                                                        |
| 3033 | +						if (!empty($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2572 | 3034 | |
| 2573 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2574 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2575 | - $html .= '</span>' . $value . '</div>';  | 
                                                        |
| 3035 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 3036 | + $field_icon_af = '';  | 
                                                        |
| 3037 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 3038 | + $field_icon_af = '';  | 
                                                        |
| 3039 | +							} else {
 | 
                                                        |
| 3040 | + $field_icon_af = $field_icon;  | 
                                                        |
| 3041 | + $field_icon = '';  | 
                                                        |
| 3042 | + }  | 
                                                        |
| 3043 | +  | 
                                                        |
| 3044 | + $geodir_odd_even = '';  | 
                                                        |
| 3045 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 3046 | +  | 
                                                        |
| 3047 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 3048 | + if ($i % 2 == 0)  | 
                                                        |
| 3049 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3050 | +  | 
                                                        |
| 3051 | + $i++;  | 
                                                        |
| 3052 | + }  | 
                                                        |
| 2576 | 3053 | |
| 2577 | - endif;  | 
                                                        |
| 3054 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3055 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3056 | +							$html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 2578 | 3057 | |
| 2579 | - break;  | 
                                                        |
| 3058 | + }  | 
                                                        |
| 3059 | + break;  | 
                                                        |
| 2580 | 3060 | |
| 2581 | - case 'text':  | 
                                                        |
| 3061 | + case 'html':  | 
                                                        |
| 3062 | +						if (!empty($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2582 | 3063 | |
| 2583 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 3064 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 3065 | + $field_icon_af = '';  | 
                                                        |
| 3066 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 3067 | + $field_icon_af = '';  | 
                                                        |
| 3068 | +							} else {
 | 
                                                        |
| 3069 | + $field_icon_af = $field_icon;  | 
                                                        |
| 3070 | + $field_icon = '';  | 
                                                        |
| 3071 | + }  | 
                                                        |
| 2584 | 3072 | |
| 2585 | -                        if (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']} != '' && $type['htmlvar_name'] == 'geodir_timing'):
 | 
                                                        |
| 3073 | + $geodir_odd_even = '';  | 
                                                        |
| 3074 | +							if ($fields_location == 'detail') {
 | 
                                                        |
| 2586 | 3075 | |
| 2587 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2588 | - $field_icon_af = '';  | 
                                                        |
| 2589 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2590 | - $field_icon_af = '<i class="fa fa-clock-o"></i>';  | 
                                                        |
| 2591 | -                            } else {
 | 
                                                        |
| 2592 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2593 | - $field_icon = '';  | 
                                                        |
| 2594 | - }  | 
                                                        |
| 3076 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 3077 | + if ($i % 2 == 0)  | 
                                                        |
| 3078 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2595 | 3079 | |
| 2596 | - $geodir_odd_even = '';  | 
                                                        |
| 2597 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 3080 | + $i++;  | 
                                                        |
| 3081 | + }  | 
                                                        |
| 2598 | 3082 | |
| 2599 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2600 | - if ($i % 2 == 0)  | 
                                                        |
| 2601 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3083 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3084 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3085 | +							$html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 3086 | +  | 
                                                        |
| 3087 | + }  | 
                                                        |
| 3088 | + break;  | 
                                                        |
| 3089 | +					case 'taxonomy': {
 | 
                                                        |
| 3090 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 3091 | +						if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
 | 
                                                        |
| 3092 | + $post_taxonomy = $post->post_type . 'category';  | 
                                                        |
| 3093 | +							$field_value = $post->{$html_var};
 | 
                                                        |
| 3094 | + $links = array();  | 
                                                        |
| 3095 | + $terms = array();  | 
                                                        |
| 3096 | + $termsOrdered = array();  | 
                                                        |
| 3097 | +							if (!is_array($field_value)) {
 | 
                                                        |
| 3098 | +								$field_value = explode(",", trim($field_value, ","));
 | 
                                                        |
| 3099 | + }  | 
                                                        |
| 2602 | 3100 | |
| 2603 | - $i++;  | 
                                                        |
| 2604 | - }  | 
                                                        |
| 3101 | + $field_value = array_unique($field_value);  | 
                                                        |
| 2605 | 3102 | |
| 2606 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2607 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2608 | -                            $html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 3103 | +							if (!empty($field_value)) {
 | 
                                                        |
| 3104 | +								foreach ($field_value as $term) {
 | 
                                                        |
| 3105 | + $term = trim($term);  | 
                                                        |
| 2609 | 3106 | |
| 2610 | -                        elseif (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']}):
 | 
                                                        |
| 3107 | +									if ($term != '') {
 | 
                                                        |
| 3108 | +										$term = get_term_by('id', $term, $html_var);
 | 
                                                        |
| 3109 | +										if (is_object($term)) {
 | 
                                                        |
| 3110 | + $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";  | 
                                                        |
| 3111 | + $terms[] = $term;  | 
                                                        |
| 3112 | + }  | 
                                                        |
| 3113 | + }  | 
                                                        |
| 3114 | + }  | 
                                                        |
| 3115 | +								if (!empty($links)) {
 | 
                                                        |
| 3116 | + // order alphabetically  | 
                                                        |
| 3117 | + asort($links);  | 
                                                        |
| 3118 | +									foreach (array_keys($links) as $key) {
 | 
                                                        |
| 3119 | + $termsOrdered[$key] = $terms[$key];  | 
                                                        |
| 3120 | + }  | 
                                                        |
| 3121 | + $terms = $termsOrdered;  | 
                                                        |
| 3122 | + }  | 
                                                        |
| 3123 | + }  | 
                                                        |
| 3124 | +							$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
 | 
                                                        |
| 3125 | +  | 
                                                        |
| 3126 | +							if ($html_value != '') {
 | 
                                                        |
| 3127 | +								if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 3128 | + $field_icon_af = '';  | 
                                                        |
| 3129 | +								} else if ($field_icon == '') {
 | 
                                                        |
| 3130 | + $field_icon_af = '';  | 
                                                        |
| 3131 | +								} else {
 | 
                                                        |
| 3132 | + $field_icon_af = $field_icon;  | 
                                                        |
| 3133 | + $field_icon = '';  | 
                                                        |
| 3134 | + }  | 
                                                        |
| 3135 | +  | 
                                                        |
| 3136 | + $geodir_odd_even = '';  | 
                                                        |
| 3137 | +								if ($fields_location == 'detail') {
 | 
                                                        |
| 3138 | + $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 3139 | +									if ($i % 2 == 0) {
 | 
                                                        |
| 3140 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3141 | + }  | 
                                                        |
| 3142 | + $i++;  | 
                                                        |
| 3143 | + }  | 
                                                        |
| 3144 | +  | 
                                                        |
| 3145 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3146 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3147 | + $html .= '</span> ' . $html_value . '</div>';  | 
                                                        |
| 3148 | + }  | 
                                                        |
| 3149 | + }  | 
                                                        |
| 3150 | + }  | 
                                                        |
| 3151 | + break;  | 
                                                        |
| 2611 | 3152 | |
| 2612 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2613 | - $field_icon_af = '';  | 
                                                        |
| 2614 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2615 | - $field_icon_af = '';  | 
                                                        |
| 2616 | -                            } else {
 | 
                                                        |
| 2617 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2618 | - $field_icon = '';  | 
                                                        |
| 2619 | - }  | 
                                                        |
| 3153 | + }  | 
                                                        |
| 2620 | 3154 | |
| 2621 | - $geodir_odd_even = '';  | 
                                                        |
| 2622 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2623 | -  | 
                                                        |
| 2624 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2625 | - if ($i % 2 == 0)  | 
                                                        |
| 2626 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2627 | -  | 
                                                        |
| 2628 | - $i++;  | 
                                                        |
| 2629 | - }  | 
                                                        |
| 2630 | -  | 
                                                        |
| 2631 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2632 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2633 | -                            $html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 3155 | + if ($html):  | 
                                                        |
| 2634 | 3156 | |
| 2635 | - endif;  | 
                                                        |
| 3157 | + /**  | 
                                                        |
| 3158 | + * Called before a custom fields is output on the frontend.  | 
                                                        |
| 3159 | + *  | 
                                                        |
| 3160 | + * @since 1.0.0  | 
                                                        |
| 3161 | + * @param string $html_var The HTML variable name for the field.  | 
                                                        |
| 3162 | + */  | 
                                                        |
| 3163 | +					do_action("geodir_before_show_{$html_var}");
 | 
                                                        |
| 3164 | + /**  | 
                                                        |
| 3165 | + * Filter custom field output.  | 
                                                        |
| 3166 | + *  | 
                                                        |
| 3167 | + * @since 1.0.0  | 
                                                        |
| 3168 | + *  | 
                                                        |
| 3169 | + * @param string $html_var The HTML variable name for the field.  | 
                                                        |
| 3170 | + * @param string $html Custom field unfiltered HTML.  | 
                                                        |
| 3171 | + * @param array $variables_array Custom field variables array.  | 
                                                        |
| 3172 | + */  | 
                                                        |
| 3173 | +					if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
 | 
                                                        |
| 2636 | 3174 | |
| 2637 | - break;  | 
                                                        |
| 3175 | + /**  | 
                                                        |
| 3176 | + * Called after a custom fields is output on the frontend.  | 
                                                        |
| 3177 | + *  | 
                                                        |
| 3178 | + * @since 1.0.0  | 
                                                        |
| 3179 | + * @param string $html_var The HTML variable name for the field.  | 
                                                        |
| 3180 | + */  | 
                                                        |
| 3181 | +					do_action("geodir_after_show_{$html_var}");
 | 
                                                        |
| 2638 | 3182 | |
| 2639 | - case 'radio':  | 
                                                        |
| 3183 | + endif;  | 
                                                        |
| 2640 | 3184 | |
| 2641 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2642 | -                        if(!isset($post->{$type['htmlvar_name']})){continue;}
 | 
                                                        |
| 2643 | -                        $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        |
| 2644 | -                        if ($post->{$type['htmlvar_name']} != ''):
 | 
                                                        |
| 2645 | -  | 
                                                        |
| 2646 | -                            if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
 | 
                                                        |
| 2647 | -                                $html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2648 | -                            } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
 | 
                                                        |
| 2649 | -                                $html_val = __('Yes', 'geodirectory');
 | 
                                                        |
| 2650 | -                            } else {
 | 
                                                        |
| 2651 | -                                if (!empty($type['option_values'])) {
 | 
                                                        |
| 2652 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2653 | -  | 
                                                        |
| 2654 | -                                    if (!empty($cf_option_values)) {
 | 
                                                        |
| 2655 | -                                        foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2656 | -                                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2657 | - $html_val = $cf_option_value['label'];  | 
                                                        |
| 2658 | - }  | 
                                                        |
| 2659 | - }  | 
                                                        |
| 2660 | - }  | 
                                                        |
| 2661 | - }  | 
                                                        |
| 2662 | - }  | 
                                                        |
| 2663 | -  | 
                                                        |
| 2664 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2665 | - $field_icon_af = '';  | 
                                                        |
| 2666 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2667 | - $field_icon_af = '';  | 
                                                        |
| 2668 | -                            } else {
 | 
                                                        |
| 2669 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2670 | - $field_icon = '';  | 
                                                        |
| 2671 | - }  | 
                                                        |
| 3185 | + }  | 
                                                        |
| 2672 | 3186 | |
| 2673 | - $geodir_odd_even = '';  | 
                                                        |
| 2674 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 3187 | + //echo '</div>';  | 
                                                        |
| 2675 | 3188 | |
| 2676 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2677 | - if ($i % 2 == 0)  | 
                                                        |
| 2678 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3189 | + }  | 
                                                        |
| 2679 | 3190 | |
| 2680 | - $i++;  | 
                                                        |
| 2681 | - }  | 
                                                        |
| 2682 | 3191 | |
| 2683 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2684 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2685 | - $html .= '</span>' . $html_val . '</div>';  | 
                                                        |
| 2686 | - endif;  | 
                                                        |
| 2687 | -  | 
                                                        |
| 2688 | - break;  | 
                                                        |
| 2689 | -  | 
                                                        |
| 2690 | - case 'checkbox':  | 
                                                        |
| 2691 | -  | 
                                                        |
| 2692 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2693 | -  | 
                                                        |
| 2694 | -                        if ((int)$post->{$html_var} == 1):
 | 
                                                        |
| 3192 | + return $html = ob_get_clean();  | 
                                                        |
| 2695 | 3193 | |
| 2696 | -                            if ($post->{$type['htmlvar_name']} == '1'):
 | 
                                                        |
| 2697 | -                                $html_val = __('Yes', 'geodirectory');
 | 
                                                        |
| 2698 | - else:  | 
                                                        |
| 2699 | -                                $html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2700 | - endif;  | 
                                                        |
| 2701 | -  | 
                                                        |
| 2702 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2703 | - $field_icon_af = '';  | 
                                                        |
| 2704 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2705 | - $field_icon_af = '';  | 
                                                        |
| 2706 | -                            } else {
 | 
                                                        |
| 2707 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2708 | - $field_icon = '';  | 
                                                        |
| 2709 | - }  | 
                                                        |
| 2710 | -  | 
                                                        |
| 2711 | - $geodir_odd_even = '';  | 
                                                        |
| 2712 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2713 | -  | 
                                                        |
| 2714 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2715 | - if ($i % 2 == 0)  | 
                                                        |
| 2716 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2717 | -  | 
                                                        |
| 2718 | - $i++;  | 
                                                        |
| 2719 | - }  | 
                                                        |
| 2720 | -  | 
                                                        |
| 2721 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2722 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2723 | - $html .= '</span>' . $html_val . '</div>';  | 
                                                        |
| 2724 | - endif;  | 
                                                        |
| 2725 | -  | 
                                                        |
| 2726 | - break;  | 
                                                        |
| 2727 | -  | 
                                                        |
| 2728 | - case 'select':  | 
                                                        |
| 2729 | -  | 
                                                        |
| 2730 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2731 | -                        if(!isset($post->{$type['htmlvar_name']})){continue;}
 | 
                                                        |
| 2732 | -                        if ($post->{$type['htmlvar_name']}):
 | 
                                                        |
| 2733 | -                            $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        |
| 2734 | -  | 
                                                        |
| 2735 | -                            if (!empty($type['option_values'])) {
 | 
                                                        |
| 2736 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2737 | -  | 
                                                        |
| 2738 | -                                if (!empty($cf_option_values)) {
 | 
                                                        |
| 2739 | -                                    foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2740 | -                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2741 | - //$field_value = $cf_option_value['label']; // no longer needed here.  | 
                                                        |
| 2742 | - }  | 
                                                        |
| 2743 | - }  | 
                                                        |
| 2744 | - }  | 
                                                        |
| 2745 | - }  | 
                                                        |
| 2746 | -  | 
                                                        |
| 2747 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2748 | - $field_icon_af = '';  | 
                                                        |
| 2749 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2750 | - $field_icon_af = '';  | 
                                                        |
| 2751 | -                            } else {
 | 
                                                        |
| 2752 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2753 | - $field_icon = '';  | 
                                                        |
| 2754 | - }  | 
                                                        |
| 2755 | -  | 
                                                        |
| 2756 | - $geodir_odd_even = '';  | 
                                                        |
| 2757 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2758 | -  | 
                                                        |
| 2759 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2760 | - if ($i % 2 == 0)  | 
                                                        |
| 2761 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2762 | -  | 
                                                        |
| 2763 | - $i++;  | 
                                                        |
| 2764 | - }  | 
                                                        |
| 2765 | -  | 
                                                        |
| 2766 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2767 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2768 | - $html .= '</span>' . $field_value . '</div>';  | 
                                                        |
| 2769 | - endif;  | 
                                                        |
| 2770 | -  | 
                                                        |
| 2771 | - break;  | 
                                                        |
| 2772 | -  | 
                                                        |
| 2773 | -  | 
                                                        |
| 2774 | - case 'multiselect':  | 
                                                        |
| 2775 | -  | 
                                                        |
| 2776 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2777 | -  | 
                                                        |
| 2778 | -                        if (!empty($post->{$type['htmlvar_name']})):
 | 
                                                        |
| 2779 | -  | 
                                                        |
| 2780 | -                            if (is_array($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2781 | -                                $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2782 | - }  | 
                                                        |
| 2783 | -  | 
                                                        |
| 2784 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2785 | - $field_icon_af = '';  | 
                                                        |
| 2786 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2787 | - $field_icon_af = '';  | 
                                                        |
| 2788 | -                            } else {
 | 
                                                        |
| 2789 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2790 | - $field_icon = '';  | 
                                                        |
| 2791 | - }  | 
                                                        |
| 2792 | -  | 
                                                        |
| 2793 | -                            $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
 | 
                                                        |
| 2794 | -  | 
                                                        |
| 2795 | - $option_values = array();  | 
                                                        |
| 2796 | -                            if (!empty($type['option_values'])) {
 | 
                                                        |
| 2797 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2798 | -  | 
                                                        |
| 2799 | -                                if (!empty($cf_option_values)) {
 | 
                                                        |
| 2800 | -                                    foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2801 | -                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
 | 
                                                        |
| 2802 | - $option_values[] = $cf_option_value['label'];  | 
                                                        |
| 2803 | - }  | 
                                                        |
| 2804 | - }  | 
                                                        |
| 2805 | - }  | 
                                                        |
| 2806 | - }  | 
                                                        |
| 2807 | -  | 
                                                        |
| 2808 | - $geodir_odd_even = '';  | 
                                                        |
| 2809 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2810 | -  | 
                                                        |
| 2811 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2812 | - if ($i % 2 == 0)  | 
                                                        |
| 2813 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2814 | -  | 
                                                        |
| 2815 | - $i++;  | 
                                                        |
| 2816 | - }  | 
                                                        |
| 2817 | -  | 
                                                        |
| 2818 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2819 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2820 | - $html .= '</span>';  | 
                                                        |
| 2821 | -  | 
                                                        |
| 2822 | -                            if (count($option_values) > 1) {
 | 
                                                        |
| 2823 | - $html .= '<ul>';  | 
                                                        |
| 2824 | -  | 
                                                        |
| 2825 | -                                foreach ($option_values as $val) {
 | 
                                                        |
| 2826 | - $html .= '<li>' . $val . '</li>';  | 
                                                        |
| 2827 | - }  | 
                                                        |
| 2828 | -  | 
                                                        |
| 2829 | - $html .= '</ul>';  | 
                                                        |
| 2830 | -                            } else {
 | 
                                                        |
| 2831 | -                                $html .= $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2832 | - }  | 
                                                        |
| 2833 | -  | 
                                                        |
| 2834 | - $html .= '</div>';  | 
                                                        |
| 2835 | - endif;  | 
                                                        |
| 2836 | - break;  | 
                                                        |
| 2837 | - case 'email':  | 
                                                        |
| 2838 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2839 | -                        if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
 | 
                                                        |
| 2840 | - continue; // Remove Send Enquiry | Send To Friend from listings page  | 
                                                        |
| 2841 | - }  | 
                                                        |
| 2842 | -  | 
                                                        |
| 2843 | -                        if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2844 | - $send_to_friend = true;  | 
                                                        |
| 2845 | - $b_send_inquiry = '';  | 
                                                        |
| 2846 | - $b_sendtofriend = '';  | 
                                                        |
| 2847 | -  | 
                                                        |
| 2848 | - $html = '';  | 
                                                        |
| 2849 | -                            if (!$preview) {
 | 
                                                        |
| 2850 | - $b_send_inquiry = 'b_send_inquiry';  | 
                                                        |
| 2851 | - $b_sendtofriend = 'b_sendtofriend';  | 
                                                        |
| 2852 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';  | 
                                                        |
| 2853 | - }  | 
                                                        |
| 2854 | -  | 
                                                        |
| 2855 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2856 | - $field_icon_af = '';  | 
                                                        |
| 2857 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2858 | - $field_icon_af = '<i class="fa fa-envelope"></i>';  | 
                                                        |
| 2859 | -                            } else {
 | 
                                                        |
| 2860 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2861 | - $field_icon = '';  | 
                                                        |
| 2862 | - }  | 
                                                        |
| 2863 | -  | 
                                                        |
| 2864 | - $geodir_odd_even = '';  | 
                                                        |
| 2865 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 2866 | -  | 
                                                        |
| 2867 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2868 | - if ($i % 2 == 0)  | 
                                                        |
| 2869 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2870 | -  | 
                                                        |
| 2871 | - $i++;  | 
                                                        |
| 2872 | - }  | 
                                                        |
| 2873 | -  | 
                                                        |
| 2874 | - $html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2875 | - $seperator = '';  | 
                                                        |
| 2876 | -                            if ($post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2877 | - $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';  | 
                                                        |
| 2878 | - $seperator = ' | ';  | 
                                                        |
| 2879 | - }  | 
                                                        |
| 2880 | -  | 
                                                        |
| 2881 | -                            if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
 | 
                                                        |
| 2882 | - $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';  | 
                                                        |
| 2883 | - }  | 
                                                        |
| 2884 | -  | 
                                                        |
| 2885 | - $html .= '</span></div>';  | 
                                                        |
| 2886 | -  | 
                                                        |
| 2887 | -  | 
                                                        |
| 2888 | -                            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
 | 
                                                        |
| 2889 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';  | 
                                                        |
| 2890 | -                            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
 | 
                                                        |
| 2891 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';  | 
                                                        |
| 2892 | -                            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
 | 
                                                        |
| 2893 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';  | 
                                                        |
| 2894 | - }  | 
                                                        |
| 2895 | -  | 
                                                        |
| 2896 | -                            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
 | 
                                                        |
| 2897 | -  | 
                                                        |
| 2898 | -                        } else {
 | 
                                                        |
| 2899 | -  | 
                                                        |
| 2900 | -                            if ($post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2901 | -                                if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2902 | - $field_icon_af = '';  | 
                                                        |
| 2903 | -                                } elseif ($field_icon == '') {
 | 
                                                        |
| 2904 | - $field_icon_af = '<i class="fa fa-envelope"></i>';  | 
                                                        |
| 2905 | -                                } else {
 | 
                                                        |
| 2906 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2907 | - $field_icon = '';  | 
                                                        |
| 2908 | - }  | 
                                                        |
| 2909 | -  | 
                                                        |
| 2910 | - $geodir_odd_even = '';  | 
                                                        |
| 2911 | -                                if ($fields_location == 'detail') {
 | 
                                                        |
| 2912 | -  | 
                                                        |
| 2913 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 2914 | - if ($i % 2 == 0)  | 
                                                        |
| 2915 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2916 | -  | 
                                                        |
| 2917 | - $i++;  | 
                                                        |
| 2918 | - }  | 
                                                        |
| 2919 | -  | 
                                                        |
| 2920 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2921 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2922 | - $html .= '</span><span class="geodir-email-address-output">';  | 
                                                        |
| 2923 | -                                $email = $post->{$type['htmlvar_name']} ;
 | 
                                                        |
| 2924 | -                                if($e_split = explode('@',$email)){
 | 
                                                        |
| 2925 | - /**  | 
                                                        |
| 2926 | - * Filter email custom field name output.  | 
                                                        |
| 2927 | - *  | 
                                                        |
| 2928 | - * @since 1.5.3  | 
                                                        |
| 2929 | - *  | 
                                                        |
| 2930 | - * @param string $email The email string being output.  | 
                                                        |
| 2931 | - * @param array $type Custom field variables array.  | 
                                                        |
| 2932 | - */  | 
                                                        |
| 2933 | -                                    $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
 | 
                                                        |
| 2934 | -                                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
 | 
                                                        |
| 2935 | -                                }else{
 | 
                                                        |
| 2936 | - $html .= $email;  | 
                                                        |
| 2937 | - }  | 
                                                        |
| 2938 | - $html .= '</span></div>';  | 
                                                        |
| 2939 | - }  | 
                                                        |
| 2940 | -  | 
                                                        |
| 2941 | - }  | 
                                                        |
| 2942 | -  | 
                                                        |
| 2943 | - break;  | 
                                                        |
| 2944 | -  | 
                                                        |
| 2945 | -  | 
                                                        |
| 2946 | - case 'file':  | 
                                                        |
| 2947 | -  | 
                                                        |
| 2948 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2949 | -  | 
                                                        |
| 2950 | -                        if (!empty($post->{$type['htmlvar_name']})):
 | 
                                                        |
| 2951 | -  | 
                                                        |
| 2952 | -                            $files = explode(",", $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2953 | - if (!empty($files)):  | 
                                                        |
| 2954 | -  | 
                                                        |
| 2955 | - $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;  | 
                                                        |
| 2956 | -                                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 2957 | -  | 
                                                        |
| 2958 | - $file_paths = '';  | 
                                                        |
| 2959 | -                                foreach ($files as $file) {
 | 
                                                        |
| 2960 | -                                    if (!empty($file)) {
 | 
                                                        |
| 2961 | -  | 
                                                        |
| 2962 | - // $filetype = wp_check_filetype($file);  | 
                                                        |
| 2963 | -  | 
                                                        |
| 2964 | -                                        $image_name_arr = explode('/', $file);
 | 
                                                        |
| 2965 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];  | 
                                                        |
| 2966 | - $filename = end($image_name_arr);  | 
                                                        |
| 2967 | -                                        $img_name_arr = explode('.', $filename);
 | 
                                                        |
| 2968 | -  | 
                                                        |
| 2969 | - $arr_file_type = wp_check_filetype($filename);  | 
                                                        |
| 2970 | -                                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
 | 
                                                        |
| 2971 | - continue;  | 
                                                        |
| 2972 | - }  | 
                                                        |
| 2973 | -  | 
                                                        |
| 2974 | - $uploaded_file_type = $arr_file_type['type'];  | 
                                                        |
| 2975 | - $uploaded_file_ext = $arr_file_type['ext'];  | 
                                                        |
| 2976 | -  | 
                                                        |
| 2977 | -                                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
 | 
                                                        |
| 2978 | - continue; // Invalid file type.  | 
                                                        |
| 2979 | - }  | 
                                                        |
| 2980 | -  | 
                                                        |
| 2981 | -                                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
 | 
                                                        |
| 2982 | -                                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
 | 
                                                        |
| 2983 | -  | 
                                                        |
| 2984 | - // If the uploaded file is image  | 
                                                        |
| 2985 | -                                        if (in_array($uploaded_file_type, $image_file_types)) {
 | 
                                                        |
| 2986 | - $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';  | 
                                                        |
| 2987 | - $file_paths .= '<a href="'.$file.'">';  | 
                                                        |
| 2988 | -                                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
 | 
                                                        |
| 2989 | - $file_paths .= '</a>';  | 
                                                        |
| 2990 | - //$file_paths .= '<img src="'.$file.'" />';  | 
                                                        |
| 2991 | - $file_paths .= '</div>';  | 
                                                        |
| 2992 | -                                        } else {
 | 
                                                        |
| 2993 | - $ext_path = '_' . $html_var . '_';  | 
                                                        |
| 2994 | - $filename = explode($ext_path, $filename);  | 
                                                        |
| 2995 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';  | 
                                                        |
| 2996 | - }  | 
                                                        |
| 2997 | - }  | 
                                                        |
| 2998 | - }  | 
                                                        |
| 2999 | -  | 
                                                        |
| 3000 | -                                if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 3001 | - $field_icon_af = '';  | 
                                                        |
| 3002 | -                                } elseif ($field_icon == '') {
 | 
                                                        |
| 3003 | - $field_icon_af = '';  | 
                                                        |
| 3004 | -                                } else {
 | 
                                                        |
| 3005 | - $field_icon_af = $field_icon;  | 
                                                        |
| 3006 | - $field_icon = '';  | 
                                                        |
| 3007 | - }  | 
                                                        |
| 3008 | -  | 
                                                        |
| 3009 | - $geodir_odd_even = '';  | 
                                                        |
| 3010 | -                                if ($fields_location == 'detail') {
 | 
                                                        |
| 3011 | -  | 
                                                        |
| 3012 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 3013 | - if ($i % 2 == 0)  | 
                                                        |
| 3014 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3015 | -  | 
                                                        |
| 3016 | - $i++;  | 
                                                        |
| 3017 | - }  | 
                                                        |
| 3018 | -  | 
                                                        |
| 3019 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' geodir-custom-file-box ' . $type['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3020 | - $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';  | 
                                                        |
| 3021 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3022 | - $html .= '</span>';  | 
                                                        |
| 3023 | - $html .= $file_paths . '</div></div>';  | 
                                                        |
| 3024 | -  | 
                                                        |
| 3025 | - endif;  | 
                                                        |
| 3026 | - endif;  | 
                                                        |
| 3027 | -  | 
                                                        |
| 3028 | - break;  | 
                                                        |
| 3029 | -  | 
                                                        |
| 3030 | - case 'textarea':  | 
                                                        |
| 3031 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 3032 | -  | 
                                                        |
| 3033 | -                        if (!empty($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 3034 | -  | 
                                                        |
| 3035 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 3036 | - $field_icon_af = '';  | 
                                                        |
| 3037 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 3038 | - $field_icon_af = '';  | 
                                                        |
| 3039 | -                            } else {
 | 
                                                        |
| 3040 | - $field_icon_af = $field_icon;  | 
                                                        |
| 3041 | - $field_icon = '';  | 
                                                        |
| 3042 | - }  | 
                                                        |
| 3043 | -  | 
                                                        |
| 3044 | - $geodir_odd_even = '';  | 
                                                        |
| 3045 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 3046 | -  | 
                                                        |
| 3047 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 3048 | - if ($i % 2 == 0)  | 
                                                        |
| 3049 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3050 | -  | 
                                                        |
| 3051 | - $i++;  | 
                                                        |
| 3052 | - }  | 
                                                        |
| 3053 | -  | 
                                                        |
| 3054 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3055 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3056 | -                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 3057 | -  | 
                                                        |
| 3058 | - }  | 
                                                        |
| 3059 | - break;  | 
                                                        |
| 3060 | -  | 
                                                        |
| 3061 | - case 'html':  | 
                                                        |
| 3062 | -                        if (!empty($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 3063 | -  | 
                                                        |
| 3064 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 3065 | - $field_icon_af = '';  | 
                                                        |
| 3066 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 3067 | - $field_icon_af = '';  | 
                                                        |
| 3068 | -                            } else {
 | 
                                                        |
| 3069 | - $field_icon_af = $field_icon;  | 
                                                        |
| 3070 | - $field_icon = '';  | 
                                                        |
| 3071 | - }  | 
                                                        |
| 3072 | -  | 
                                                        |
| 3073 | - $geodir_odd_even = '';  | 
                                                        |
| 3074 | -                            if ($fields_location == 'detail') {
 | 
                                                        |
| 3075 | -  | 
                                                        |
| 3076 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 3077 | - if ($i % 2 == 0)  | 
                                                        |
| 3078 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3079 | -  | 
                                                        |
| 3080 | - $i++;  | 
                                                        |
| 3081 | - }  | 
                                                        |
| 3082 | -  | 
                                                        |
| 3083 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3084 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3085 | -                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 3086 | -  | 
                                                        |
| 3087 | - }  | 
                                                        |
| 3088 | - break;  | 
                                                        |
| 3089 | -                    case 'taxonomy': {
 | 
                                                        |
| 3090 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 3091 | -                        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
 | 
                                                        |
| 3092 | - $post_taxonomy = $post->post_type . 'category';  | 
                                                        |
| 3093 | -                            $field_value = $post->{$html_var};
 | 
                                                        |
| 3094 | - $links = array();  | 
                                                        |
| 3095 | - $terms = array();  | 
                                                        |
| 3096 | - $termsOrdered = array();  | 
                                                        |
| 3097 | -                            if (!is_array($field_value)) {
 | 
                                                        |
| 3098 | -                                $field_value = explode(",", trim($field_value, ","));
 | 
                                                        |
| 3099 | - }  | 
                                                        |
| 3100 | -  | 
                                                        |
| 3101 | - $field_value = array_unique($field_value);  | 
                                                        |
| 3102 | -  | 
                                                        |
| 3103 | -                            if (!empty($field_value)) {
 | 
                                                        |
| 3104 | -                                foreach ($field_value as $term) {
 | 
                                                        |
| 3105 | - $term = trim($term);  | 
                                                        |
| 3106 | -  | 
                                                        |
| 3107 | -                                    if ($term != '') {
 | 
                                                        |
| 3108 | -                                        $term = get_term_by('id', $term, $html_var);
 | 
                                                        |
| 3109 | -                                        if (is_object($term)) {
 | 
                                                        |
| 3110 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";  | 
                                                        |
| 3111 | - $terms[] = $term;  | 
                                                        |
| 3112 | - }  | 
                                                        |
| 3113 | - }  | 
                                                        |
| 3114 | - }  | 
                                                        |
| 3115 | -                                if (!empty($links)) {
 | 
                                                        |
| 3116 | - // order alphabetically  | 
                                                        |
| 3117 | - asort($links);  | 
                                                        |
| 3118 | -                                    foreach (array_keys($links) as $key) {
 | 
                                                        |
| 3119 | - $termsOrdered[$key] = $terms[$key];  | 
                                                        |
| 3120 | - }  | 
                                                        |
| 3121 | - $terms = $termsOrdered;  | 
                                                        |
| 3122 | - }  | 
                                                        |
| 3123 | - }  | 
                                                        |
| 3124 | -                            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
 | 
                                                        |
| 3125 | -  | 
                                                        |
| 3126 | -                            if ($html_value != '') {
 | 
                                                        |
| 3127 | -                                if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 3128 | - $field_icon_af = '';  | 
                                                        |
| 3129 | -                                } else if ($field_icon == '') {
 | 
                                                        |
| 3130 | - $field_icon_af = '';  | 
                                                        |
| 3131 | -                                } else {
 | 
                                                        |
| 3132 | - $field_icon_af = $field_icon;  | 
                                                        |
| 3133 | - $field_icon = '';  | 
                                                        |
| 3134 | - }  | 
                                                        |
| 3135 | -  | 
                                                        |
| 3136 | - $geodir_odd_even = '';  | 
                                                        |
| 3137 | -                                if ($fields_location == 'detail') {
 | 
                                                        |
| 3138 | - $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        |
| 3139 | -                                    if ($i % 2 == 0) {
 | 
                                                        |
| 3140 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3141 | - }  | 
                                                        |
| 3142 | - $i++;  | 
                                                        |
| 3143 | - }  | 
                                                        |
| 3144 | -  | 
                                                        |
| 3145 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3146 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3147 | - $html .= '</span> ' . $html_value . '</div>';  | 
                                                        |
| 3148 | - }  | 
                                                        |
| 3149 | - }  | 
                                                        |
| 3150 | - }  | 
                                                        |
| 3151 | - break;  | 
                                                        |
| 3152 | -  | 
                                                        |
| 3153 | - }  | 
                                                        |
| 3154 | -  | 
                                                        |
| 3155 | - if ($html):  | 
                                                        |
| 3156 | -  | 
                                                        |
| 3157 | - /**  | 
                                                        |
| 3158 | - * Called before a custom fields is output on the frontend.  | 
                                                        |
| 3159 | - *  | 
                                                        |
| 3160 | - * @since 1.0.0  | 
                                                        |
| 3161 | - * @param string $html_var The HTML variable name for the field.  | 
                                                        |
| 3162 | - */  | 
                                                        |
| 3163 | -                    do_action("geodir_before_show_{$html_var}");
 | 
                                                        |
| 3164 | - /**  | 
                                                        |
| 3165 | - * Filter custom field output.  | 
                                                        |
| 3166 | - *  | 
                                                        |
| 3167 | - * @since 1.0.0  | 
                                                        |
| 3168 | - *  | 
                                                        |
| 3169 | - * @param string $html_var The HTML variable name for the field.  | 
                                                        |
| 3170 | - * @param string $html Custom field unfiltered HTML.  | 
                                                        |
| 3171 | - * @param array $variables_array Custom field variables array.  | 
                                                        |
| 3172 | - */  | 
                                                        |
| 3173 | -                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
 | 
                                                        |
| 3174 | -  | 
                                                        |
| 3175 | - /**  | 
                                                        |
| 3176 | - * Called after a custom fields is output on the frontend.  | 
                                                        |
| 3177 | - *  | 
                                                        |
| 3178 | - * @since 1.0.0  | 
                                                        |
| 3179 | - * @param string $html_var The HTML variable name for the field.  | 
                                                        |
| 3180 | - */  | 
                                                        |
| 3181 | -                    do_action("geodir_after_show_{$html_var}");
 | 
                                                        |
| 3182 | -  | 
                                                        |
| 3183 | - endif;  | 
                                                        |
| 3184 | -  | 
                                                        |
| 3185 | - }  | 
                                                        |
| 3186 | -  | 
                                                        |
| 3187 | - //echo '</div>';  | 
                                                        |
| 3188 | -  | 
                                                        |
| 3189 | - }  | 
                                                        |
| 3190 | -  | 
                                                        |
| 3191 | -  | 
                                                        |
| 3192 | - return $html = ob_get_clean();  | 
                                                        |
| 3193 | -  | 
                                                        |
| 3194 | - }  | 
                                                        |
| 3194 | + }  | 
                                                        |
| 3195 | 3195 | }  | 
                                                        
| 3196 | 3196 | |
| 3197 | 3197 |  if (!function_exists('geodir_default_date_format')) {
 | 
                                                        
| 3198 | - /**  | 
                                                        |
| 3199 | - * Returns default date format.  | 
                                                        |
| 3200 | - *  | 
                                                        |
| 3201 | - * @since 1.0.0  | 
                                                        |
| 3202 | - * @package GeoDirectory  | 
                                                        |
| 3203 | - * @return mixed|string|void Returns default date format.  | 
                                                        |
| 3204 | - */  | 
                                                        |
| 3205 | - function geodir_default_date_format()  | 
                                                        |
| 3206 | -    {
 | 
                                                        |
| 3207 | -        if ($format = get_option('date_format'))
 | 
                                                        |
| 3208 | - return $format;  | 
                                                        |
| 3209 | - else  | 
                                                        |
| 3210 | - return 'dd-mm-yy';  | 
                                                        |
| 3211 | - }  | 
                                                        |
| 3198 | + /**  | 
                                                        |
| 3199 | + * Returns default date format.  | 
                                                        |
| 3200 | + *  | 
                                                        |
| 3201 | + * @since 1.0.0  | 
                                                        |
| 3202 | + * @package GeoDirectory  | 
                                                        |
| 3203 | + * @return mixed|string|void Returns default date format.  | 
                                                        |
| 3204 | + */  | 
                                                        |
| 3205 | + function geodir_default_date_format()  | 
                                                        |
| 3206 | +	{
 | 
                                                        |
| 3207 | +		if ($format = get_option('date_format'))
 | 
                                                        |
| 3208 | + return $format;  | 
                                                        |
| 3209 | + else  | 
                                                        |
| 3210 | + return 'dd-mm-yy';  | 
                                                        |
| 3211 | + }  | 
                                                        |
| 3212 | 3212 | }  | 
                                                        
| 3213 | 3213 | |
| 3214 | 3214 |  if (!function_exists('geodir_get_formated_date')) {
 | 
                                                        
| 3215 | - /**  | 
                                                        |
| 3216 | - * Returns formatted date.  | 
                                                        |
| 3217 | - *  | 
                                                        |
| 3218 | - * @since 1.0.0  | 
                                                        |
| 3219 | - * @package GeoDirectory  | 
                                                        |
| 3220 | - * @param string $date Date string to convert.  | 
                                                        |
| 3221 | - * @return bool|int|string Returns formatted date.  | 
                                                        |
| 3222 | - */  | 
                                                        |
| 3223 | - function geodir_get_formated_date($date)  | 
                                                        |
| 3224 | -    {
 | 
                                                        |
| 3225 | -        return mysql2date(get_option('date_format'), $date);
 | 
                                                        |
| 3226 | - }  | 
                                                        |
| 3215 | + /**  | 
                                                        |
| 3216 | + * Returns formatted date.  | 
                                                        |
| 3217 | + *  | 
                                                        |
| 3218 | + * @since 1.0.0  | 
                                                        |
| 3219 | + * @package GeoDirectory  | 
                                                        |
| 3220 | + * @param string $date Date string to convert.  | 
                                                        |
| 3221 | + * @return bool|int|string Returns formatted date.  | 
                                                        |
| 3222 | + */  | 
                                                        |
| 3223 | + function geodir_get_formated_date($date)  | 
                                                        |
| 3224 | +	{
 | 
                                                        |
| 3225 | +		return mysql2date(get_option('date_format'), $date);
 | 
                                                        |
| 3226 | + }  | 
                                                        |
| 3227 | 3227 | }  | 
                                                        
| 3228 | 3228 | |
| 3229 | 3229 |  if (!function_exists('geodir_get_formated_time')) {
 | 
                                                        
| 3230 | - /**  | 
                                                        |
| 3231 | - * Returns formatted time.  | 
                                                        |
| 3232 | - *  | 
                                                        |
| 3233 | - * @since 1.0.0  | 
                                                        |
| 3234 | - * @package GeoDirectory  | 
                                                        |
| 3235 | - * @param string $time Time string to convert.  | 
                                                        |
| 3236 | - * @return bool|int|string Returns formatted time.  | 
                                                        |
| 3237 | - */  | 
                                                        |
| 3238 | - function geodir_get_formated_time($time)  | 
                                                        |
| 3239 | -    {
 | 
                                                        |
| 3240 | -        return mysql2date(get_option('time_format'), $time, $translate = true);
 | 
                                                        |
| 3241 | - }  | 
                                                        |
| 3230 | + /**  | 
                                                        |
| 3231 | + * Returns formatted time.  | 
                                                        |
| 3232 | + *  | 
                                                        |
| 3233 | + * @since 1.0.0  | 
                                                        |
| 3234 | + * @package GeoDirectory  | 
                                                        |
| 3235 | + * @param string $time Time string to convert.  | 
                                                        |
| 3236 | + * @return bool|int|string Returns formatted time.  | 
                                                        |
| 3237 | + */  | 
                                                        |
| 3238 | + function geodir_get_formated_time($time)  | 
                                                        |
| 3239 | +	{
 | 
                                                        |
| 3240 | +		return mysql2date(get_option('time_format'), $time, $translate = true);
 | 
                                                        |
| 3241 | + }  | 
                                                        |
| 3242 | 3242 | }  | 
                                                        
| 3243 | 3243 | |
| 3244 | 3244 | |
| 3245 | 3245 |  if (!function_exists('geodir_save_post_file_fields')) {
 | 
                                                        
| 3246 | - /**  | 
                                                        |
| 3247 | - * Save post file fields  | 
                                                        |
| 3248 | - *  | 
                                                        |
| 3249 | - * @since 1.0.0  | 
                                                        |
| 3250 | - * @since 1.4.7 Added `$extra_fields` parameter.  | 
                                                        |
| 3251 | - * @package GeoDirectory  | 
                                                        |
| 3252 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 3253 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 3254 | - * @global object $current_user Current user object.  | 
                                                        |
| 3255 | - * @param int $post_id  | 
                                                        |
| 3256 | - * @param string $field_id  | 
                                                        |
| 3257 | - * @param array $post_image  | 
                                                        |
| 3258 | - * @param array $extra_fields Array of extra fields.  | 
                                                        |
| 3259 | - */  | 
                                                        |
| 3260 | - function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())  | 
                                                        |
| 3261 | -    {
 | 
                                                        |
| 3246 | + /**  | 
                                                        |
| 3247 | + * Save post file fields  | 
                                                        |
| 3248 | + *  | 
                                                        |
| 3249 | + * @since 1.0.0  | 
                                                        |
| 3250 | + * @since 1.4.7 Added `$extra_fields` parameter.  | 
                                                        |
| 3251 | + * @package GeoDirectory  | 
                                                        |
| 3252 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 3253 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 3254 | + * @global object $current_user Current user object.  | 
                                                        |
| 3255 | + * @param int $post_id  | 
                                                        |
| 3256 | + * @param string $field_id  | 
                                                        |
| 3257 | + * @param array $post_image  | 
                                                        |
| 3258 | + * @param array $extra_fields Array of extra fields.  | 
                                                        |
| 3259 | + */  | 
                                                        |
| 3260 | + function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())  | 
                                                        |
| 3261 | +	{
 | 
                                                        |
| 3262 | 3262 | |
| 3263 | - global $wpdb, $plugin_prefix, $current_user;  | 
                                                        |
| 3263 | + global $wpdb, $plugin_prefix, $current_user;  | 
                                                        |
| 3264 | 3264 | |
| 3265 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 3266 | - //echo $field_id; exit;  | 
                                                        |
| 3267 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3265 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 3266 | + //echo $field_id; exit;  | 
                                                        |
| 3267 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3268 | 3268 | |
| 3269 | - $postcurr_images = array();  | 
                                                        |
| 3270 | - $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);  | 
                                                        |
| 3271 | - $file_urls = '';  | 
                                                        |
| 3269 | + $postcurr_images = array();  | 
                                                        |
| 3270 | + $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);  | 
                                                        |
| 3271 | + $file_urls = '';  | 
                                                        |
| 3272 | 3272 | |
| 3273 | -        if (!empty($post_image)) {
 | 
                                                        |
| 3273 | +		if (!empty($post_image)) {
 | 
                                                        |
| 3274 | 3274 | |
| 3275 | - $invalid_files = array();  | 
                                                        |
| 3275 | + $invalid_files = array();  | 
                                                        |
| 3276 | 3276 | |
| 3277 | - //Get and remove all old images of post from database to set by new order  | 
                                                        |
| 3278 | - $geodir_uploaddir = '';  | 
                                                        |
| 3279 | - $uploads = wp_upload_dir();  | 
                                                        |
| 3280 | - $uploads_dir = $uploads['path'];  | 
                                                        |
| 3277 | + //Get and remove all old images of post from database to set by new order  | 
                                                        |
| 3278 | + $geodir_uploaddir = '';  | 
                                                        |
| 3279 | + $uploads = wp_upload_dir();  | 
                                                        |
| 3280 | + $uploads_dir = $uploads['path'];  | 
                                                        |
| 3281 | 3281 | |
| 3282 | - $geodir_uploadpath = $uploads['path'];  | 
                                                        |
| 3283 | - $geodir_uploadurl = $uploads['url'];  | 
                                                        |
| 3284 | - $sub_dir = $uploads['subdir'];  | 
                                                        |
| 3282 | + $geodir_uploadpath = $uploads['path'];  | 
                                                        |
| 3283 | + $geodir_uploadurl = $uploads['url'];  | 
                                                        |
| 3284 | + $sub_dir = $uploads['subdir'];  | 
                                                        |
| 3285 | 3285 | |
| 3286 | -            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 3286 | +			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 3287 | 3287 | |
| 3288 | -            for ($m = 0; $m < count($post_image); $m++) {
 | 
                                                        |
| 3288 | +			for ($m = 0; $m < count($post_image); $m++) {
 | 
                                                        |
| 3289 | 3289 | |
| 3290 | - /* --------- start ------- */  | 
                                                        |
| 3290 | + /* --------- start ------- */  | 
                                                        |
| 3291 | 3291 | |
| 3292 | -                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
 | 
                                                        |
| 3292 | +				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
 | 
                                                        |
| 3293 | 3293 | |
| 3294 | 3294 | |
| 3295 | - $curr_img_url = $post_image[$m];  | 
                                                        |
| 3296 | -                    $image_name_arr = explode('/', $curr_img_url);
 | 
                                                        |
| 3297 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];  | 
                                                        |
| 3298 | - $filename = end($image_name_arr);  | 
                                                        |
| 3299 | -                    $img_name_arr = explode('.', $filename);
 | 
                                                        |
| 3295 | + $curr_img_url = $post_image[$m];  | 
                                                        |
| 3296 | +					$image_name_arr = explode('/', $curr_img_url);
 | 
                                                        |
| 3297 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];  | 
                                                        |
| 3298 | + $filename = end($image_name_arr);  | 
                                                        |
| 3299 | +					$img_name_arr = explode('.', $filename);
 | 
                                                        |
| 3300 | 3300 | |
| 3301 | - $arr_file_type = wp_check_filetype($filename);  | 
                                                        |
| 3301 | + $arr_file_type = wp_check_filetype($filename);  | 
                                                        |
| 3302 | 3302 | |
| 3303 | -                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
 | 
                                                        |
| 3304 | - continue;  | 
                                                        |
| 3305 | - }  | 
                                                        |
| 3303 | +					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
 | 
                                                        |
| 3304 | + continue;  | 
                                                        |
| 3305 | + }  | 
                                                        |
| 3306 | 3306 | |
| 3307 | - $uploaded_file_type = $arr_file_type['type'];  | 
                                                        |
| 3308 | - $uploaded_file_ext = $arr_file_type['ext'];  | 
                                                        |
| 3307 | + $uploaded_file_type = $arr_file_type['type'];  | 
                                                        |
| 3308 | + $uploaded_file_ext = $arr_file_type['ext'];  | 
                                                        |
| 3309 | 3309 | |
| 3310 | -                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
 | 
                                                        |
| 3311 | - continue; // Invalid file type.  | 
                                                        |
| 3312 | - }  | 
                                                        |
| 3310 | +					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
 | 
                                                        |
| 3311 | + continue; // Invalid file type.  | 
                                                        |
| 3312 | + }  | 
                                                        |
| 3313 | 3313 | |
| 3314 | - // Set an array containing a list of acceptable formats  | 
                                                        |
| 3315 | -                    //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
 | 
                                                        |
| 3314 | + // Set an array containing a list of acceptable formats  | 
                                                        |
| 3315 | +					//$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
 | 
                                                        |
| 3316 | 3316 | |
| 3317 | -                    if (!function_exists('wp_handle_upload'))
 | 
                                                        |
| 3318 | - require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 3317 | +					if (!function_exists('wp_handle_upload'))
 | 
                                                        |
| 3318 | + require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 3319 | 3319 | |
| 3320 | - if (!is_dir($geodir_uploadpath))  | 
                                                        |
| 3321 | - mkdir($geodir_uploadpath);  | 
                                                        |
| 3320 | + if (!is_dir($geodir_uploadpath))  | 
                                                        |
| 3321 | + mkdir($geodir_uploadpath);  | 
                                                        |
| 3322 | 3322 | |
| 3323 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];  | 
                                                        |
| 3324 | -                    $explode_sub_dir = explode("/", $sub_dir);
 | 
                                                        |
| 3325 | -                    if ($curr_img_dir == end($explode_sub_dir)) {
 | 
                                                        |
| 3326 | - $img_path = $geodir_uploadpath . '/' . $filename;  | 
                                                        |
| 3327 | - $img_url = $geodir_uploadurl . '/' . $filename;  | 
                                                        |
| 3328 | -                    } else {
 | 
                                                        |
| 3329 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 3330 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 3331 | - }  | 
                                                        |
| 3323 | + $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];  | 
                                                        |
| 3324 | +					$explode_sub_dir = explode("/", $sub_dir);
 | 
                                                        |
| 3325 | +					if ($curr_img_dir == end($explode_sub_dir)) {
 | 
                                                        |
| 3326 | + $img_path = $geodir_uploadpath . '/' . $filename;  | 
                                                        |
| 3327 | + $img_url = $geodir_uploadurl . '/' . $filename;  | 
                                                        |
| 3328 | +					} else {
 | 
                                                        |
| 3329 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 3330 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 3331 | + }  | 
                                                        |
| 3332 | 3332 | |
| 3333 | - $uploaded_file = '';  | 
                                                        |
| 3334 | - if (file_exists($img_path))  | 
                                                        |
| 3335 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);  | 
                                                        |
| 3333 | + $uploaded_file = '';  | 
                                                        |
| 3334 | + if (file_exists($img_path))  | 
                                                        |
| 3335 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);  | 
                                                        |
| 3336 | 3336 | |
| 3337 | -                    if ($curr_img_dir != $geodir_uploaddir) {
 | 
                                                        |
| 3338 | - if (file_exists($img_path))  | 
                                                        |
| 3339 | - unlink($img_path);  | 
                                                        |
| 3340 | - }  | 
                                                        |
| 3337 | +					if ($curr_img_dir != $geodir_uploaddir) {
 | 
                                                        |
| 3338 | + if (file_exists($img_path))  | 
                                                        |
| 3339 | + unlink($img_path);  | 
                                                        |
| 3340 | + }  | 
                                                        |
| 3341 | 3341 | |
| 3342 | - if (!empty($uploaded_file))  | 
                                                        |
| 3343 | - $file_urls = $geodir_uploadurl . '/' . $new_name;  | 
                                                        |
| 3342 | + if (!empty($uploaded_file))  | 
                                                        |
| 3343 | + $file_urls = $geodir_uploadurl . '/' . $new_name;  | 
                                                        |
| 3344 | 3344 | |
| 3345 | -                } else {
 | 
                                                        |
| 3346 | - $file_urls = $post_image[$m];  | 
                                                        |
| 3347 | - }  | 
                                                        |
| 3348 | - }  | 
                                                        |
| 3345 | +				} else {
 | 
                                                        |
| 3346 | + $file_urls = $post_image[$m];  | 
                                                        |
| 3347 | + }  | 
                                                        |
| 3348 | + }  | 
                                                        |
| 3349 | 3349 | |
| 3350 | 3350 | |
| 3351 | - }  | 
                                                        |
| 3351 | + }  | 
                                                        |
| 3352 | 3352 | |
| 3353 | - //Remove all old attachments and temp images  | 
                                                        |
| 3354 | -        if (!empty($postcurr_images)) {
 | 
                                                        |
| 3353 | + //Remove all old attachments and temp images  | 
                                                        |
| 3354 | +		if (!empty($postcurr_images)) {
 | 
                                                        |
| 3355 | 3355 | |
| 3356 | -            if ($file_urls != $postcurr_images) {
 | 
                                                        |
| 3357 | -                $invalid_files[] = (object)array('src' => $postcurr_images);
 | 
                                                        |
| 3358 | - $invalid_files = (object)$invalid_files;  | 
                                                        |
| 3359 | - }  | 
                                                        |
| 3360 | - }  | 
                                                        |
| 3356 | +			if ($file_urls != $postcurr_images) {
 | 
                                                        |
| 3357 | +				$invalid_files[] = (object)array('src' => $postcurr_images);
 | 
                                                        |
| 3358 | + $invalid_files = (object)$invalid_files;  | 
                                                        |
| 3359 | + }  | 
                                                        |
| 3360 | + }  | 
                                                        |
| 3361 | 3361 | |
| 3362 | - geodir_save_post_meta($post_id, $field_id, $file_urls);  | 
                                                        |
| 3362 | + geodir_save_post_meta($post_id, $field_id, $file_urls);  | 
                                                        |
| 3363 | 3363 | |
| 3364 | - if (!empty($invalid_files))  | 
                                                        |
| 3365 | - geodir_remove_attachments($invalid_files);  | 
                                                        |
| 3364 | + if (!empty($invalid_files))  | 
                                                        |
| 3365 | + geodir_remove_attachments($invalid_files);  | 
                                                        |
| 3366 | 3366 | |
| 3367 | - }  | 
                                                        |
| 3367 | + }  | 
                                                        |
| 3368 | 3368 | }  | 
                                                        
| 3369 | 3369 | |
| 3370 | 3370 | |
@@ -3379,76 +3379,76 @@ discard block  | 
                                                    ||
| 3379 | 3379 | */  | 
                                                        
| 3380 | 3380 | function geodir_custom_upload_mimes($existing_mimes = array())  | 
                                                        
| 3381 | 3381 |  {
 | 
                                                        
| 3382 | - $existing_mimes['wif'] = 'text/plain';  | 
                                                        |
| 3383 | - $existing_mimes['jpg|jpeg'] = 'image/jpeg';  | 
                                                        |
| 3384 | - $existing_mimes['gif'] = 'image/gif';  | 
                                                        |
| 3385 | - $existing_mimes['png'] = 'image/png';  | 
                                                        |
| 3386 | - $existing_mimes['pdf'] = 'application/pdf';  | 
                                                        |
| 3387 | - $existing_mimes['txt'] = 'text/text';  | 
                                                        |
| 3388 | - $existing_mimes['csv'] = 'application/octet-stream';  | 
                                                        |
| 3389 | - $existing_mimes['doc'] = 'application/msword';  | 
                                                        |
| 3390 | - $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';  | 
                                                        |
| 3391 | - $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';  | 
                                                        |
| 3392 | - $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';  | 
                                                        |
| 3393 | - return $existing_mimes;  | 
                                                        |
| 3382 | + $existing_mimes['wif'] = 'text/plain';  | 
                                                        |
| 3383 | + $existing_mimes['jpg|jpeg'] = 'image/jpeg';  | 
                                                        |
| 3384 | + $existing_mimes['gif'] = 'image/gif';  | 
                                                        |
| 3385 | + $existing_mimes['png'] = 'image/png';  | 
                                                        |
| 3386 | + $existing_mimes['pdf'] = 'application/pdf';  | 
                                                        |
| 3387 | + $existing_mimes['txt'] = 'text/text';  | 
                                                        |
| 3388 | + $existing_mimes['csv'] = 'application/octet-stream';  | 
                                                        |
| 3389 | + $existing_mimes['doc'] = 'application/msword';  | 
                                                        |
| 3390 | + $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel';  | 
                                                        |
| 3391 | + $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';  | 
                                                        |
| 3392 | + $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';  | 
                                                        |
| 3393 | + return $existing_mimes;  | 
                                                        |
| 3394 | 3394 | }  | 
                                                        
| 3395 | 3395 | |
| 3396 | 3396 |  if (!function_exists('geodir_plupload_action')) {
 | 
                                                        
| 3397 | 3397 | |
| 3398 | - /**  | 
                                                        |
| 3399 | - * Get upload directory path details  | 
                                                        |
| 3400 | - *  | 
                                                        |
| 3401 | - * @since 1.0.0  | 
                                                        |
| 3402 | - * @package GeoDirectory  | 
                                                        |
| 3403 | - * @global object $current_user Current user object.  | 
                                                        |
| 3404 | - * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.  | 
                                                        |
| 3405 | - * @return mixed Returns upload directory details as an array.  | 
                                                        |
| 3406 | - */  | 
                                                        |
| 3407 | - function geodir_upload_dir($upload)  | 
                                                        |
| 3408 | -    {
 | 
                                                        |
| 3409 | - global $current_user;  | 
                                                        |
| 3410 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;  | 
                                                        |
| 3411 | - $upload['path'] = $upload['basedir'] . $upload['subdir'];  | 
                                                        |
| 3412 | - $upload['url'] = $upload['baseurl'] . $upload['subdir'];  | 
                                                        |
| 3413 | - return $upload;  | 
                                                        |
| 3414 | - }  | 
                                                        |
| 3415 | -  | 
                                                        |
| 3416 | - /**  | 
                                                        |
| 3417 | - * Handles place file and image upload.  | 
                                                        |
| 3418 | - *  | 
                                                        |
| 3419 | - * @since 1.0.0  | 
                                                        |
| 3420 | - * @package GeoDirectory  | 
                                                        |
| 3421 | - */  | 
                                                        |
| 3422 | - function geodir_plupload_action()  | 
                                                        |
| 3423 | -    {
 | 
                                                        |
| 3424 | - // check ajax noonce  | 
                                                        |
| 3425 | - $imgid = $_POST["imgid"];  | 
                                                        |
| 3426 | -  | 
                                                        |
| 3427 | - check_ajax_referer($imgid . 'pluploadan');  | 
                                                        |
| 3428 | -  | 
                                                        |
| 3429 | - // handle custom file uploaddir  | 
                                                        |
| 3430 | -        add_filter('upload_dir', 'geodir_upload_dir');
 | 
                                                        |
| 3431 | -  | 
                                                        |
| 3432 | - // change file orinetation if needed  | 
                                                        |
| 3433 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);  | 
                                                        |
| 3434 | -  | 
                                                        |
| 3435 | - // handle file upload  | 
                                                        |
| 3436 | -        $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
 | 
                                                        |
| 3437 | - // remove handle custom file uploaddir  | 
                                                        |
| 3438 | -        remove_filter('upload_dir', 'geodir_upload_dir');
 | 
                                                        |
| 3439 | -  | 
                                                        |
| 3440 | -        if(!isset($status['url']) && isset($status['error'])){
 | 
                                                        |
| 3441 | - print_r($status);  | 
                                                        |
| 3442 | - }  | 
                                                        |
| 3443 | -  | 
                                                        |
| 3444 | - // send the uploaded file url in response  | 
                                                        |
| 3445 | -        if (isset($status['url'])) {
 | 
                                                        |
| 3446 | - echo $status['url'];  | 
                                                        |
| 3447 | -        } else {
 | 
                                                        |
| 3448 | - echo 'x';  | 
                                                        |
| 3449 | - }  | 
                                                        |
| 3450 | - exit;  | 
                                                        |
| 3451 | - }  | 
                                                        |
| 3398 | + /**  | 
                                                        |
| 3399 | + * Get upload directory path details  | 
                                                        |
| 3400 | + *  | 
                                                        |
| 3401 | + * @since 1.0.0  | 
                                                        |
| 3402 | + * @package GeoDirectory  | 
                                                        |
| 3403 | + * @global object $current_user Current user object.  | 
                                                        |
| 3404 | + * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.  | 
                                                        |
| 3405 | + * @return mixed Returns upload directory details as an array.  | 
                                                        |
| 3406 | + */  | 
                                                        |
| 3407 | + function geodir_upload_dir($upload)  | 
                                                        |
| 3408 | +	{
 | 
                                                        |
| 3409 | + global $current_user;  | 
                                                        |
| 3410 | + $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;  | 
                                                        |
| 3411 | + $upload['path'] = $upload['basedir'] . $upload['subdir'];  | 
                                                        |
| 3412 | + $upload['url'] = $upload['baseurl'] . $upload['subdir'];  | 
                                                        |
| 3413 | + return $upload;  | 
                                                        |
| 3414 | + }  | 
                                                        |
| 3415 | +  | 
                                                        |
| 3416 | + /**  | 
                                                        |
| 3417 | + * Handles place file and image upload.  | 
                                                        |
| 3418 | + *  | 
                                                        |
| 3419 | + * @since 1.0.0  | 
                                                        |
| 3420 | + * @package GeoDirectory  | 
                                                        |
| 3421 | + */  | 
                                                        |
| 3422 | + function geodir_plupload_action()  | 
                                                        |
| 3423 | +	{
 | 
                                                        |
| 3424 | + // check ajax noonce  | 
                                                        |
| 3425 | + $imgid = $_POST["imgid"];  | 
                                                        |
| 3426 | +  | 
                                                        |
| 3427 | + check_ajax_referer($imgid . 'pluploadan');  | 
                                                        |
| 3428 | +  | 
                                                        |
| 3429 | + // handle custom file uploaddir  | 
                                                        |
| 3430 | +		add_filter('upload_dir', 'geodir_upload_dir');
 | 
                                                        |
| 3431 | +  | 
                                                        |
| 3432 | + // change file orinetation if needed  | 
                                                        |
| 3433 | + $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);  | 
                                                        |
| 3434 | +  | 
                                                        |
| 3435 | + // handle file upload  | 
                                                        |
| 3436 | +		$status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
 | 
                                                        |
| 3437 | + // remove handle custom file uploaddir  | 
                                                        |
| 3438 | +		remove_filter('upload_dir', 'geodir_upload_dir');
 | 
                                                        |
| 3439 | +  | 
                                                        |
| 3440 | +		if(!isset($status['url']) && isset($status['error'])){
 | 
                                                        |
| 3441 | + print_r($status);  | 
                                                        |
| 3442 | + }  | 
                                                        |
| 3443 | +  | 
                                                        |
| 3444 | + // send the uploaded file url in response  | 
                                                        |
| 3445 | +		if (isset($status['url'])) {
 | 
                                                        |
| 3446 | + echo $status['url'];  | 
                                                        |
| 3447 | +		} else {
 | 
                                                        |
| 3448 | + echo 'x';  | 
                                                        |
| 3449 | + }  | 
                                                        |
| 3450 | + exit;  | 
                                                        |
| 3451 | + }  | 
                                                        |
| 3452 | 3452 | }  | 
                                                        
| 3453 | 3453 | |
| 3454 | 3454 | /**  | 
                                                        
@@ -3463,17 +3463,17 @@ discard block  | 
                                                    ||
| 3463 | 3463 | */  | 
                                                        
| 3464 | 3464 | function geodir_get_video($post_id)  | 
                                                        
| 3465 | 3465 |  {
 | 
                                                        
| 3466 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 3466 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 3467 | 3467 | |
| 3468 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 3468 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 3469 | 3469 | |
| 3470 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3470 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3471 | 3471 | |
| 3472 | -    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
 | 
                                                        |
| 3472 | +	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
 | 
                                                        |
| 3473 | 3473 | |
| 3474 | -    if ($results) {
 | 
                                                        |
| 3475 | - return $results[0]->geodir_video;  | 
                                                        |
| 3476 | - }  | 
                                                        |
| 3474 | +	if ($results) {
 | 
                                                        |
| 3475 | + return $results[0]->geodir_video;  | 
                                                        |
| 3476 | + }  | 
                                                        |
| 3477 | 3477 | |
| 3478 | 3478 | }  | 
                                                        
| 3479 | 3479 | |
@@ -3489,40 +3489,40 @@ discard block  | 
                                                    ||
| 3489 | 3489 | */  | 
                                                        
| 3490 | 3490 | function geodir_get_special_offers($post_id)  | 
                                                        
| 3491 | 3491 |  {
 | 
                                                        
| 3492 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 3492 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 3493 | 3493 | |
| 3494 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 3494 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 3495 | 3495 | |
| 3496 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3496 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3497 | 3497 | |
| 3498 | -    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
 | 
                                                        |
| 3498 | +	$results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
 | 
                                                        |
| 3499 | 3499 | |
| 3500 | -    if ($results) {
 | 
                                                        |
| 3501 | - return $results[0]->geodir_special_offers;  | 
                                                        |
| 3502 | - }  | 
                                                        |
| 3500 | +	if ($results) {
 | 
                                                        |
| 3501 | + return $results[0]->geodir_special_offers;  | 
                                                        |
| 3502 | + }  | 
                                                        |
| 3503 | 3503 | |
| 3504 | 3504 | }  | 
                                                        
| 3505 | 3505 | |
| 3506 | 3506 |  if (!function_exists('geodir_max_upload_size')) {
 | 
                                                        
| 3507 | - /**  | 
                                                        |
| 3508 | - * Get max upload file size  | 
                                                        |
| 3509 | - *  | 
                                                        |
| 3510 | - * @since 1.0.0  | 
                                                        |
| 3511 | - * @package GeoDirectory  | 
                                                        |
| 3512 | - * @return mixed|void Returns max upload file size.  | 
                                                        |
| 3513 | - */  | 
                                                        |
| 3514 | - function geodir_max_upload_size()  | 
                                                        |
| 3515 | -    {
 | 
                                                        |
| 3516 | -        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
 | 
                                                        |
| 3517 | -  | 
                                                        |
| 3518 | -        if ($max_filesize > 0 && $max_filesize < 1) {
 | 
                                                        |
| 3519 | - $max_filesize = (int)($max_filesize * 1024) . 'kb';  | 
                                                        |
| 3520 | -        } else {
 | 
                                                        |
| 3521 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';  | 
                                                        |
| 3522 | - }  | 
                                                        |
| 3523 | - /** Filter documented in geodirectory-functions/general_functions.php **/  | 
                                                        |
| 3524 | -        return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
 | 
                                                        |
| 3525 | - }  | 
                                                        |
| 3507 | + /**  | 
                                                        |
| 3508 | + * Get max upload file size  | 
                                                        |
| 3509 | + *  | 
                                                        |
| 3510 | + * @since 1.0.0  | 
                                                        |
| 3511 | + * @package GeoDirectory  | 
                                                        |
| 3512 | + * @return mixed|void Returns max upload file size.  | 
                                                        |
| 3513 | + */  | 
                                                        |
| 3514 | + function geodir_max_upload_size()  | 
                                                        |
| 3515 | +	{
 | 
                                                        |
| 3516 | +		$max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
 | 
                                                        |
| 3517 | +  | 
                                                        |
| 3518 | +		if ($max_filesize > 0 && $max_filesize < 1) {
 | 
                                                        |
| 3519 | + $max_filesize = (int)($max_filesize * 1024) . 'kb';  | 
                                                        |
| 3520 | +		} else {
 | 
                                                        |
| 3521 | + $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';  | 
                                                        |
| 3522 | + }  | 
                                                        |
| 3523 | + /** Filter documented in geodirectory-functions/general_functions.php **/  | 
                                                        |
| 3524 | +		return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
 | 
                                                        |
| 3525 | + }  | 
                                                        |
| 3526 | 3526 | }  | 
                                                        
| 3527 | 3527 | |
| 3528 | 3528 | |
@@ -3540,33 +3540,33 @@ discard block  | 
                                                    ||
| 3540 | 3540 | */  | 
                                                        
| 3541 | 3541 | function geodir_add_custom_sort_options($fields, $post_type)  | 
                                                        
| 3542 | 3542 |  {
 | 
                                                        
| 3543 | - global $wpdb;  | 
                                                        |
| 3543 | + global $wpdb;  | 
                                                        |
| 3544 | 3544 | |
| 3545 | -    if ($post_type != '') {
 | 
                                                        |
| 3545 | +	if ($post_type != '') {
 | 
                                                        |
| 3546 | 3546 | |
| 3547 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 3547 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 3548 | 3548 | |
| 3549 | -        if (in_array($post_type, $all_postypes)) {
 | 
                                                        |
| 3549 | +		if (in_array($post_type, $all_postypes)) {
 | 
                                                        |
| 3550 | 3550 | |
| 3551 | - $custom_fields = $wpdb->get_results(  | 
                                                        |
| 3552 | - $wpdb->prepare(  | 
                                                        |
| 3553 | - "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",  | 
                                                        |
| 3554 | - array($post_type)  | 
                                                        |
| 3555 | - ), 'ARRAY_A'  | 
                                                        |
| 3556 | - );  | 
                                                        |
| 3551 | + $custom_fields = $wpdb->get_results(  | 
                                                        |
| 3552 | + $wpdb->prepare(  | 
                                                        |
| 3553 | + "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",  | 
                                                        |
| 3554 | + array($post_type)  | 
                                                        |
| 3555 | + ), 'ARRAY_A'  | 
                                                        |
| 3556 | + );  | 
                                                        |
| 3557 | 3557 | |
| 3558 | -            if (!empty($custom_fields)) {
 | 
                                                        |
| 3558 | +			if (!empty($custom_fields)) {
 | 
                                                        |
| 3559 | 3559 | |
| 3560 | -                foreach ($custom_fields as $val) {
 | 
                                                        |
| 3561 | - $fields[] = $val;  | 
                                                        |
| 3562 | - }  | 
                                                        |
| 3563 | - }  | 
                                                        |
| 3560 | +				foreach ($custom_fields as $val) {
 | 
                                                        |
| 3561 | + $fields[] = $val;  | 
                                                        |
| 3562 | + }  | 
                                                        |
| 3563 | + }  | 
                                                        |
| 3564 | 3564 | |
| 3565 | - }  | 
                                                        |
| 3565 | + }  | 
                                                        |
| 3566 | 3566 | |
| 3567 | - }  | 
                                                        |
| 3567 | + }  | 
                                                        |
| 3568 | 3568 | |
| 3569 | - return $fields;  | 
                                                        |
| 3569 | + return $fields;  | 
                                                        |
| 3570 | 3570 | }  | 
                                                        
| 3571 | 3571 | |
| 3572 | 3572 | |
@@ -3582,66 +3582,66 @@ discard block  | 
                                                    ||
| 3582 | 3582 | function geodir_get_custom_sort_options($post_type = '')  | 
                                                        
| 3583 | 3583 |  {
 | 
                                                        
| 3584 | 3584 | |
| 3585 | - global $wpdb;  | 
                                                        |
| 3586 | -  | 
                                                        |
| 3587 | -    if ($post_type != '') {
 | 
                                                        |
| 3588 | -  | 
                                                        |
| 3589 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 3590 | -  | 
                                                        |
| 3591 | - if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 3592 | - return false;  | 
                                                        |
| 3593 | -  | 
                                                        |
| 3594 | - $fields = array();  | 
                                                        |
| 3595 | -  | 
                                                        |
| 3596 | - $fields[] = array(  | 
                                                        |
| 3597 | - 'post_type' => $post_type,  | 
                                                        |
| 3598 | - 'data_type' => '',  | 
                                                        |
| 3599 | - 'field_type' => 'random',  | 
                                                        |
| 3600 | - 'site_title' => 'Random',  | 
                                                        |
| 3601 | - 'htmlvar_name' => 'post_title'  | 
                                                        |
| 3602 | - );  | 
                                                        |
| 3603 | -  | 
                                                        |
| 3604 | - $fields[] = array(  | 
                                                        |
| 3605 | - 'post_type' => $post_type,  | 
                                                        |
| 3606 | - 'data_type' => '',  | 
                                                        |
| 3607 | - 'field_type' => 'datetime',  | 
                                                        |
| 3608 | -            'site_title' => __('Add date', 'geodirectory'),
 | 
                                                        |
| 3609 | - 'htmlvar_name' => 'post_date'  | 
                                                        |
| 3610 | - );  | 
                                                        |
| 3611 | - $fields[] = array(  | 
                                                        |
| 3612 | - 'post_type' => $post_type,  | 
                                                        |
| 3613 | - 'data_type' => '',  | 
                                                        |
| 3614 | - 'field_type' => 'bigint',  | 
                                                        |
| 3615 | -            'site_title' => __('Review', 'geodirectory'),
 | 
                                                        |
| 3616 | - 'htmlvar_name' => 'comment_count'  | 
                                                        |
| 3617 | - );  | 
                                                        |
| 3618 | - $fields[] = array(  | 
                                                        |
| 3619 | - 'post_type' => $post_type,  | 
                                                        |
| 3620 | - 'data_type' => '',  | 
                                                        |
| 3621 | - 'field_type' => 'float',  | 
                                                        |
| 3622 | -            'site_title' => __('Rating', 'geodirectory'),
 | 
                                                        |
| 3623 | - 'htmlvar_name' => 'overall_rating'  | 
                                                        |
| 3624 | - );  | 
                                                        |
| 3625 | - $fields[] = array(  | 
                                                        |
| 3626 | - 'post_type' => $post_type,  | 
                                                        |
| 3627 | - 'data_type' => '',  | 
                                                        |
| 3628 | - 'field_type' => 'text',  | 
                                                        |
| 3629 | -            'site_title' => __('Title', 'geodirectory'),
 | 
                                                        |
| 3630 | - 'htmlvar_name' => 'post_title'  | 
                                                        |
| 3631 | - );  | 
                                                        |
| 3632 | -  | 
                                                        |
| 3633 | - /**  | 
                                                        |
| 3634 | - * Hook to add custom sort options.  | 
                                                        |
| 3635 | - *  | 
                                                        |
| 3636 | - * @since 1.0.0  | 
                                                        |
| 3637 | - * @param array $fields Unmodified sort options array.  | 
                                                        |
| 3638 | - * @param string $post_type Post type.  | 
                                                        |
| 3639 | - */  | 
                                                        |
| 3640 | -        return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
 | 
                                                        |
| 3641 | -  | 
                                                        |
| 3642 | - }  | 
                                                        |
| 3643 | -  | 
                                                        |
| 3644 | - return false;  | 
                                                        |
| 3585 | + global $wpdb;  | 
                                                        |
| 3586 | +  | 
                                                        |
| 3587 | +	if ($post_type != '') {
 | 
                                                        |
| 3588 | +  | 
                                                        |
| 3589 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 3590 | +  | 
                                                        |
| 3591 | + if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 3592 | + return false;  | 
                                                        |
| 3593 | +  | 
                                                        |
| 3594 | + $fields = array();  | 
                                                        |
| 3595 | +  | 
                                                        |
| 3596 | + $fields[] = array(  | 
                                                        |
| 3597 | + 'post_type' => $post_type,  | 
                                                        |
| 3598 | + 'data_type' => '',  | 
                                                        |
| 3599 | + 'field_type' => 'random',  | 
                                                        |
| 3600 | + 'site_title' => 'Random',  | 
                                                        |
| 3601 | + 'htmlvar_name' => 'post_title'  | 
                                                        |
| 3602 | + );  | 
                                                        |
| 3603 | +  | 
                                                        |
| 3604 | + $fields[] = array(  | 
                                                        |
| 3605 | + 'post_type' => $post_type,  | 
                                                        |
| 3606 | + 'data_type' => '',  | 
                                                        |
| 3607 | + 'field_type' => 'datetime',  | 
                                                        |
| 3608 | +			'site_title' => __('Add date', 'geodirectory'),
 | 
                                                        |
| 3609 | + 'htmlvar_name' => 'post_date'  | 
                                                        |
| 3610 | + );  | 
                                                        |
| 3611 | + $fields[] = array(  | 
                                                        |
| 3612 | + 'post_type' => $post_type,  | 
                                                        |
| 3613 | + 'data_type' => '',  | 
                                                        |
| 3614 | + 'field_type' => 'bigint',  | 
                                                        |
| 3615 | +			'site_title' => __('Review', 'geodirectory'),
 | 
                                                        |
| 3616 | + 'htmlvar_name' => 'comment_count'  | 
                                                        |
| 3617 | + );  | 
                                                        |
| 3618 | + $fields[] = array(  | 
                                                        |
| 3619 | + 'post_type' => $post_type,  | 
                                                        |
| 3620 | + 'data_type' => '',  | 
                                                        |
| 3621 | + 'field_type' => 'float',  | 
                                                        |
| 3622 | +			'site_title' => __('Rating', 'geodirectory'),
 | 
                                                        |
| 3623 | + 'htmlvar_name' => 'overall_rating'  | 
                                                        |
| 3624 | + );  | 
                                                        |
| 3625 | + $fields[] = array(  | 
                                                        |
| 3626 | + 'post_type' => $post_type,  | 
                                                        |
| 3627 | + 'data_type' => '',  | 
                                                        |
| 3628 | + 'field_type' => 'text',  | 
                                                        |
| 3629 | +			'site_title' => __('Title', 'geodirectory'),
 | 
                                                        |
| 3630 | + 'htmlvar_name' => 'post_title'  | 
                                                        |
| 3631 | + );  | 
                                                        |
| 3632 | +  | 
                                                        |
| 3633 | + /**  | 
                                                        |
| 3634 | + * Hook to add custom sort options.  | 
                                                        |
| 3635 | + *  | 
                                                        |
| 3636 | + * @since 1.0.0  | 
                                                        |
| 3637 | + * @param array $fields Unmodified sort options array.  | 
                                                        |
| 3638 | + * @param string $post_type Post type.  | 
                                                        |
| 3639 | + */  | 
                                                        |
| 3640 | +		return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
 | 
                                                        |
| 3641 | +  | 
                                                        |
| 3642 | + }  | 
                                                        |
| 3643 | +  | 
                                                        |
| 3644 | + return false;  | 
                                                        |
| 3645 | 3645 | }  | 
                                                        
| 3646 | 3646 | |
| 3647 | 3647 | |
@@ -3657,117 +3657,117 @@ discard block  | 
                                                    ||
| 3657 | 3657 | function godir_set_sort_field_order($field_ids = array())  | 
                                                        
| 3658 | 3658 |  {
 | 
                                                        
| 3659 | 3659 | |
| 3660 | - global $wpdb;  | 
                                                        |
| 3660 | + global $wpdb;  | 
                                                        |
| 3661 | 3661 | |
| 3662 | - $count = 0;  | 
                                                        |
| 3663 | - if (!empty($field_ids)):  | 
                                                        |
| 3664 | -        foreach ($field_ids as $id) {
 | 
                                                        |
| 3662 | + $count = 0;  | 
                                                        |
| 3663 | + if (!empty($field_ids)):  | 
                                                        |
| 3664 | +		foreach ($field_ids as $id) {
 | 
                                                        |
| 3665 | 3665 | |
| 3666 | - $cf = trim($id, '_');  | 
                                                        |
| 3666 | + $cf = trim($id, '_');  | 
                                                        |
| 3667 | 3667 | |
| 3668 | - $post_meta_info = $wpdb->query(  | 
                                                        |
| 3669 | - $wpdb->prepare(  | 
                                                        |
| 3670 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3668 | + $post_meta_info = $wpdb->query(  | 
                                                        |
| 3669 | + $wpdb->prepare(  | 
                                                        |
| 3670 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3671 | 3671 | sort_order=%d  | 
                                                        
| 3672 | 3672 | where id= %d",  | 
                                                        
| 3673 | - array($count, $cf)  | 
                                                        |
| 3674 | - )  | 
                                                        |
| 3675 | - );  | 
                                                        |
| 3676 | - $count++;  | 
                                                        |
| 3677 | - }  | 
                                                        |
| 3678 | -  | 
                                                        |
| 3679 | - return $field_ids;  | 
                                                        |
| 3680 | - else:  | 
                                                        |
| 3681 | - return false;  | 
                                                        |
| 3682 | - endif;  | 
                                                        |
| 3673 | + array($count, $cf)  | 
                                                        |
| 3674 | + )  | 
                                                        |
| 3675 | + );  | 
                                                        |
| 3676 | + $count++;  | 
                                                        |
| 3677 | + }  | 
                                                        |
| 3678 | +  | 
                                                        |
| 3679 | + return $field_ids;  | 
                                                        |
| 3680 | + else:  | 
                                                        |
| 3681 | + return false;  | 
                                                        |
| 3682 | + endif;  | 
                                                        |
| 3683 | 3683 | }  | 
                                                        
| 3684 | 3684 | |
| 3685 | 3685 | |
| 3686 | 3686 |  if (!function_exists('geodir_custom_sort_field_save')) {
 | 
                                                        
| 3687 | - /**  | 
                                                        |
| 3688 | - * Save or Update custom sort fields into the database.  | 
                                                        |
| 3689 | - *  | 
                                                        |
| 3690 | - * @since 1.0.0  | 
                                                        |
| 3691 | - * @package GeoDirectory  | 
                                                        |
| 3692 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 3693 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 3694 | -     * @param array $request_field {
 | 
                                                        |
| 3695 | - * Attributes of the Request field.  | 
                                                        |
| 3696 | - *  | 
                                                        |
| 3697 | - * @type string $action Ajax action name.  | 
                                                        |
| 3698 | - * @type string $manage_field_type Manage field type Default "sorting_options".  | 
                                                        |
| 3699 | - * @type string $create_field Do you want to create this field?.  | 
                                                        |
| 3700 | - * @type string $field_ins_upd Field created or updated?.  | 
                                                        |
| 3701 | - * @type string $_wpnonce Nonce value.  | 
                                                        |
| 3702 | - * @type string $listing_type The Post type.  | 
                                                        |
| 3703 | - * @type string $field_type Field Type.  | 
                                                        |
| 3704 | - * @type string $field_id Field ID.  | 
                                                        |
| 3705 | - * @type string $data_type Data Type.  | 
                                                        |
| 3706 | - * @type string $htmlvar_name HTML variable name.  | 
                                                        |
| 3707 | - * @type string $site_title Section title which you wish to display in frontend.  | 
                                                        |
| 3708 | - * @type string $is_default Is this default sorting?.  | 
                                                        |
| 3709 | - * @type string $is_active If not active then the field will not be displayed anywhere.  | 
                                                        |
| 3710 | - * @type string $sort_order Sort Order.  | 
                                                        |
| 3711 | - *  | 
                                                        |
| 3712 | - * }  | 
                                                        |
| 3713 | - * @param bool $default Not yet implemented.  | 
                                                        |
| 3714 | - * @return int Returns the last affected db table row id.  | 
                                                        |
| 3715 | - */  | 
                                                        |
| 3716 | - function geodir_custom_sort_field_save($request_field = array(), $default = false)  | 
                                                        |
| 3717 | -    {
 | 
                                                        |
| 3718 | -  | 
                                                        |
| 3719 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 3720 | -  | 
                                                        |
| 3721 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';  | 
                                                        |
| 3722 | -  | 
                                                        |
| 3723 | - $cf = trim($result_str, '_');  | 
                                                        |
| 3724 | -  | 
                                                        |
| 3725 | - /*-------- check dublicate validation --------*/  | 
                                                        |
| 3726 | -  | 
                                                        |
| 3727 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';  | 
                                                        |
| 3728 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';  | 
                                                        |
| 3729 | -  | 
                                                        |
| 3730 | - $post_type = $request_field['listing_type'];  | 
                                                        |
| 3731 | - $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';  | 
                                                        |
| 3732 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';  | 
                                                        |
| 3733 | - $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';  | 
                                                        |
| 3734 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';  | 
                                                        |
| 3735 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;  | 
                                                        |
| 3736 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;  | 
                                                        |
| 3737 | - $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';  | 
                                                        |
| 3738 | - $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;  | 
                                                        |
| 3739 | - $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;  | 
                                                        |
| 3740 | - $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';  | 
                                                        |
| 3741 | - $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';  | 
                                                        |
| 3742 | -  | 
                                                        |
| 3743 | - $default_order = '';  | 
                                                        |
| 3744 | -        if ($is_default != '') {
 | 
                                                        |
| 3745 | - $default_order = $is_default;  | 
                                                        |
| 3746 | - $is_default = '1';  | 
                                                        |
| 3747 | - }  | 
                                                        |
| 3748 | -  | 
                                                        |
| 3749 | -  | 
                                                        |
| 3750 | - $check_html_variable = $wpdb->get_var(  | 
                                                        |
| 3751 | - $wpdb->prepare(  | 
                                                        |
| 3752 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",  | 
                                                        |
| 3753 | - array($cehhtmlvar_name, $post_type, $field_type)  | 
                                                        |
| 3754 | - )  | 
                                                        |
| 3755 | - );  | 
                                                        |
| 3756 | -  | 
                                                        |
| 3757 | -        if ($is_default == 1) {
 | 
                                                        |
| 3758 | -  | 
                                                        |
| 3759 | -            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
 | 
                                                        |
| 3760 | -  | 
                                                        |
| 3761 | - }  | 
                                                        |
| 3762 | -  | 
                                                        |
| 3763 | -  | 
                                                        |
| 3764 | -        if (!$check_html_variable) {
 | 
                                                        |
| 3765 | -  | 
                                                        |
| 3766 | - $wpdb->query(  | 
                                                        |
| 3767 | -  | 
                                                        |
| 3768 | - $wpdb->prepare(  | 
                                                        |
| 3769 | -  | 
                                                        |
| 3770 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3687 | + /**  | 
                                                        |
| 3688 | + * Save or Update custom sort fields into the database.  | 
                                                        |
| 3689 | + *  | 
                                                        |
| 3690 | + * @since 1.0.0  | 
                                                        |
| 3691 | + * @package GeoDirectory  | 
                                                        |
| 3692 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 3693 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 3694 | +	 * @param array $request_field {
 | 
                                                        |
| 3695 | + * Attributes of the Request field.  | 
                                                        |
| 3696 | + *  | 
                                                        |
| 3697 | + * @type string $action Ajax action name.  | 
                                                        |
| 3698 | + * @type string $manage_field_type Manage field type Default "sorting_options".  | 
                                                        |
| 3699 | + * @type string $create_field Do you want to create this field?.  | 
                                                        |
| 3700 | + * @type string $field_ins_upd Field created or updated?.  | 
                                                        |
| 3701 | + * @type string $_wpnonce Nonce value.  | 
                                                        |
| 3702 | + * @type string $listing_type The Post type.  | 
                                                        |
| 3703 | + * @type string $field_type Field Type.  | 
                                                        |
| 3704 | + * @type string $field_id Field ID.  | 
                                                        |
| 3705 | + * @type string $data_type Data Type.  | 
                                                        |
| 3706 | + * @type string $htmlvar_name HTML variable name.  | 
                                                        |
| 3707 | + * @type string $site_title Section title which you wish to display in frontend.  | 
                                                        |
| 3708 | + * @type string $is_default Is this default sorting?.  | 
                                                        |
| 3709 | + * @type string $is_active If not active then the field will not be displayed anywhere.  | 
                                                        |
| 3710 | + * @type string $sort_order Sort Order.  | 
                                                        |
| 3711 | + *  | 
                                                        |
| 3712 | + * }  | 
                                                        |
| 3713 | + * @param bool $default Not yet implemented.  | 
                                                        |
| 3714 | + * @return int Returns the last affected db table row id.  | 
                                                        |
| 3715 | + */  | 
                                                        |
| 3716 | + function geodir_custom_sort_field_save($request_field = array(), $default = false)  | 
                                                        |
| 3717 | +	{
 | 
                                                        |
| 3718 | +  | 
                                                        |
| 3719 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 3720 | +  | 
                                                        |
| 3721 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';  | 
                                                        |
| 3722 | +  | 
                                                        |
| 3723 | + $cf = trim($result_str, '_');  | 
                                                        |
| 3724 | +  | 
                                                        |
| 3725 | + /*-------- check dublicate validation --------*/  | 
                                                        |
| 3726 | +  | 
                                                        |
| 3727 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';  | 
                                                        |
| 3728 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';  | 
                                                        |
| 3729 | +  | 
                                                        |
| 3730 | + $post_type = $request_field['listing_type'];  | 
                                                        |
| 3731 | + $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : '';  | 
                                                        |
| 3732 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : '';  | 
                                                        |
| 3733 | + $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : '';  | 
                                                        |
| 3734 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : '';  | 
                                                        |
| 3735 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0;  | 
                                                        |
| 3736 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0;  | 
                                                        |
| 3737 | + $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : '';  | 
                                                        |
| 3738 | + $asc = isset($request_field['asc']) ? $request_field['asc'] : 0;  | 
                                                        |
| 3739 | + $desc = isset($request_field['desc']) ? $request_field['desc'] : 0;  | 
                                                        |
| 3740 | + $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : '';  | 
                                                        |
| 3741 | + $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : '';  | 
                                                        |
| 3742 | +  | 
                                                        |
| 3743 | + $default_order = '';  | 
                                                        |
| 3744 | +		if ($is_default != '') {
 | 
                                                        |
| 3745 | + $default_order = $is_default;  | 
                                                        |
| 3746 | + $is_default = '1';  | 
                                                        |
| 3747 | + }  | 
                                                        |
| 3748 | +  | 
                                                        |
| 3749 | +  | 
                                                        |
| 3750 | + $check_html_variable = $wpdb->get_var(  | 
                                                        |
| 3751 | + $wpdb->prepare(  | 
                                                        |
| 3752 | + "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",  | 
                                                        |
| 3753 | + array($cehhtmlvar_name, $post_type, $field_type)  | 
                                                        |
| 3754 | + )  | 
                                                        |
| 3755 | + );  | 
                                                        |
| 3756 | +  | 
                                                        |
| 3757 | +		if ($is_default == 1) {
 | 
                                                        |
| 3758 | +  | 
                                                        |
| 3759 | +			$wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
 | 
                                                        |
| 3760 | +  | 
                                                        |
| 3761 | + }  | 
                                                        |
| 3762 | +  | 
                                                        |
| 3763 | +  | 
                                                        |
| 3764 | +		if (!$check_html_variable) {
 | 
                                                        |
| 3765 | +  | 
                                                        |
| 3766 | + $wpdb->query(  | 
                                                        |
| 3767 | +  | 
                                                        |
| 3768 | + $wpdb->prepare(  | 
                                                        |
| 3769 | +  | 
                                                        |
| 3770 | + "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3771 | 3771 | post_type = %s,  | 
                                                        
| 3772 | 3772 | data_type = %s,  | 
                                                        
| 3773 | 3773 | field_type = %s,  | 
                                                        
@@ -3782,23 +3782,23 @@ discard block  | 
                                                    ||
| 3782 | 3782 | asc_title = %s,  | 
                                                        
| 3783 | 3783 | desc_title = %s",  | 
                                                        
| 3784 | 3784 | |
| 3785 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)  | 
                                                        |
| 3786 | - )  | 
                                                        |
| 3785 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title)  | 
                                                        |
| 3786 | + )  | 
                                                        |
| 3787 | 3787 | |
| 3788 | - );  | 
                                                        |
| 3788 | + );  | 
                                                        |
| 3789 | 3789 | |
| 3790 | 3790 | |
| 3791 | - $lastid = $wpdb->insert_id;  | 
                                                        |
| 3791 | + $lastid = $wpdb->insert_id;  | 
                                                        |
| 3792 | 3792 | |
| 3793 | - $lastid = trim($lastid);  | 
                                                        |
| 3793 | + $lastid = trim($lastid);  | 
                                                        |
| 3794 | 3794 | |
| 3795 | -        } else {
 | 
                                                        |
| 3795 | +		} else {
 | 
                                                        |
| 3796 | 3796 | |
| 3797 | - $wpdb->query(  | 
                                                        |
| 3797 | + $wpdb->query(  | 
                                                        |
| 3798 | 3798 | |
| 3799 | - $wpdb->prepare(  | 
                                                        |
| 3799 | + $wpdb->prepare(  | 
                                                        |
| 3800 | 3800 | |
| 3801 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3801 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3802 | 3802 | post_type = %s,  | 
                                                        
| 3803 | 3803 | data_type = %s,  | 
                                                        
| 3804 | 3804 | field_type = %s,  | 
                                                        
@@ -3814,115 +3814,115 @@ discard block  | 
                                                    ||
| 3814 | 3814 | desc_title = %s  | 
                                                        
| 3815 | 3815 | where id = %d",  | 
                                                        
| 3816 | 3816 | |
| 3817 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)  | 
                                                        |
| 3818 | - )  | 
                                                        |
| 3817 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf)  | 
                                                        |
| 3818 | + )  | 
                                                        |
| 3819 | 3819 | |
| 3820 | - );  | 
                                                        |
| 3820 | + );  | 
                                                        |
| 3821 | 3821 | |
| 3822 | - $lastid = trim($cf);  | 
                                                        |
| 3822 | + $lastid = trim($cf);  | 
                                                        |
| 3823 | 3823 | |
| 3824 | - }  | 
                                                        |
| 3824 | + }  | 
                                                        |
| 3825 | 3825 | |
| 3826 | 3826 | |
| 3827 | - return (int)$lastid;  | 
                                                        |
| 3827 | + return (int)$lastid;  | 
                                                        |
| 3828 | 3828 | |
| 3829 | - }  | 
                                                        |
| 3829 | + }  | 
                                                        |
| 3830 | 3830 | }  | 
                                                        
| 3831 | 3831 | |
| 3832 | 3832 | |
| 3833 | 3833 |  if (!function_exists('geodir_custom_sort_field_delete')) {
 | 
                                                        
| 3834 | - /**  | 
                                                        |
| 3835 | - * Delete a custom sort field using field id.  | 
                                                        |
| 3836 | - * @since 1.0.0  | 
                                                        |
| 3837 | - * @package GeoDirectory  | 
                                                        |
| 3838 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 3839 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 3840 | - * @param string $field_id The field ID.  | 
                                                        |
| 3841 | - * @return int|string Returns field id when successful deletion, else returns 0.  | 
                                                        |
| 3842 | - */  | 
                                                        |
| 3843 | - function geodir_custom_sort_field_delete($field_id = '')  | 
                                                        |
| 3844 | -    {
 | 
                                                        |
| 3845 | -  | 
                                                        |
| 3846 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 3847 | -        if ($field_id != '') {
 | 
                                                        |
| 3848 | - $cf = trim($field_id, '_');  | 
                                                        |
| 3849 | -  | 
                                                        |
| 3850 | -            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
 | 
                                                        |
| 3851 | -  | 
                                                        |
| 3852 | - return $field_id;  | 
                                                        |
| 3853 | -  | 
                                                        |
| 3854 | - } else  | 
                                                        |
| 3855 | - return 0;  | 
                                                        |
| 3856 | -  | 
                                                        |
| 3857 | - }  | 
                                                        |
| 3834 | + /**  | 
                                                        |
| 3835 | + * Delete a custom sort field using field id.  | 
                                                        |
| 3836 | + * @since 1.0.0  | 
                                                        |
| 3837 | + * @package GeoDirectory  | 
                                                        |
| 3838 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 3839 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 3840 | + * @param string $field_id The field ID.  | 
                                                        |
| 3841 | + * @return int|string Returns field id when successful deletion, else returns 0.  | 
                                                        |
| 3842 | + */  | 
                                                        |
| 3843 | + function geodir_custom_sort_field_delete($field_id = '')  | 
                                                        |
| 3844 | +	{
 | 
                                                        |
| 3845 | +  | 
                                                        |
| 3846 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 3847 | +		if ($field_id != '') {
 | 
                                                        |
| 3848 | + $cf = trim($field_id, '_');  | 
                                                        |
| 3849 | +  | 
                                                        |
| 3850 | +			$wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
 | 
                                                        |
| 3851 | +  | 
                                                        |
| 3852 | + return $field_id;  | 
                                                        |
| 3853 | +  | 
                                                        |
| 3854 | + } else  | 
                                                        |
| 3855 | + return 0;  | 
                                                        |
| 3856 | +  | 
                                                        |
| 3857 | + }  | 
                                                        |
| 3858 | 3858 | }  | 
                                                        
| 3859 | 3859 | |
| 3860 | 3860 | |
| 3861 | 3861 |  if (!function_exists('geodir_custom_sort_field_adminhtml')) {
 | 
                                                        
| 3862 | - /**  | 
                                                        |
| 3863 | - * Custom sort field admin html.  | 
                                                        |
| 3864 | - *  | 
                                                        |
| 3865 | - * @since 1.0.0  | 
                                                        |
| 3866 | - * @package GeoDirectory  | 
                                                        |
| 3867 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 3868 | - * @param string $field_type The form field type.  | 
                                                        |
| 3869 | - * @param object|int $result_str The custom field results object or row id.  | 
                                                        |
| 3870 | - * @param string $field_ins_upd When set to "submit" displays form.  | 
                                                        |
| 3871 | - * @param bool $default when set to true field will be for admin use only.  | 
                                                        |
| 3872 | - */  | 
                                                        |
| 3873 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)  | 
                                                        |
| 3874 | -    {
 | 
                                                        |
| 3875 | - global $wpdb;  | 
                                                        |
| 3876 | - $cf = $result_str;  | 
                                                        |
| 3877 | -        if (!is_object($cf)) {
 | 
                                                        |
| 3878 | -            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
 | 
                                                        |
| 3879 | -        } else {
 | 
                                                        |
| 3880 | - $field_info = $cf;  | 
                                                        |
| 3881 | - $result_str = $cf->id;  | 
                                                        |
| 3882 | - }  | 
                                                        |
| 3883 | -  | 
                                                        |
| 3884 | - $field_info = stripslashes_deep($field_info); // strip slashes  | 
                                                        |
| 3885 | -  | 
                                                        |
| 3886 | -        if (!isset($field_info->post_type)) {
 | 
                                                        |
| 3887 | - $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 3888 | -        } else {
 | 
                                                        |
| 3889 | - $post_type = $field_info->post_type;  | 
                                                        |
| 3890 | - }  | 
                                                        |
| 3891 | -  | 
                                                        |
| 3892 | -        $field_types = explode('-_-', $field_type);
 | 
                                                        |
| 3893 | - $field_type = $field_types[0];  | 
                                                        |
| 3894 | - $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';  | 
                                                        |
| 3895 | -  | 
                                                        |
| 3896 | - $site_title = '';  | 
                                                        |
| 3897 | - if ($site_title == '')  | 
                                                        |
| 3898 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : '';  | 
                                                        |
| 3899 | -  | 
                                                        |
| 3900 | -        if ($site_title == '') {
 | 
                                                        |
| 3901 | - $fields = geodir_get_custom_sort_options($post_type);  | 
                                                        |
| 3902 | -  | 
                                                        |
| 3903 | -            foreach ($fields as $val) {
 | 
                                                        |
| 3904 | - $val = stripslashes_deep($val); // strip slashes  | 
                                                        |
| 3905 | -  | 
                                                        |
| 3906 | -                if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
 | 
                                                        |
| 3907 | - $site_title = isset($val['site_title']) ? $val['site_title'] : '';  | 
                                                        |
| 3908 | - }  | 
                                                        |
| 3909 | - }  | 
                                                        |
| 3910 | - }  | 
                                                        |
| 3911 | -  | 
                                                        |
| 3912 | - if ($htmlvar_name == '')  | 
                                                        |
| 3913 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';  | 
                                                        |
| 3914 | -  | 
                                                        |
| 3915 | -        $nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 3916 | -  | 
                                                        |
| 3917 | - ?>  | 
                                                        |
| 3862 | + /**  | 
                                                        |
| 3863 | + * Custom sort field admin html.  | 
                                                        |
| 3864 | + *  | 
                                                        |
| 3865 | + * @since 1.0.0  | 
                                                        |
| 3866 | + * @package GeoDirectory  | 
                                                        |
| 3867 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 3868 | + * @param string $field_type The form field type.  | 
                                                        |
| 3869 | + * @param object|int $result_str The custom field results object or row id.  | 
                                                        |
| 3870 | + * @param string $field_ins_upd When set to "submit" displays form.  | 
                                                        |
| 3871 | + * @param bool $default when set to true field will be for admin use only.  | 
                                                        |
| 3872 | + */  | 
                                                        |
| 3873 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)  | 
                                                        |
| 3874 | +	{
 | 
                                                        |
| 3875 | + global $wpdb;  | 
                                                        |
| 3876 | + $cf = $result_str;  | 
                                                        |
| 3877 | +		if (!is_object($cf)) {
 | 
                                                        |
| 3878 | +			$field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
 | 
                                                        |
| 3879 | +		} else {
 | 
                                                        |
| 3880 | + $field_info = $cf;  | 
                                                        |
| 3881 | + $result_str = $cf->id;  | 
                                                        |
| 3882 | + }  | 
                                                        |
| 3883 | +  | 
                                                        |
| 3884 | + $field_info = stripslashes_deep($field_info); // strip slashes  | 
                                                        |
| 3885 | +  | 
                                                        |
| 3886 | +		if (!isset($field_info->post_type)) {
 | 
                                                        |
| 3887 | + $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 3888 | +		} else {
 | 
                                                        |
| 3889 | + $post_type = $field_info->post_type;  | 
                                                        |
| 3890 | + }  | 
                                                        |
| 3891 | +  | 
                                                        |
| 3892 | +		$field_types = explode('-_-', $field_type);
 | 
                                                        |
| 3893 | + $field_type = $field_types[0];  | 
                                                        |
| 3894 | + $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';  | 
                                                        |
| 3895 | +  | 
                                                        |
| 3896 | + $site_title = '';  | 
                                                        |
| 3897 | + if ($site_title == '')  | 
                                                        |
| 3898 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : '';  | 
                                                        |
| 3899 | +  | 
                                                        |
| 3900 | +		if ($site_title == '') {
 | 
                                                        |
| 3901 | + $fields = geodir_get_custom_sort_options($post_type);  | 
                                                        |
| 3902 | +  | 
                                                        |
| 3903 | +			foreach ($fields as $val) {
 | 
                                                        |
| 3904 | + $val = stripslashes_deep($val); // strip slashes  | 
                                                        |
| 3905 | +  | 
                                                        |
| 3906 | +				if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
 | 
                                                        |
| 3907 | + $site_title = isset($val['site_title']) ? $val['site_title'] : '';  | 
                                                        |
| 3908 | + }  | 
                                                        |
| 3909 | + }  | 
                                                        |
| 3910 | + }  | 
                                                        |
| 3911 | +  | 
                                                        |
| 3912 | + if ($htmlvar_name == '')  | 
                                                        |
| 3913 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';  | 
                                                        |
| 3914 | +  | 
                                                        |
| 3915 | +		$nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 3916 | +  | 
                                                        |
| 3917 | + ?>  | 
                                                        |
| 3918 | 3918 | <li class="text" id="licontainer_<?php echo $result_str;?>">  | 
                                                        
| 3919 | 3919 | <div class="title title<?php echo $result_str;?> gt-fieldset"  | 
                                                        
| 3920 | 3920 |                   title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
 | 
                                                        
| 3921 | 3921 |                   ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
 | 
                                                        
| 3922 | 3922 | <?php  | 
                                                        
| 3923 | 3923 | |
| 3924 | -                $nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 3925 | - ?>  | 
                                                        |
| 3924 | +				$nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 3925 | + ?>  | 
                                                        |
| 3926 | 3926 | |
| 3927 | 3927 |                  <div title="<?php _e('Click to remove field', 'geodirectory');?>"
 | 
                                                        
| 3928 | 3928 |                       onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
 | 
                                                        
@@ -3935,17 +3935,17 @@ discard block  | 
                                                    ||
| 3935 | 3935 | |
| 3936 | 3936 | <div id="field_frm<?php echo $result_str;?>" class="field_frm"  | 
                                                        
| 3937 | 3937 |                   style="display:<?php if ($field_ins_upd == 'submit') {
 | 
                                                        
| 3938 | - echo 'block;';  | 
                                                        |
| 3939 | -                 } else {
 | 
                                                        |
| 3940 | - echo 'none;';  | 
                                                        |
| 3941 | - } ?>">  | 
                                                        |
| 3938 | + echo 'block;';  | 
                                                        |
| 3939 | +				 } else {
 | 
                                                        |
| 3940 | + echo 'none;';  | 
                                                        |
| 3941 | + } ?>">  | 
                                                        |
| 3942 | 3942 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>  | 
                                                        
| 3943 | 3943 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>  | 
                                                        
| 3944 | 3944 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>  | 
                                                        
| 3945 | 3945 | <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>  | 
                                                        
| 3946 | 3946 |                  <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
 | 
                                                        
| 3947 | - echo $field_info->data_type;  | 
                                                        |
| 3948 | - }?>"/>  | 
                                                        |
| 3947 | + echo $field_info->data_type;  | 
                                                        |
| 3948 | + }?>"/>  | 
                                                        |
| 3949 | 3949 | <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>  | 
                                                        
| 3950 | 3950 | |
| 3951 | 3951 | |
@@ -3960,19 +3960,19 @@ discard block  | 
                                                    ||
| 3960 | 3960 | <td>  | 
                                                        
| 3961 | 3961 | <input type="checkbox" name="asc" id="asc"  | 
                                                        
| 3962 | 3962 |                                         value="1" <?php if (isset($field_info->sort_asc) && $field_info->sort_asc == '1') {
 | 
                                                        
| 3963 | - echo 'checked="checked"';  | 
                                                        |
| 3964 | - } ?>/>  | 
                                                        |
| 3963 | + echo 'checked="checked"';  | 
                                                        |
| 3964 | + } ?>/>  | 
                                                        |
| 3965 | 3965 | |
| 3966 | 3966 | <input type="text" name="asc_title" id="asc_title"  | 
                                                        
| 3967 | 3967 |                                         placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
 | 
                                                        
| 3968 | 3968 |                                         value="<?php if (isset($field_info->asc_title)) {
 | 
                                                        
| 3969 | - echo esc_attr($field_info->asc_title);  | 
                                                        |
| 3970 | - } ?>" style="width:45%;"/>  | 
                                                        |
| 3969 | + echo esc_attr($field_info->asc_title);  | 
                                                        |
| 3970 | + } ?>" style="width:45%;"/>  | 
                                                        |
| 3971 | 3971 | |
| 3972 | 3972 | <input type="radio" name="is_default"  | 
                                                        
| 3973 | 3973 |                                         value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
 | 
                                                        
| 3974 | - echo 'checked="checked"';  | 
                                                        |
| 3975 | -                                } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
 | 
                                                        |
| 3974 | + echo 'checked="checked"';  | 
                                                        |
| 3975 | +								} ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
 | 
                                                        |
| 3976 | 3976 | |
| 3977 | 3977 | <br/>  | 
                                                        
| 3978 | 3978 |                                  <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
 | 
                                                        
@@ -3984,18 +3984,18 @@ discard block  | 
                                                    ||
| 3984 | 3984 | <td>  | 
                                                        
| 3985 | 3985 | <input type="checkbox" name="desc" id="desc"  | 
                                                        
| 3986 | 3986 |                                         value="1" <?php if (isset($field_info->sort_desc) && $field_info->sort_desc == '1') {
 | 
                                                        
| 3987 | - echo 'checked="checked"';  | 
                                                        |
| 3988 | - } ?>/>  | 
                                                        |
| 3987 | + echo 'checked="checked"';  | 
                                                        |
| 3988 | + } ?>/>  | 
                                                        |
| 3989 | 3989 | |
| 3990 | 3990 | <input type="text" name="desc_title" id="desc_title"  | 
                                                        
| 3991 | 3991 |                                         placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
 | 
                                                        
| 3992 | 3992 |                                         value="<?php if (isset($field_info->desc_title)) {
 | 
                                                        
| 3993 | - echo esc_attr($field_info->desc_title);  | 
                                                        |
| 3994 | - } ?>" style="width:45%;"/>  | 
                                                        |
| 3993 | + echo esc_attr($field_info->desc_title);  | 
                                                        |
| 3994 | + } ?>" style="width:45%;"/>  | 
                                                        |
| 3995 | 3995 | <input type="radio" name="is_default"  | 
                                                        
| 3996 | 3996 |                                         value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
 | 
                                                        
| 3997 | - echo 'checked="checked"';  | 
                                                        |
| 3998 | -                                } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
 | 
                                                        |
| 3997 | + echo 'checked="checked"';  | 
                                                        |
| 3998 | +								} ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
 | 
                                                        |
| 3999 | 3999 | <br/>  | 
                                                        
| 4000 | 4000 |                                  <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
 | 
                                                        
| 4001 | 4001 | </td>  | 
                                                        
@@ -4018,8 +4018,8 @@ discard block  | 
                                                    ||
| 4018 | 4018 | <td align="left">  | 
                                                        
| 4019 | 4019 | <input type="checkbox" name="is_default"  | 
                                                        
| 4020 | 4020 |                                         value="<?php echo $field_type; ?>"  <?php if (isset($field_info->is_default) && $field_info->is_default == '1') {
 | 
                                                        
| 4021 | - echo 'checked="checked"';  | 
                                                        |
| 4022 | - } ?>/>  | 
                                                        |
| 4021 | + echo 'checked="checked"';  | 
                                                        |
| 4022 | + } ?>/>  | 
                                                        |
| 4023 | 4023 | <br/>  | 
                                                        
| 4024 | 4024 |                                  <span><?php _e('If field is checked then the field will be use as default sort.', 'geodirectory'); ?></span>
 | 
                                                        
| 4025 | 4025 | </td>  | 
                                                        
@@ -4033,12 +4033,12 @@ discard block  | 
                                                    ||
| 4033 | 4033 | <select name="is_active" id="is_active">  | 
                                                        
| 4034 | 4034 | <option  | 
                                                        
| 4035 | 4035 |                                      value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
 | 
                                                        
| 4036 | - echo 'selected="selected"';  | 
                                                        |
| 4037 | -                                }?>><?php _e('Yes', 'geodirectory');?></option>
 | 
                                                        |
| 4036 | + echo 'selected="selected"';  | 
                                                        |
| 4037 | +								}?>><?php _e('Yes', 'geodirectory');?></option>
 | 
                                                        |
| 4038 | 4038 | <option  | 
                                                        
| 4039 | 4039 |                                      value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
 | 
                                                        
| 4040 | - echo 'selected="selected"';  | 
                                                        |
| 4041 | -                                }?>><?php _e('No', 'geodirectory');?></option>
 | 
                                                        |
| 4040 | + echo 'selected="selected"';  | 
                                                        |
| 4041 | +								}?>><?php _e('No', 'geodirectory');?></option>
 | 
                                                        |
| 4042 | 4042 | </select>  | 
                                                        
| 4043 | 4043 | <br/>  | 
                                                        
| 4044 | 4044 |                              <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
 | 
                                                        
@@ -4049,8 +4049,8 @@ discard block  | 
                                                    ||
| 4049 | 4049 |                          <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
 | 
                                                        
| 4050 | 4050 | <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"  | 
                                                        
| 4051 | 4051 |                                                  value="<?php if (isset($field_info->sort_order)) {
 | 
                                                        
| 4052 | - echo esc_attr($field_info->sort_order);  | 
                                                        |
| 4053 | - }?>" size="50"/>  | 
                                                        |
| 4052 | + echo esc_attr($field_info->sort_order);  | 
                                                        |
| 4053 | + }?>" size="50"/>  | 
                                                        |
| 4054 | 4054 | <br/>  | 
                                                        
| 4055 | 4055 |                              <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
 | 
                                                        
| 4056 | 4056 | </td>  | 
                                                        
@@ -4073,38 +4073,38 @@ discard block  | 
                                                    ||
| 4073 | 4073 | </div>  | 
                                                        
| 4074 | 4074 | </li> <?php  | 
                                                        
| 4075 | 4075 | |
| 4076 | - }  | 
                                                        |
| 4076 | + }  | 
                                                        |
| 4077 | 4077 | }  | 
                                                        
| 4078 | 4078 | |
| 4079 | 4079 |  if (!function_exists('check_field_visibility')) {
 | 
                                                        
| 4080 | - /**  | 
                                                        |
| 4081 | - * Check field visibility as per price package.  | 
                                                        |
| 4082 | - *  | 
                                                        |
| 4083 | - * @since 1.0.0  | 
                                                        |
| 4084 | - * @package GeoDirectory  | 
                                                        |
| 4085 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 4086 | - * @global array $geodir_addon_list List of active GeoDirectory extensions.  | 
                                                        |
| 4087 | - * @param int|string $package_id The package ID.  | 
                                                        |
| 4088 | - * @param string $field_name The field name.  | 
                                                        |
| 4089 | - * @param string $post_type Optional. The wordpress post type.  | 
                                                        |
| 4090 | - * @return bool Returns true when field visible, otherwise false.  | 
                                                        |
| 4091 | - */  | 
                                                        |
| 4092 | - function check_field_visibility($package_id, $field_name, $post_type)  | 
                                                        |
| 4093 | -    {
 | 
                                                        |
| 4094 | - global $wpdb, $geodir_addon_list;  | 
                                                        |
| 4095 | -        if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
 | 
                                                        |
| 4096 | - return true;  | 
                                                        |
| 4097 | - }  | 
                                                        |
| 4098 | -        if (!$package_id || !$field_name || !$post_type) {
 | 
                                                        |
| 4099 | - return true;  | 
                                                        |
| 4100 | - }  | 
                                                        |
| 4101 | -        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
 | 
                                                        |
| 4102 | -  | 
                                                        |
| 4103 | -        if ($wpdb->get_var($sql)) {
 | 
                                                        |
| 4104 | - return true;  | 
                                                        |
| 4105 | - }  | 
                                                        |
| 4106 | - return false;  | 
                                                        |
| 4107 | - }  | 
                                                        |
| 4080 | + /**  | 
                                                        |
| 4081 | + * Check field visibility as per price package.  | 
                                                        |
| 4082 | + *  | 
                                                        |
| 4083 | + * @since 1.0.0  | 
                                                        |
| 4084 | + * @package GeoDirectory  | 
                                                        |
| 4085 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 4086 | + * @global array $geodir_addon_list List of active GeoDirectory extensions.  | 
                                                        |
| 4087 | + * @param int|string $package_id The package ID.  | 
                                                        |
| 4088 | + * @param string $field_name The field name.  | 
                                                        |
| 4089 | + * @param string $post_type Optional. The wordpress post type.  | 
                                                        |
| 4090 | + * @return bool Returns true when field visible, otherwise false.  | 
                                                        |
| 4091 | + */  | 
                                                        |
| 4092 | + function check_field_visibility($package_id, $field_name, $post_type)  | 
                                                        |
| 4093 | +	{
 | 
                                                        |
| 4094 | + global $wpdb, $geodir_addon_list;  | 
                                                        |
| 4095 | +		if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
 | 
                                                        |
| 4096 | + return true;  | 
                                                        |
| 4097 | + }  | 
                                                        |
| 4098 | +		if (!$package_id || !$field_name || !$post_type) {
 | 
                                                        |
| 4099 | + return true;  | 
                                                        |
| 4100 | + }  | 
                                                        |
| 4101 | +		$sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
 | 
                                                        |
| 4102 | +  | 
                                                        |
| 4103 | +		if ($wpdb->get_var($sql)) {
 | 
                                                        |
| 4104 | + return true;  | 
                                                        |
| 4105 | + }  | 
                                                        |
| 4106 | + return false;  | 
                                                        |
| 4107 | + }  | 
                                                        |
| 4108 | 4108 | }  | 
                                                        
| 4109 | 4109 | |
| 4110 | 4110 | /**  | 
                                                        
@@ -4119,43 +4119,43 @@ discard block  | 
                                                    ||
| 4119 | 4119 | */  | 
                                                        
| 4120 | 4120 | function geodir_string_to_options($input = '', $translated = false)  | 
                                                        
| 4121 | 4121 |  {
 | 
                                                        
| 4122 | - $return = array();  | 
                                                        |
| 4123 | -    if ($input != '') {
 | 
                                                        |
| 4124 | - $input = trim($input);  | 
                                                        |
| 4125 | - $input = rtrim($input, ",");  | 
                                                        |
| 4126 | - $input = ltrim($input, ",");  | 
                                                        |
| 4127 | - $input = trim($input);  | 
                                                        |
| 4128 | - }  | 
                                                        |
| 4129 | -  | 
                                                        |
| 4130 | -    $input_arr = explode(',', $input);
 | 
                                                        |
| 4131 | -  | 
                                                        |
| 4132 | -    if (!empty($input_arr)) {
 | 
                                                        |
| 4133 | -        foreach ($input_arr as $input_str) {
 | 
                                                        |
| 4134 | - $input_str = trim($input_str);  | 
                                                        |
| 4135 | -  | 
                                                        |
| 4136 | -            if (strpos($input_str, "/") !== false) {
 | 
                                                        |
| 4137 | -                $input_str = explode("/", $input_str, 2);
 | 
                                                        |
| 4138 | - $label = trim($input_str[0]);  | 
                                                        |
| 4139 | -                if ($translated && $label != '') {
 | 
                                                        |
| 4140 | - $label = __($label, 'geodirectory');  | 
                                                        |
| 4141 | - }  | 
                                                        |
| 4142 | - $label = ucfirst($label);  | 
                                                        |
| 4143 | - $value = trim($input_str[1]);  | 
                                                        |
| 4144 | -            } else {
 | 
                                                        |
| 4145 | -                if ($translated && $input_str != '') {
 | 
                                                        |
| 4146 | - $input_str = __($input_str, 'geodirectory');  | 
                                                        |
| 4147 | - }  | 
                                                        |
| 4148 | - $label = ucfirst($input_str);  | 
                                                        |
| 4149 | - $value = $input_str;  | 
                                                        |
| 4150 | - }  | 
                                                        |
| 4151 | -  | 
                                                        |
| 4152 | -            if ($label != '') {
 | 
                                                        |
| 4153 | -                $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
 | 
                                                        |
| 4154 | - }  | 
                                                        |
| 4155 | - }  | 
                                                        |
| 4156 | - }  | 
                                                        |
| 4157 | -  | 
                                                        |
| 4158 | - return $return;  | 
                                                        |
| 4122 | + $return = array();  | 
                                                        |
| 4123 | +	if ($input != '') {
 | 
                                                        |
| 4124 | + $input = trim($input);  | 
                                                        |
| 4125 | + $input = rtrim($input, ",");  | 
                                                        |
| 4126 | + $input = ltrim($input, ",");  | 
                                                        |
| 4127 | + $input = trim($input);  | 
                                                        |
| 4128 | + }  | 
                                                        |
| 4129 | +  | 
                                                        |
| 4130 | +	$input_arr = explode(',', $input);
 | 
                                                        |
| 4131 | +  | 
                                                        |
| 4132 | +	if (!empty($input_arr)) {
 | 
                                                        |
| 4133 | +		foreach ($input_arr as $input_str) {
 | 
                                                        |
| 4134 | + $input_str = trim($input_str);  | 
                                                        |
| 4135 | +  | 
                                                        |
| 4136 | +			if (strpos($input_str, "/") !== false) {
 | 
                                                        |
| 4137 | +				$input_str = explode("/", $input_str, 2);
 | 
                                                        |
| 4138 | + $label = trim($input_str[0]);  | 
                                                        |
| 4139 | +				if ($translated && $label != '') {
 | 
                                                        |
| 4140 | + $label = __($label, 'geodirectory');  | 
                                                        |
| 4141 | + }  | 
                                                        |
| 4142 | + $label = ucfirst($label);  | 
                                                        |
| 4143 | + $value = trim($input_str[1]);  | 
                                                        |
| 4144 | +			} else {
 | 
                                                        |
| 4145 | +				if ($translated && $input_str != '') {
 | 
                                                        |
| 4146 | + $input_str = __($input_str, 'geodirectory');  | 
                                                        |
| 4147 | + }  | 
                                                        |
| 4148 | + $label = ucfirst($input_str);  | 
                                                        |
| 4149 | + $value = $input_str;  | 
                                                        |
| 4150 | + }  | 
                                                        |
| 4151 | +  | 
                                                        |
| 4152 | +			if ($label != '') {
 | 
                                                        |
| 4153 | +				$return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
 | 
                                                        |
| 4154 | + }  | 
                                                        |
| 4155 | + }  | 
                                                        |
| 4156 | + }  | 
                                                        |
| 4157 | +  | 
                                                        |
| 4158 | + return $return;  | 
                                                        |
| 4159 | 4159 | }  | 
                                                        
| 4160 | 4160 | |
| 4161 | 4161 | /**  | 
                                                        
@@ -4170,51 +4170,51 @@ discard block  | 
                                                    ||
| 4170 | 4170 | */  | 
                                                        
| 4171 | 4171 | function geodir_string_values_to_options($option_values = '', $translated = false)  | 
                                                        
| 4172 | 4172 |  {
 | 
                                                        
| 4173 | - $options = array();  | 
                                                        |
| 4174 | -    if ($option_values == '') {
 | 
                                                        |
| 4175 | - return NULL;  | 
                                                        |
| 4176 | - }  | 
                                                        |
| 4177 | -  | 
                                                        |
| 4178 | -    if (strpos($option_values, "{/optgroup}") !== false) {
 | 
                                                        |
| 4179 | -        $option_values_arr = explode("{/optgroup}", $option_values);
 | 
                                                        |
| 4180 | -  | 
                                                        |
| 4181 | -        foreach ($option_values_arr as $optgroup) {
 | 
                                                        |
| 4182 | -            if (strpos($optgroup, "{optgroup}") !== false) {
 | 
                                                        |
| 4183 | -                $optgroup_arr = explode("{optgroup}", $optgroup);
 | 
                                                        |
| 4184 | -  | 
                                                        |
| 4185 | - $count = 0;  | 
                                                        |
| 4186 | -                foreach ($optgroup_arr as $optgroup_str) {
 | 
                                                        |
| 4187 | - $count++;  | 
                                                        |
| 4188 | - $optgroup_str = trim($optgroup_str);  | 
                                                        |
| 4189 | -  | 
                                                        |
| 4190 | - $optgroup_label = '';  | 
                                                        |
| 4191 | -                    if (strpos($optgroup_str, "|") !== false) {
 | 
                                                        |
| 4192 | -                        $optgroup_str_arr = explode("|", $optgroup_str, 2);
 | 
                                                        |
| 4193 | - $optgroup_label = trim($optgroup_str_arr[0]);  | 
                                                        |
| 4194 | -                        if ($translated && $optgroup_label != '') {
 | 
                                                        |
| 4195 | - $optgroup_label = __($optgroup_label, 'geodirectory');  | 
                                                        |
| 4196 | - }  | 
                                                        |
| 4197 | - $optgroup_label = ucfirst($optgroup_label);  | 
                                                        |
| 4198 | - $optgroup_str = $optgroup_str_arr[1];  | 
                                                        |
| 4199 | - }  | 
                                                        |
| 4200 | -  | 
                                                        |
| 4201 | - $optgroup3 = geodir_string_to_options($optgroup_str, $translated);  | 
                                                        |
| 4202 | -  | 
                                                        |
| 4203 | -                    if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
 | 
                                                        |
| 4204 | -                        $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
 | 
                                                        |
| 4205 | -                        $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
 | 
                                                        |
| 4206 | - $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);  | 
                                                        |
| 4207 | - }  | 
                                                        |
| 4208 | - $options = array_merge($options, $optgroup3);  | 
                                                        |
| 4209 | - }  | 
                                                        |
| 4210 | -            } else {
 | 
                                                        |
| 4211 | - $optgroup1 = geodir_string_to_options($optgroup, $translated);  | 
                                                        |
| 4212 | - $options = array_merge($options, $optgroup1);  | 
                                                        |
| 4213 | - }  | 
                                                        |
| 4214 | - }  | 
                                                        |
| 4215 | -    } else {
 | 
                                                        |
| 4216 | - $options = geodir_string_to_options($option_values, $translated);  | 
                                                        |
| 4217 | - }  | 
                                                        |
| 4218 | -  | 
                                                        |
| 4219 | - return $options;  | 
                                                        |
| 4173 | + $options = array();  | 
                                                        |
| 4174 | +	if ($option_values == '') {
 | 
                                                        |
| 4175 | + return NULL;  | 
                                                        |
| 4176 | + }  | 
                                                        |
| 4177 | +  | 
                                                        |
| 4178 | +	if (strpos($option_values, "{/optgroup}") !== false) {
 | 
                                                        |
| 4179 | +		$option_values_arr = explode("{/optgroup}", $option_values);
 | 
                                                        |
| 4180 | +  | 
                                                        |
| 4181 | +		foreach ($option_values_arr as $optgroup) {
 | 
                                                        |
| 4182 | +			if (strpos($optgroup, "{optgroup}") !== false) {
 | 
                                                        |
| 4183 | +				$optgroup_arr = explode("{optgroup}", $optgroup);
 | 
                                                        |
| 4184 | +  | 
                                                        |
| 4185 | + $count = 0;  | 
                                                        |
| 4186 | +				foreach ($optgroup_arr as $optgroup_str) {
 | 
                                                        |
| 4187 | + $count++;  | 
                                                        |
| 4188 | + $optgroup_str = trim($optgroup_str);  | 
                                                        |
| 4189 | +  | 
                                                        |
| 4190 | + $optgroup_label = '';  | 
                                                        |
| 4191 | +					if (strpos($optgroup_str, "|") !== false) {
 | 
                                                        |
| 4192 | +						$optgroup_str_arr = explode("|", $optgroup_str, 2);
 | 
                                                        |
| 4193 | + $optgroup_label = trim($optgroup_str_arr[0]);  | 
                                                        |
| 4194 | +						if ($translated && $optgroup_label != '') {
 | 
                                                        |
| 4195 | + $optgroup_label = __($optgroup_label, 'geodirectory');  | 
                                                        |
| 4196 | + }  | 
                                                        |
| 4197 | + $optgroup_label = ucfirst($optgroup_label);  | 
                                                        |
| 4198 | + $optgroup_str = $optgroup_str_arr[1];  | 
                                                        |
| 4199 | + }  | 
                                                        |
| 4200 | +  | 
                                                        |
| 4201 | + $optgroup3 = geodir_string_to_options($optgroup_str, $translated);  | 
                                                        |
| 4202 | +  | 
                                                        |
| 4203 | +					if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
 | 
                                                        |
| 4204 | +						$optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
 | 
                                                        |
| 4205 | +						$optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
 | 
                                                        |
| 4206 | + $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end);  | 
                                                        |
| 4207 | + }  | 
                                                        |
| 4208 | + $options = array_merge($options, $optgroup3);  | 
                                                        |
| 4209 | + }  | 
                                                        |
| 4210 | +			} else {
 | 
                                                        |
| 4211 | + $optgroup1 = geodir_string_to_options($optgroup, $translated);  | 
                                                        |
| 4212 | + $options = array_merge($options, $optgroup1);  | 
                                                        |
| 4213 | + }  | 
                                                        |
| 4214 | + }  | 
                                                        |
| 4215 | +	} else {
 | 
                                                        |
| 4216 | + $options = geodir_string_to_options($option_values, $translated);  | 
                                                        |
| 4217 | + }  | 
                                                        |
| 4218 | +  | 
                                                        |
| 4219 | + return $options;  | 
                                                        |
| 4220 | 4220 | }  | 
                                                        
| 4221 | 4221 | \ No newline at end of file  | 
                                                        
@@ -49,7 +49,7 @@ discard block  | 
                                                    ||
| 49 | 49 | function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")  | 
                                                        
| 50 | 50 |      {
 | 
                                                        
| 51 | 51 | global $wpdb;  | 
                                                        
| 52 | - $result = 0;// no rows affected  | 
                                                        |
| 52 | + $result = 0; // no rows affected  | 
                                                        |
| 53 | 53 |          if (!geodir_column_exist($db, $column)) {
 | 
                                                        
| 54 | 54 | if (!empty($db) && !empty($column))  | 
                                                        
| 55 | 55 |                  $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
 | 
                                                        
@@ -74,7 +74,7 @@ discard block  | 
                                                    ||
| 74 | 74 |  {
 | 
                                                        
| 75 | 75 | global $wpdb, $geodir_post_custom_fields_cache;  | 
                                                        
| 76 | 76 | |
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location;  | 
                                                        |
| 77 | + $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location;  | 
                                                        |
| 78 | 78 | |
| 79 | 79 |      if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
 | 
                                                        
| 80 | 80 | return $geodir_post_custom_fields_cache[$cache_stored];  | 
                                                        
@@ -95,7 +95,7 @@ discard block  | 
                                                    ||
| 95 | 95 | |
| 96 | 96 | $post_meta_info = $wpdb->get_results(  | 
                                                        
| 97 | 97 | $wpdb->prepare(  | 
                                                        
| 98 | -            "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
 | 
                                                        |
| 98 | +            "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
 | 
                                                        |
| 99 | 99 | array($post_type)  | 
                                                        
| 100 | 100 | )  | 
                                                        
| 101 | 101 | );  | 
                                                        
@@ -169,7 +169,7 @@ discard block  | 
                                                    ||
| 169 | 169 | $cf = $result_str;  | 
                                                        
| 170 | 170 |          if (!is_object($cf)) {
 | 
                                                        
| 171 | 171 | |
| 172 | -            $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
 | 
                                                        |
| 172 | +            $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
 | 
                                                        |
| 173 | 173 | |
| 174 | 174 |          } else {
 | 
                                                        
| 175 | 175 | $field_info = $cf;  | 
                                                        
@@ -203,14 +203,14 @@ discard block  | 
                                                    ||
| 203 | 203 |          if ($field_id != '') {
 | 
                                                        
| 204 | 204 | $cf = trim($field_id, '_');  | 
                                                        
| 205 | 205 | |
| 206 | -            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
 | 
                                                        |
| 207 | -                $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
 | 
                                                        |
| 206 | +            if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
 | 
                                                        |
| 207 | +                $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
 | 
                                                        |
| 208 | 208 | |
| 209 | 209 | $post_type = $field->post_type;  | 
                                                        
| 210 | 210 | $htmlvar_name = $field->htmlvar_name;  | 
                                                        
| 211 | 211 | |
| 212 | 212 |                  if ($post_type != '' && $htmlvar_name != '') {
 | 
                                                        
| 213 | -                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
 | 
                                                        |
| 213 | +                    $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
 | 
                                                        |
| 214 | 214 | }  | 
                                                        
| 215 | 215 | |
| 216 | 216 | /**  | 
                                                        
@@ -224,18 +224,18 @@ discard block  | 
                                                    ||
| 224 | 224 |                  do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
 | 
                                                        
| 225 | 225 | |
| 226 | 226 |                  if ($field->field_type == 'address') {
 | 
                                                        
| 227 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
 | 
                                                        |
| 228 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
 | 
                                                        |
| 229 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
 | 
                                                        |
| 230 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
 | 
                                                        |
| 231 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
 | 
                                                        |
| 232 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
 | 
                                                        |
| 233 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
 | 
                                                        |
| 234 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
 | 
                                                        |
| 235 | -                    $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
 | 
                                                        |
| 227 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
 | 
                                                        |
| 228 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
 | 
                                                        |
| 229 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
 | 
                                                        |
| 230 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
 | 
                                                        |
| 231 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
 | 
                                                        |
| 232 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
 | 
                                                        |
| 233 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
 | 
                                                        |
| 234 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
 | 
                                                        |
| 235 | +                    $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
 | 
                                                        |
| 236 | 236 |                  } else {
 | 
                                                        
| 237 | 237 |                      if ($field->field_type != 'fieldset') {
 | 
                                                        
| 238 | -                        $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
 | 
                                                        |
| 238 | +                        $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
 | 
                                                        |
| 239 | 239 | }  | 
                                                        
| 240 | 240 | }  | 
                                                        
| 241 | 241 | |
@@ -304,7 +304,7 @@ discard block  | 
                                                    ||
| 304 | 304 | $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : '';  | 
                                                        
| 305 | 305 | |
| 306 | 306 | // some servers fail if a POST value is VARCHAR so we change it.  | 
                                                        
| 307 | -        if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
 | 
                                                        |
| 307 | +        if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
 | 
                                                        |
| 308 | 308 | $request_field['data_type'] = 'VARCHAR';  | 
                                                        
| 309 | 309 | }  | 
                                                        
| 310 | 310 | |
@@ -317,12 +317,12 @@ discard block  | 
                                                    ||
| 317 | 317 | $post_type = $request_field['listing_type'];  | 
                                                        
| 318 | 318 | |
| 319 | 319 |          if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
 | 
                                                        
| 320 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name;  | 
                                                        |
| 320 | + $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name;  | 
                                                        |
| 321 | 321 | }  | 
                                                        
| 322 | 322 | |
| 323 | 323 | $check_html_variable = $wpdb->get_var(  | 
                                                        
| 324 | 324 | $wpdb->prepare(  | 
                                                        
| 325 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ",  | 
                                                        |
| 325 | + "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ",  | 
                                                        |
| 326 | 326 | array($cf, $cehhtmlvar_name, $post_type)  | 
                                                        
| 327 | 327 | )  | 
                                                        
| 328 | 328 | );  | 
                                                        
@@ -334,7 +334,7 @@ discard block  | 
                                                    ||
| 334 | 334 | |
| 335 | 335 | $post_meta_info = $wpdb->get_row(  | 
                                                        
| 336 | 336 | $wpdb->prepare(  | 
                                                        
| 337 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d",  | 
                                                        |
| 337 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d",  | 
                                                        |
| 338 | 338 | array($cf)  | 
                                                        
| 339 | 339 | )  | 
                                                        
| 340 | 340 | );  | 
                                                        
@@ -352,7 +352,7 @@ discard block  | 
                                                    ||
| 352 | 352 | if ($post_type == '') $post_type = 'gd_place';  | 
                                                        
| 353 | 353 | |
| 354 | 354 | |
| 355 | - $detail_table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 355 | + $detail_table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 356 | 356 | |
| 357 | 357 | $admin_title = $request_field['admin_title'];  | 
                                                        
| 358 | 358 | $site_title = $request_field['site_title'];  | 
                                                        
@@ -378,7 +378,7 @@ discard block  | 
                                                    ||
| 378 | 378 | $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : '';  | 
                                                        
| 379 | 379 | |
| 380 | 380 |              if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
 | 
                                                        
| 381 | - $htmlvar_name = 'geodir_' . $htmlvar_name;  | 
                                                        |
| 381 | + $htmlvar_name = 'geodir_'.$htmlvar_name;  | 
                                                        |
| 382 | 382 | }  | 
                                                        
| 383 | 383 | |
| 384 | 384 | $option_values = '';  | 
                                                        
@@ -423,9 +423,9 @@ discard block  | 
                                                    ||
| 423 | 423 | |
| 424 | 424 |              if ($sort_order == '') {
 | 
                                                        
| 425 | 425 | |
| 426 | -                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
 | 
                                                        |
| 426 | +                $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
 | 
                                                        |
| 427 | 427 | |
| 428 | - $sort_order = (int)$last_order + 1;  | 
                                                        |
| 428 | + $sort_order = (int) $last_order + 1;  | 
                                                        |
| 429 | 429 | }  | 
                                                        
| 430 | 430 | |
| 431 | 431 | $default_value_add = '';  | 
                                                        
@@ -437,15 +437,15 @@ discard block  | 
                                                    ||
| 437 | 437 | case 'address':  | 
                                                        
| 438 | 438 | |
| 439 | 439 |                          if ($htmlvar_name != '') {
 | 
                                                        
| 440 | - $prefix = $htmlvar_name . '_';  | 
                                                        |
| 440 | + $prefix = $htmlvar_name.'_';  | 
                                                        |
| 441 | 441 | }  | 
                                                        
| 442 | - $old_prefix = $old_html_variable . '_';  | 
                                                        |
| 442 | + $old_prefix = $old_html_variable.'_';  | 
                                                        |
| 443 | 443 | |
| 444 | 444 | |
| 445 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL";  | 
                                                        |
| 445 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL";  | 
                                                        |
| 446 | 446 | |
| 447 | 447 |                          if ($default_value != '') {
 | 
                                                        
| 448 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 448 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 449 | 449 | }  | 
                                                        
| 450 | 450 | |
| 451 | 451 | $wpdb->query($meta_field_add);  | 
                                                        
@@ -454,12 +454,12 @@ discard block  | 
                                                    ||
| 454 | 454 | |
| 455 | 455 |                              if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
 | 
                                                        
| 456 | 456 | |
| 457 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
 | 
                                                        |
| 457 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
 | 
                                                        |
| 458 | 458 |                                  if ($is_column) {
 | 
                                                        
| 459 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL";  | 
                                                        |
| 459 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL";  | 
                                                        |
| 460 | 460 | |
| 461 | 461 |                                      if ($default_value != '') {
 | 
                                                        
| 462 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 462 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 463 | 463 | }  | 
                                                        
| 464 | 464 | |
| 465 | 465 | $wpdb->query($meta_field_add);  | 
                                                        
@@ -467,9 +467,9 @@ discard block  | 
                                                    ||
| 467 | 467 | |
| 468 | 468 | $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        
| 469 | 469 |                                      if ($default_value != '') {
 | 
                                                        
| 470 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 470 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 471 | 471 | }  | 
                                                        
| 472 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);  | 
                                                        |
| 472 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);  | 
                                                        |
| 473 | 473 | |
| 474 | 474 | }  | 
                                                        
| 475 | 475 | |
@@ -479,36 +479,36 @@ discard block  | 
                                                    ||
| 479 | 479 | |
| 480 | 480 |                              if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
 | 
                                                        
| 481 | 481 | |
| 482 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
 | 
                                                        |
| 482 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
 | 
                                                        |
| 483 | 483 | |
| 484 | 484 |                                  if ($is_column) {
 | 
                                                        
| 485 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL";  | 
                                                        |
| 485 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL";  | 
                                                        |
| 486 | 486 | |
| 487 | 487 |                                      if ($default_value != '') {
 | 
                                                        
| 488 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 488 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 489 | 489 | }  | 
                                                        
| 490 | 490 | |
| 491 | 491 | $wpdb->query($meta_field_add);  | 
                                                        
| 492 | 492 |                                  } else {
 | 
                                                        
| 493 | 493 | $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        
| 494 | 494 |                                      if ($default_value != '') {
 | 
                                                        
| 495 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 495 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 496 | 496 | }  | 
                                                        
| 497 | 497 | |
| 498 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);  | 
                                                        |
| 498 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);  | 
                                                        |
| 499 | 499 | }  | 
                                                        
| 500 | 500 | |
| 501 | 501 | }  | 
                                                        
| 502 | 502 |                              if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
 | 
                                                        
| 503 | 503 | |
| 504 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
 | 
                                                        |
| 504 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
 | 
                                                        |
| 505 | 505 | |
| 506 | 506 |                                  if ($is_column) {
 | 
                                                        
| 507 | 507 | |
| 508 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL";  | 
                                                        |
| 508 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL";  | 
                                                        |
| 509 | 509 | |
| 510 | 510 |                                      if ($default_value != '') {
 | 
                                                        
| 511 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 511 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 512 | 512 | }  | 
                                                        
| 513 | 513 | |
| 514 | 514 | $wpdb->query($meta_field_add);  | 
                                                        
@@ -516,24 +516,24 @@ discard block  | 
                                                    ||
| 516 | 516 | |
| 517 | 517 | $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        
| 518 | 518 |                                      if ($default_value != '') {
 | 
                                                        
| 519 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 519 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 520 | 520 | }  | 
                                                        
| 521 | 521 | |
| 522 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);  | 
                                                        |
| 522 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);  | 
                                                        |
| 523 | 523 | |
| 524 | 524 | }  | 
                                                        
| 525 | 525 | |
| 526 | 526 | }  | 
                                                        
| 527 | 527 |                              if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        
| 528 | 528 | |
| 529 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
 | 
                                                        |
| 529 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
 | 
                                                        |
| 530 | 530 | |
| 531 | 531 |                                  if ($is_column) {
 | 
                                                        
| 532 | 532 | |
| 533 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL";  | 
                                                        |
| 533 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL";  | 
                                                        |
| 534 | 534 | |
| 535 | 535 |                                      if ($default_value != '') {
 | 
                                                        
| 536 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 536 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 537 | 537 | }  | 
                                                        
| 538 | 538 | |
| 539 | 539 | $wpdb->query($meta_field_add);  | 
                                                        
@@ -541,128 +541,128 @@ discard block  | 
                                                    ||
| 541 | 541 | |
| 542 | 542 | $meta_field_add = "VARCHAR( 50 ) NULL";  | 
                                                        
| 543 | 543 |                                      if ($default_value != '') {
 | 
                                                        
| 544 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 544 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 545 | 545 | }  | 
                                                        
| 546 | 546 | |
| 547 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);  | 
                                                        |
| 547 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);  | 
                                                        |
| 548 | 548 | |
| 549 | 549 | }  | 
                                                        
| 550 | 550 | |
| 551 | 551 | }  | 
                                                        
| 552 | 552 |                              if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
 | 
                                                        
| 553 | 553 | |
| 554 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
 | 
                                                        |
| 554 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
 | 
                                                        |
| 555 | 555 |                                  if ($is_column) {
 | 
                                                        
| 556 | 556 | |
| 557 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 557 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 558 | 558 | |
| 559 | 559 |                                      if ($default_value != '') {
 | 
                                                        
| 560 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 560 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 561 | 561 | }  | 
                                                        
| 562 | 562 | |
| 563 | 563 | $wpdb->query($meta_field_add);  | 
                                                        
| 564 | 564 |                                  } else {
 | 
                                                        
| 565 | 565 | |
| 566 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 566 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 567 | 567 | $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        
| 568 | 568 |                                      if ($default_value != '') {
 | 
                                                        
| 569 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 569 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 570 | 570 | }  | 
                                                        
| 571 | 571 | |
| 572 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);  | 
                                                        |
| 572 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);  | 
                                                        |
| 573 | 573 | |
| 574 | 574 | }  | 
                                                        
| 575 | 575 | |
| 576 | 576 | |
| 577 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
 | 
                                                        |
| 577 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
 | 
                                                        |
| 578 | 578 | |
| 579 | 579 |                                  if ($is_column) {
 | 
                                                        
| 580 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 580 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 581 | 581 | |
| 582 | 582 |                                      if ($default_value != '') {
 | 
                                                        
| 583 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 583 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 584 | 584 | }  | 
                                                        
| 585 | 585 | |
| 586 | 586 | $wpdb->query($meta_field_add);  | 
                                                        
| 587 | 587 |                                  } else {
 | 
                                                        
| 588 | 588 | |
| 589 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 589 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 590 | 590 | $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        
| 591 | 591 |                                      if ($default_value != '') {
 | 
                                                        
| 592 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 592 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 593 | 593 | }  | 
                                                        
| 594 | 594 | |
| 595 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);  | 
                                                        |
| 595 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);  | 
                                                        |
| 596 | 596 | }  | 
                                                        
| 597 | 597 | |
| 598 | 598 | }  | 
                                                        
| 599 | 599 |                              if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
 | 
                                                        
| 600 | 600 | |
| 601 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
 | 
                                                        |
| 601 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
 | 
                                                        |
| 602 | 602 | |
| 603 | 603 |                                  if ($is_column) {
 | 
                                                        
| 604 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 604 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 605 | 605 | |
| 606 | 606 |                                      if ($default_value != '') {
 | 
                                                        
| 607 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 607 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 608 | 608 | }  | 
                                                        
| 609 | 609 | |
| 610 | 610 | $wpdb->query($meta_field_add);  | 
                                                        
| 611 | 611 |                                  } else {
 | 
                                                        
| 612 | 612 | |
| 613 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 613 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 614 | 614 | |
| 615 | 615 | $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        
| 616 | 616 |                                      if ($default_value != '') {
 | 
                                                        
| 617 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 617 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 618 | 618 | }  | 
                                                        
| 619 | 619 | |
| 620 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);  | 
                                                        |
| 620 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);  | 
                                                        |
| 621 | 621 | }  | 
                                                        
| 622 | 622 | |
| 623 | 623 | |
| 624 | 624 | }  | 
                                                        
| 625 | 625 |                              if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
 | 
                                                        
| 626 | 626 | |
| 627 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
 | 
                                                        |
| 627 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
 | 
                                                        |
| 628 | 628 |                                  if ($is_column) {
 | 
                                                        
| 629 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 629 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 630 | 630 | |
| 631 | 631 |                                      if ($default_value != '') {
 | 
                                                        
| 632 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 632 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 633 | 633 | }  | 
                                                        
| 634 | 634 | |
| 635 | 635 | $wpdb->query($meta_field_add);  | 
                                                        
| 636 | 636 | |
| 637 | 637 |                                  } else {
 | 
                                                        
| 638 | 638 | |
| 639 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 639 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 640 | 640 | |
| 641 | 641 | $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        
| 642 | 642 |                                      if ($default_value != '') {
 | 
                                                        
| 643 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 643 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 644 | 644 | }  | 
                                                        
| 645 | 645 | |
| 646 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);  | 
                                                        |
| 646 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);  | 
                                                        |
| 647 | 647 | }  | 
                                                        
| 648 | 648 | |
| 649 | 649 | }  | 
                                                        
| 650 | 650 | // show lat lng  | 
                                                        
| 651 | 651 |                              if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
 | 
                                                        
| 652 | -                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
 | 
                                                        |
| 652 | +                                $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
 | 
                                                        |
| 653 | 653 | |
| 654 | 654 |                                  if ($is_column) {
 | 
                                                        
| 655 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 655 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 656 | 656 | $meta_field_add .= " DEFAULT '1'";  | 
                                                        
| 657 | 657 | |
| 658 | 658 | $wpdb->query($meta_field_add);  | 
                                                        
| 659 | 659 |                                  } else {
 | 
                                                        
| 660 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 660 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 661 | 661 | |
| 662 | 662 | $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        
| 663 | 663 | $meta_field_add .= " DEFAULT '1'";  | 
                                                        
| 664 | 664 | |
| 665 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);  | 
                                                        |
| 665 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);  | 
                                                        |
| 666 | 666 | }  | 
                                                        
| 667 | 667 | |
| 668 | 668 | }  | 
                                                        
@@ -678,30 +678,30 @@ discard block  | 
                                                    ||
| 678 | 678 | $op_size = '500';  | 
                                                        
| 679 | 679 | |
| 680 | 680 | // only make the field as big as it needs to be.  | 
                                                        
| 681 | -                        if(isset($option_values) && $option_values && $field_type=='select'){
 | 
                                                        |
| 682 | -                            $option_values_arr = explode(',',$option_values);
 | 
                                                        |
| 683 | -                            if(is_array($option_values_arr)){
 | 
                                                        |
| 681 | +                        if (isset($option_values) && $option_values && $field_type == 'select') {
 | 
                                                        |
| 682 | +                            $option_values_arr = explode(',', $option_values);
 | 
                                                        |
| 683 | +                            if (is_array($option_values_arr)) {
 | 
                                                        |
| 684 | 684 | $op_max = 0;  | 
                                                        
| 685 | -                                foreach($option_values_arr as $op_val){
 | 
                                                        |
| 686 | -                                    if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
 | 
                                                        |
| 685 | +                                foreach ($option_values_arr as $op_val) {
 | 
                                                        |
| 686 | +                                    if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
 | 
                                                        |
| 687 | 687 | }  | 
                                                        
| 688 | -                                if($op_max){$op_size =$op_max; }
 | 
                                                        |
| 688 | +                                if ($op_max) {$op_size = $op_max; }
 | 
                                                        |
| 689 | 689 | }  | 
                                                        
| 690 | -                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
 | 
                                                        |
| 691 | -                            if(strlen($option_values)){
 | 
                                                        |
| 692 | - $op_size = strlen($option_values);  | 
                                                        |
| 690 | +                        }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
 | 
                                                        |
| 691 | +                            if (strlen($option_values)) {
 | 
                                                        |
| 692 | + $op_size = strlen($option_values);  | 
                                                        |
| 693 | 693 | }  | 
                                                        
| 694 | 694 | }  | 
                                                        
| 695 | 695 | |
| 696 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL";  | 
                                                        |
| 696 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL";  | 
                                                        |
| 697 | 697 | |
| 698 | 698 |                          if ($default_value != '') {
 | 
                                                        
| 699 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 699 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 700 | 700 | }  | 
                                                        
| 701 | 701 | |
| 702 | 702 | $alter_result = $wpdb->query($meta_field_add);  | 
                                                        
| 703 | -                        if($alter_result===false){
 | 
                                                        |
| 704 | -                            return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 703 | +                        if ($alter_result === false) {
 | 
                                                        |
| 704 | +                            return __('Column change failed, you may have too many columns.', 'geodirectory');
 | 
                                                        |
| 705 | 705 | }  | 
                                                        
| 706 | 706 | |
| 707 | 707 | if (isset($request_field['cat_display_type']))  | 
                                                        
@@ -718,9 +718,9 @@ discard block  | 
                                                    ||
| 718 | 718 | case 'url':  | 
                                                        
| 719 | 719 | case 'file':  | 
                                                        
| 720 | 720 | |
| 721 | -                        $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
 | 
                                                        |
| 722 | -                        if($alter_result===false){
 | 
                                                        |
| 723 | -                            return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 721 | +                        $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
 | 
                                                        |
| 722 | +                        if ($alter_result === false) {
 | 
                                                        |
| 723 | +                            return __('Column change failed, you may have too many columns.', 'geodirectory');
 | 
                                                        |
| 724 | 724 | }  | 
                                                        
| 725 | 725 | if (isset($request_field['advanced_editor']))  | 
                                                        
| 726 | 726 | $extra_fields = $request_field['advanced_editor'];  | 
                                                        
@@ -734,24 +734,24 @@ discard block  | 
                                                    ||
| 734 | 734 | default:  | 
                                                        
| 735 | 735 |                          if ($data_type != 'VARCHAR' && $data_type != '') {
 | 
                                                        
| 736 | 736 |                              if ($data_type == 'FLOAT' && $decimal_point > 0) {
 | 
                                                        
| 737 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";  | 
                                                        |
| 737 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL";  | 
                                                        |
| 738 | 738 |                              } else {
 | 
                                                        
| 739 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";  | 
                                                        |
| 739 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL";  | 
                                                        |
| 740 | 740 | }  | 
                                                        
| 741 | 741 | |
| 742 | 742 |                              if (is_numeric($default_value) && $default_value != '') {
 | 
                                                        
| 743 | - $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 743 | + $default_value_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 744 | 744 | }  | 
                                                        
| 745 | 745 |                          } else {
 | 
                                                        
| 746 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL";  | 
                                                        |
| 746 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL";  | 
                                                        |
| 747 | 747 |                              if ($default_value != '') {
 | 
                                                        
| 748 | - $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 748 | + $default_value_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 749 | 749 | }  | 
                                                        
| 750 | 750 | }  | 
                                                        
| 751 | 751 | |
| 752 | 752 | $alter_result = $wpdb->query($default_value_add);  | 
                                                        
| 753 | -                        if($alter_result===false){
 | 
                                                        |
| 754 | -                            return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        |
| 753 | +                        if ($alter_result === false) {
 | 
                                                        |
| 754 | +                            return __('Column change failed, you may have too many columns.', 'geodirectory');
 | 
                                                        |
| 755 | 755 | }  | 
                                                        
| 756 | 756 | break;  | 
                                                        
| 757 | 757 | endswitch;  | 
                                                        
@@ -767,7 +767,7 @@ discard block  | 
                                                    ||
| 767 | 767 | |
| 768 | 768 | $wpdb->prepare(  | 
                                                        
| 769 | 769 | |
| 770 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 770 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set  | 
                                                        |
| 771 | 771 | post_type = %s,  | 
                                                        
| 772 | 772 | admin_title = %s,  | 
                                                        
| 773 | 773 | site_title = %s,  | 
                                                        
@@ -799,7 +799,7 @@ discard block  | 
                                                    ||
| 799 | 799 | for_admin_use = %s  | 
                                                        
| 800 | 800 | where id = %d",  | 
                                                        
| 801 | 801 | |
| 802 | - array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)  | 
                                                        |
| 802 | + array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf)  | 
                                                        |
| 803 | 803 | )  | 
                                                        
| 804 | 804 | |
| 805 | 805 | );  | 
                                                        
@@ -809,7 +809,7 @@ discard block  | 
                                                    ||
| 809 | 809 | |
| 810 | 810 | $wpdb->query(  | 
                                                        
| 811 | 811 | $wpdb->prepare(  | 
                                                        
| 812 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 812 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set  | 
                                                        |
| 813 | 813 | site_title=%s  | 
                                                        
| 814 | 814 | where post_type = %s and htmlvar_name = %s",  | 
                                                        
| 815 | 815 | array($site_title, $post_type, $htmlvar_name)  | 
                                                        
@@ -818,7 +818,7 @@ discard block  | 
                                                    ||
| 818 | 818 | |
| 819 | 819 | |
| 820 | 820 | if ($cat_sort == '')  | 
                                                        
| 821 | -                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
 | 
                                                        |
| 821 | +                    $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
 | 
                                                        |
| 822 | 822 | |
| 823 | 823 | |
| 824 | 824 | /**  | 
                                                        
@@ -838,7 +838,7 @@ discard block  | 
                                                    ||
| 838 | 838 | $data_type = '';  | 
                                                        
| 839 | 839 | |
| 840 | 840 |                          if ($htmlvar_name != '') {
 | 
                                                        
| 841 | - $prefix = $htmlvar_name . '_';  | 
                                                        |
| 841 | + $prefix = $htmlvar_name.'_';  | 
                                                        |
| 842 | 842 | }  | 
                                                        
| 843 | 843 | $old_prefix = $old_html_variable;  | 
                                                        
| 844 | 844 | |
@@ -846,109 +846,109 @@ discard block  | 
                                                    ||
| 846 | 846 | |
| 847 | 847 | $meta_field_add = "VARCHAR( 254 ) NULL";  | 
                                                        
| 848 | 848 |                          if ($default_value != '') {
 | 
                                                        
| 849 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 849 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 850 | 850 | }  | 
                                                        
| 851 | 851 | |
| 852 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add);  | 
                                                        |
| 852 | + geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add);  | 
                                                        |
| 853 | 853 | //$wpdb->query($meta_field_add);  | 
                                                        
| 854 | 854 | |
| 855 | 855 | |
| 856 | 856 |                          if (!empty($extra_fields)) {
 | 
                                                        
| 857 | 857 | |
| 858 | 858 |                              if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
 | 
                                                        
| 859 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL";  | 
                                                        |
| 859 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL";  | 
                                                        |
| 860 | 860 | $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        
| 861 | 861 |                                  if ($default_value != '') {
 | 
                                                        
| 862 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 862 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 863 | 863 | }  | 
                                                        
| 864 | 864 | |
| 865 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add);  | 
                                                        |
| 865 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add);  | 
                                                        |
| 866 | 866 | //$wpdb->query($meta_field_add);  | 
                                                        
| 867 | 867 | }  | 
                                                        
| 868 | 868 |                              if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
 | 
                                                        
| 869 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL";  | 
                                                        |
| 869 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL";  | 
                                                        |
| 870 | 870 | $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        
| 871 | 871 |                                  if ($default_value != '') {
 | 
                                                        
| 872 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 872 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 873 | 873 | }  | 
                                                        
| 874 | 874 | |
| 875 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add);  | 
                                                        |
| 875 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add);  | 
                                                        |
| 876 | 876 | //$wpdb->query($meta_field_add);  | 
                                                        
| 877 | 877 | }  | 
                                                        
| 878 | 878 |                              if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
 | 
                                                        
| 879 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL";  | 
                                                        |
| 879 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL";  | 
                                                        |
| 880 | 880 | |
| 881 | 881 | $meta_field_add = "VARCHAR( 30 ) NULL";  | 
                                                        
| 882 | 882 |                                  if ($default_value != '') {
 | 
                                                        
| 883 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 883 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 884 | 884 | }  | 
                                                        
| 885 | 885 | |
| 886 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add);  | 
                                                        |
| 886 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add);  | 
                                                        |
| 887 | 887 | //$wpdb->query($meta_field_add);  | 
                                                        
| 888 | 888 | }  | 
                                                        
| 889 | 889 |                              if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        
| 890 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL";  | 
                                                        |
| 890 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL";  | 
                                                        |
| 891 | 891 | $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        
| 892 | 892 |                                  if ($default_value != '') {
 | 
                                                        
| 893 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 893 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 894 | 894 | }  | 
                                                        
| 895 | 895 | |
| 896 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add);  | 
                                                        |
| 896 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add);  | 
                                                        |
| 897 | 897 | //$wpdb->query($meta_field_add);  | 
                                                        
| 898 | 898 | }  | 
                                                        
| 899 | 899 |                              if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
 | 
                                                        
| 900 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 900 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 901 | 901 | $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        
| 902 | 902 |                                  if ($default_value != '') {
 | 
                                                        
| 903 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 903 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 904 | 904 | }  | 
                                                        
| 905 | 905 | |
| 906 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add);  | 
                                                        |
| 906 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add);  | 
                                                        |
| 907 | 907 | //$wpdb->query($meta_field_add);  | 
                                                        
| 908 | 908 | |
| 909 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 909 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL";  | 
                                                        |
| 910 | 910 | |
| 911 | 911 | $meta_field_add = "VARCHAR( 20 ) NULL";  | 
                                                        
| 912 | 912 |                                  if ($default_value != '') {
 | 
                                                        
| 913 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 913 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 914 | 914 | }  | 
                                                        
| 915 | 915 | |
| 916 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add);  | 
                                                        |
| 916 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add);  | 
                                                        |
| 917 | 917 | |
| 918 | 918 | //$wpdb->query($meta_field_add);  | 
                                                        
| 919 | 919 | }  | 
                                                        
| 920 | 920 |                              if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
 | 
                                                        
| 921 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 921 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL";  | 
                                                        |
| 922 | 922 | |
| 923 | 923 | $meta_field_add = "VARCHAR( 15 ) NULL";  | 
                                                        
| 924 | 924 |                                  if ($default_value != '') {
 | 
                                                        
| 925 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 925 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 926 | 926 | }  | 
                                                        
| 927 | 927 | |
| 928 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add);  | 
                                                        |
| 928 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add);  | 
                                                        |
| 929 | 929 | |
| 930 | 930 | //$wpdb->query($meta_field_add);  | 
                                                        
| 931 | 931 | }  | 
                                                        
| 932 | 932 |                              if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
 | 
                                                        
| 933 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 933 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL";  | 
                                                        |
| 934 | 934 | |
| 935 | 935 | $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        
| 936 | 936 |                                  if ($default_value != '') {
 | 
                                                        
| 937 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 937 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 938 | 938 | }  | 
                                                        
| 939 | 939 | |
| 940 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add);  | 
                                                        |
| 940 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add);  | 
                                                        |
| 941 | 941 | |
| 942 | 942 | //$wpdb->query($meta_field_add);  | 
                                                        
| 943 | 943 | }  | 
                                                        
| 944 | 944 | // show lat lng  | 
                                                        
| 945 | 945 |                              if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
 | 
                                                        
| 946 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 946 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL";  | 
                                                        |
| 947 | 947 | |
| 948 | 948 | $meta_field_add = "VARCHAR( 3 ) NULL";  | 
                                                        
| 949 | 949 | $meta_field_add .= " DEFAULT '1'";  | 
                                                        
| 950 | 950 | |
| 951 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add);  | 
                                                        |
| 951 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add);  | 
                                                        |
| 952 | 952 | //$wpdb->query($meta_field_add);  | 
                                                        
| 953 | 953 | }  | 
                                                        
| 954 | 954 | }  | 
                                                        
@@ -958,8 +958,8 @@ discard block  | 
                                                    ||
| 958 | 958 | case 'checkbox':  | 
                                                        
| 959 | 959 | $data_type = 'TINYINT';  | 
                                                        
| 960 | 960 | |
| 961 | - $meta_field_add = $data_type . "( 1 ) NOT NULL ";  | 
                                                        |
| 962 | -                        if ((int)$default_value === 1) {
 | 
                                                        |
| 961 | + $meta_field_add = $data_type."( 1 ) NOT NULL ";  | 
                                                        |
| 962 | +                        if ((int) $default_value === 1) {
 | 
                                                        |
| 963 | 963 | $meta_field_add .= " DEFAULT '1'";  | 
                                                        
| 964 | 964 | }  | 
                                                        
| 965 | 965 | |
@@ -992,7 +992,7 @@ discard block  | 
                                                    ||
| 992 | 992 | }  | 
                                                        
| 993 | 993 |                          } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
 | 
                                                        
| 994 | 994 |                              if (strlen($option_values)) {
 | 
                                                        
| 995 | - $op_size = strlen($option_values);  | 
                                                        |
| 995 | + $op_size = strlen($option_values);  | 
                                                        |
| 996 | 996 | }  | 
                                                        
| 997 | 997 | |
| 998 | 998 |                              if (isset($request_field['multi_display_type'])) {
 | 
                                                        
@@ -1000,9 +1000,9 @@ discard block  | 
                                                    ||
| 1000 | 1000 | }  | 
                                                        
| 1001 | 1001 | }  | 
                                                        
| 1002 | 1002 | |
| 1003 | - $meta_field_add = $data_type . "( $op_size ) NULL ";  | 
                                                        |
| 1003 | + $meta_field_add = $data_type."( $op_size ) NULL ";  | 
                                                        |
| 1004 | 1004 |                          if ($default_value != '') {
 | 
                                                        
| 1005 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1005 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 1006 | 1006 | }  | 
                                                        
| 1007 | 1007 | |
| 1008 | 1008 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        
@@ -1017,9 +1017,9 @@ discard block  | 
                                                    ||
| 1017 | 1017 | |
| 1018 | 1018 | $data_type = 'TEXT';  | 
                                                        
| 1019 | 1019 | |
| 1020 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1020 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";  | 
                                                        |
| 1021 | 1021 | |
| 1022 | - $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1022 | + $meta_field_add = $data_type." NULL ";  | 
                                                        |
| 1023 | 1023 | /*if($default_value != '')  | 
                                                        
| 1024 | 1024 |  					{ $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
 | 
                                                        
| 1025 | 1025 | |
@@ -1034,9 +1034,9 @@ discard block  | 
                                                    ||
| 1034 | 1034 | |
| 1035 | 1035 | $data_type = 'DATE';  | 
                                                        
| 1036 | 1036 | |
| 1037 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1037 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";  | 
                                                        |
| 1038 | 1038 | |
| 1039 | - $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1039 | + $meta_field_add = $data_type." NULL ";  | 
                                                        |
| 1040 | 1040 | |
| 1041 | 1041 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        
| 1042 | 1042 |                          if ($add_result === false) {
 | 
                                                        
@@ -1049,9 +1049,9 @@ discard block  | 
                                                    ||
| 1049 | 1049 | |
| 1050 | 1050 | $data_type = 'TIME';  | 
                                                        
| 1051 | 1051 | |
| 1052 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL ";  | 
                                                        |
| 1052 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL ";  | 
                                                        |
| 1053 | 1053 | |
| 1054 | - $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1054 | + $meta_field_add = $data_type." NULL ";  | 
                                                        |
| 1055 | 1055 | |
| 1056 | 1056 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add);  | 
                                                        
| 1057 | 1057 |                          if ($add_result === false) {
 | 
                                                        
@@ -1063,22 +1063,22 @@ discard block  | 
                                                    ||
| 1063 | 1063 | default:  | 
                                                        
| 1064 | 1064 | |
| 1065 | 1065 |                          if ($data_type != 'VARCHAR' && $data_type != '') {
 | 
                                                        
| 1066 | - $meta_field_add = $data_type . " NULL ";  | 
                                                        |
| 1066 | + $meta_field_add = $data_type." NULL ";  | 
                                                        |
| 1067 | 1067 | |
| 1068 | 1068 |                              if ($data_type == 'FLOAT' && $decimal_point > 0) {
 | 
                                                        
| 1069 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";  | 
                                                        |
| 1069 | + $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL ";  | 
                                                        |
| 1070 | 1070 | }  | 
                                                        
| 1071 | 1071 | |
| 1072 | 1072 |                              if (is_numeric($default_value) && $default_value != '') {
 | 
                                                        
| 1073 | - $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1074 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1073 | + $default_value_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 1074 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 1075 | 1075 | }  | 
                                                        
| 1076 | 1076 |                          } else {
 | 
                                                        
| 1077 | 1077 | $meta_field_add = " VARCHAR( 254 ) NULL ";  | 
                                                        
| 1078 | 1078 | |
| 1079 | 1079 |                              if ($default_value != '') {
 | 
                                                        
| 1080 | - $default_value_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1081 | - $meta_field_add .= " DEFAULT '" . $default_value . "'";  | 
                                                        |
| 1080 | + $default_value_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 1081 | + $meta_field_add .= " DEFAULT '".$default_value."'";  | 
                                                        |
| 1082 | 1082 | }  | 
                                                        
| 1083 | 1083 | }  | 
                                                        
| 1084 | 1084 | |
@@ -1100,7 +1100,7 @@ discard block  | 
                                                    ||
| 1100 | 1100 | |
| 1101 | 1101 | $wpdb->prepare(  | 
                                                        
| 1102 | 1102 | |
| 1103 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 1103 | + "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set  | 
                                                        |
| 1104 | 1104 | post_type = %s,  | 
                                                        
| 1105 | 1105 | admin_title = %s,  | 
                                                        
| 1106 | 1106 | site_title = %s,  | 
                                                        
@@ -1131,7 +1131,7 @@ discard block  | 
                                                    ||
| 1131 | 1131 | validation_msg = %s,  | 
                                                        
| 1132 | 1132 | for_admin_use = %s ",  | 
                                                        
| 1133 | 1133 | |
| 1134 | - array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)  | 
                                                        |
| 1134 | + array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use)  | 
                                                        |
| 1135 | 1135 | |
| 1136 | 1136 | )  | 
                                                        
| 1137 | 1137 | |
@@ -1143,7 +1143,7 @@ discard block  | 
                                                    ||
| 1143 | 1143 | |
| 1144 | 1144 | }  | 
                                                        
| 1145 | 1145 | |
| 1146 | - return (int)$lastid;  | 
                                                        |
| 1146 | + return (int) $lastid;  | 
                                                        |
| 1147 | 1147 | |
| 1148 | 1148 | |
| 1149 | 1149 |          } else {
 | 
                                                        
@@ -1176,7 +1176,7 @@ discard block  | 
                                                    ||
| 1176 | 1176 | |
| 1177 | 1177 | $post_meta_info = $wpdb->query(  | 
                                                        
| 1178 | 1178 | $wpdb->prepare(  | 
                                                        
| 1179 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set  | 
                                                        |
| 1179 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set  | 
                                                        |
| 1180 | 1180 | sort_order=%d  | 
                                                        
| 1181 | 1181 | where id= %d",  | 
                                                        
| 1182 | 1182 | array($count, $cf)  | 
                                                        
@@ -1232,7 +1232,7 @@ discard block  | 
                                                    ||
| 1232 | 1232 | $value = '';  | 
                                                        
| 1233 | 1233 | |
| 1234 | 1234 | /* field available to site admin only for edit */  | 
                                                        
| 1235 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;  | 
                                                        |
| 1235 | + $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;  | 
                                                        |
| 1236 | 1236 |          if ($for_admin_use && !is_super_admin()) {
 | 
                                                        
| 1237 | 1237 | continue;  | 
                                                        
| 1238 | 1238 | }  | 
                                                        
@@ -1266,22 +1266,22 @@ discard block  | 
                                                    ||
| 1266 | 1266 |           * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
 | 
                                                        
| 1267 | 1267 | * @see 'geodir_after_custom_form_field_$name'  | 
                                                        
| 1268 | 1268 | */  | 
                                                        
| 1269 | -        do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
 | 
                                                        |
| 1269 | +        do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
 | 
                                                        |
| 1270 | 1270 | |
| 1271 | 1271 |          if ($type == 'fieldset') {
 | 
                                                        
| 1272 | - $fieldset_id = (int)$val['id'];  | 
                                                        |
| 1273 | - $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;  | 
                                                        |
| 1272 | + $fieldset_id = (int) $val['id'];  | 
                                                        |
| 1273 | + $fieldset_field_class = 'gd-fieldset-'.$fieldset_id;  | 
                                                        |
| 1274 | 1274 | ?>  | 
                                                        
| 1275 | - <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>  | 
                                                        |
| 1276 | - <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>  | 
                                                        |
| 1275 | + <h5 id="geodir_fieldset_<?php echo $fieldset_id; ?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id; ?>"><?php echo $site_title; ?>  | 
                                                        |
| 1276 | + <?php if ($admin_desc != '') echo '<small>( '.$admin_desc.' )</small>'; ?></h5>  | 
                                                        |
| 1277 | 1277 | <?php  | 
                                                        
| 1278 | 1278 |          } else if ($type == 'address') {
 | 
                                                        
| 1279 | - $prefix = $name . '_';  | 
                                                        |
| 1279 | + $prefix = $name.'_';  | 
                                                        |
| 1280 | 1280 | |
| 1281 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');  | 
                                                        |
| 1282 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');  | 
                                                        |
| 1281 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address');  | 
                                                        |
| 1282 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code ');  | 
                                                        |
| 1283 | 1283 |              ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
 | 
                                                        
| 1284 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');  | 
                                                        |
| 1284 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview');  | 
                                                        |
| 1285 | 1285 | |
| 1286 | 1286 | $address = '';  | 
                                                        
| 1287 | 1287 | $zip = '';  | 
                                                        
@@ -1292,21 +1292,21 @@ discard block  | 
                                                    ||
| 1292 | 1292 | |
| 1293 | 1293 |              if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
 | 
                                                        
| 1294 | 1294 | $post = $gd_ses_listing;  | 
                                                        
| 1295 | - $address = $post[$prefix . 'address'];  | 
                                                        |
| 1296 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';  | 
                                                        |
| 1297 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';  | 
                                                        |
| 1298 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';  | 
                                                        |
| 1299 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';  | 
                                                        |
| 1300 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';  | 
                                                        |
| 1295 | + $address = $post[$prefix.'address'];  | 
                                                        |
| 1296 | + $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : '';  | 
                                                        |
| 1297 | + $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : '';  | 
                                                        |
| 1298 | + $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : '';  | 
                                                        |
| 1299 | + $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : '';  | 
                                                        |
| 1300 | + $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : '';  | 
                                                        |
| 1301 | 1301 |              } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
 | 
                                                        
| 1302 | - $post_info = (array)$post_info;  | 
                                                        |
| 1303 | -  | 
                                                        |
| 1304 | - $address = $post_info[$prefix . 'address'];  | 
                                                        |
| 1305 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';  | 
                                                        |
| 1306 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';  | 
                                                        |
| 1307 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';  | 
                                                        |
| 1308 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';  | 
                                                        |
| 1309 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';  | 
                                                        |
| 1302 | + $post_info = (array) $post_info;  | 
                                                        |
| 1303 | +  | 
                                                        |
| 1304 | + $address = $post_info[$prefix.'address'];  | 
                                                        |
| 1305 | + $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : '';  | 
                                                        |
| 1306 | + $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : '';  | 
                                                        |
| 1307 | + $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : '';  | 
                                                        |
| 1308 | + $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : '';  | 
                                                        |
| 1309 | + $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : '';  | 
                                                        |
| 1310 | 1310 | }  | 
                                                        
| 1311 | 1311 | |
| 1312 | 1312 | $location = geodir_get_default_location();  | 
                                                        
@@ -1343,16 +1343,16 @@ discard block  | 
                                                    ||
| 1343 | 1343 | |
| 1344 | 1344 | ?>  | 
                                                        
| 1345 | 1345 | |
| 1346 | - <div id="geodir_<?php echo $prefix . 'address';?>_row"  | 
                                                        |
| 1347 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1346 | + <div id="geodir_<?php echo $prefix.'address'; ?>_row"  | 
                                                        |
| 1347 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1348 | 1348 | <label>  | 
                                                        
| 1349 | 1349 | <?php _e($address_title, 'geodirectory'); ?>  | 
                                                        
| 1350 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1350 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1351 | 1351 | </label>  | 
                                                        
| 1352 | - <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"  | 
                                                        |
| 1353 | - id="<?php echo $prefix . 'address';?>" class="geodir_textfield"  | 
                                                        |
| 1352 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>"  | 
                                                        |
| 1353 | + id="<?php echo $prefix.'address'; ?>" class="geodir_textfield"  | 
                                                        |
| 1354 | 1354 | value="<?php echo esc_attr(stripslashes($address)); ?>"/>  | 
                                                        
| 1355 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1355 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1356 | 1356 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1357 | 1357 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1358 | 1358 | <?php } ?>  | 
                                                        
@@ -1372,14 +1372,14 @@ discard block  | 
                                                    ||
| 1372 | 1372 | |
| 1373 | 1373 |              if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
 | 
                                                        
| 1374 | 1374 | |
| 1375 | - <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"  | 
                                                        |
| 1376 | - class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1375 | + <div id="geodir_<?php echo $prefix.'zip'; ?>_row"  | 
                                                        |
| 1376 | + class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1377 | 1377 | <label>  | 
                                                        
| 1378 | 1378 | <?php _e($zip_title, 'geodirectory'); ?>  | 
                                                        
| 1379 | 1379 | <?php /*if($is_required) echo '<span>*</span>';*/ ?>  | 
                                                        
| 1380 | 1380 | </label>  | 
                                                        
| 1381 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>"  | 
                                                        |
| 1382 | - id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill"  | 
                                                        |
| 1381 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>"  | 
                                                        |
| 1382 | + id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill"  | 
                                                        |
| 1383 | 1383 | value="<?php echo esc_attr(stripslashes($zip)); ?>"/>  | 
                                                        
| 1384 | 1384 |                      <?php /*if($is_required) {?>
 | 
                                                        
| 1385 | 1385 | <span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span>  | 
                                                        
@@ -1389,14 +1389,14 @@ discard block  | 
                                                    ||
| 1389 | 1389 | |
| 1390 | 1390 |              <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
 | 
                                                        
| 1391 | 1391 | |
| 1392 | - <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1392 | + <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1393 | 1393 | <?php  | 
                                                        
| 1394 | 1394 | /**  | 
                                                        
| 1395 | 1395 | * Contains add listing page map functions.  | 
                                                        
| 1396 | 1396 | *  | 
                                                        
| 1397 | 1397 | * @since 1.0.0  | 
                                                        
| 1398 | 1398 | */  | 
                                                        
| 1399 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");  | 
                                                        |
| 1399 | + include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php");  | 
                                                        |
| 1400 | 1400 |                      if ($lat_lng_blank) {
 | 
                                                        
| 1401 | 1401 | $lat = '';  | 
                                                        
| 1402 | 1402 | $lng = '';  | 
                                                        
@@ -1407,14 +1407,14 @@ discard block  | 
                                                    ||
| 1407 | 1407 | <?php  | 
                                                        
| 1408 | 1408 | /* show lat lng */  | 
                                                        
| 1409 | 1409 | $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>  | 
                                                        
| 1410 | - <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"  | 
                                                        |
| 1411 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>  | 
                                                        |
| 1410 | + <div id="geodir_<?php echo $prefix.'latitude'; ?>_row"  | 
                                                        |
| 1411 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>>  | 
                                                        |
| 1412 | 1412 | <label>  | 
                                                        
| 1413 | 1413 | <?php echo PLACE_ADDRESS_LAT; ?>  | 
                                                        
| 1414 | 1414 | <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        
| 1415 | 1415 | </label>  | 
                                                        
| 1416 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"  | 
                                                        |
| 1417 | - id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"  | 
                                                        |
| 1416 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>"  | 
                                                        |
| 1417 | + id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield"  | 
                                                        |
| 1418 | 1418 | value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/>  | 
                                                        
| 1419 | 1419 | <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span>  | 
                                                        
| 1420 | 1420 |                      <?php if ($is_required) { ?>
 | 
                                                        
@@ -1422,14 +1422,14 @@ discard block  | 
                                                    ||
| 1422 | 1422 | <?php } ?>  | 
                                                        
| 1423 | 1423 | </div>  | 
                                                        
| 1424 | 1424 | |
| 1425 | - <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"  | 
                                                        |
| 1426 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>  | 
                                                        |
| 1425 | + <div id="geodir_<?php echo $prefix.'longitude'; ?>_row"  | 
                                                        |
| 1426 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>>  | 
                                                        |
| 1427 | 1427 | <label>  | 
                                                        
| 1428 | 1428 | <?php echo PLACE_ADDRESS_LNG; ?>  | 
                                                        
| 1429 | 1429 | <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        
| 1430 | 1430 | </label>  | 
                                                        
| 1431 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"  | 
                                                        |
| 1432 | - id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"  | 
                                                        |
| 1431 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>"  | 
                                                        |
| 1432 | + id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield"  | 
                                                        |
| 1433 | 1433 | value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/>  | 
                                                        
| 1434 | 1434 | <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span>  | 
                                                        
| 1435 | 1435 |                      <?php if ($is_required) { ?>
 | 
                                                        
@@ -1439,32 +1439,32 @@ discard block  | 
                                                    ||
| 1439 | 1439 | <?php } ?>  | 
                                                        
| 1440 | 1440 | |
| 1441 | 1441 |              <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
 | 
                                                        
| 1442 | - <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1442 | + <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1443 | 1443 | <label><?php _e($mapview_title, 'geodirectory'); ?></label>  | 
                                                        
| 1444 | 1444 | |
| 1445 | 1445 | |
| 1446 | 1446 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"  | 
                                                        
| 1447 | 1447 | class="gd-checkbox"  | 
                                                        
| 1448 | - name="<?php echo $prefix . 'mapview'; ?>"  | 
                                                        |
| 1449 | -                                                            id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
 | 
                                                        |
| 1448 | + name="<?php echo $prefix.'mapview'; ?>"  | 
                                                        |
| 1449 | +                                                            id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
 | 
                                                        |
| 1450 | 1450 | echo 'checked="checked"';  | 
                                                        
| 1451 | 1451 |                          } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
 | 
                                                        
| 1452 | 1452 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"  | 
                                                        
| 1453 | 1453 | class="gd-checkbox"  | 
                                                        
| 1454 | - name="<?php echo $prefix . 'mapview'; ?>"  | 
                                                        |
| 1454 | + name="<?php echo $prefix.'mapview'; ?>"  | 
                                                        |
| 1455 | 1455 |                                                               id="map_view1" <?php if ($mapview == 'SATELLITE') {
 | 
                                                        
| 1456 | 1456 | echo 'checked="checked"';  | 
                                                        
| 1457 | 1457 |                          } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
 | 
                                                        
| 1458 | 1458 | |
| 1459 | 1459 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"  | 
                                                        
| 1460 | 1460 | class="gd-checkbox"  | 
                                                        
| 1461 | - name="<?php echo $prefix . 'mapview'; ?>"  | 
                                                        |
| 1461 | + name="<?php echo $prefix.'mapview'; ?>"  | 
                                                        |
| 1462 | 1462 |                                                              id="map_view2" <?php if ($mapview == 'HYBRID') {
 | 
                                                        
| 1463 | 1463 | echo 'checked="checked"';  | 
                                                        
| 1464 | 1464 |                          } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
 | 
                                                        
| 1465 | 1465 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"  | 
                                                        
| 1466 | 1466 | class="gd-checkbox"  | 
                                                        
| 1467 | - name="<?php echo $prefix . 'mapview'; ?>"  | 
                                                        |
| 1467 | + name="<?php echo $prefix.'mapview'; ?>"  | 
                                                        |
| 1468 | 1468 |                                                              id="map_view3" <?php if ($mapview == 'TERRAIN') {
 | 
                                                        
| 1469 | 1469 | echo 'checked="checked"';  | 
                                                        
| 1470 | 1470 |                          } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
 | 
                                                        
@@ -1476,35 +1476,35 @@ discard block  | 
                                                    ||
| 1476 | 1476 |              <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
 | 
                                                        
| 1477 | 1477 |                  <input type="hidden" value="<?php if (isset($mapzoom)) {
 | 
                                                        
| 1478 | 1478 | echo esc_attr($mapzoom);  | 
                                                        
| 1479 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>  | 
                                                        |
| 1479 | + } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/>  | 
                                                        |
| 1480 | 1480 | <?php }?>  | 
                                                        
| 1481 | 1481 |          <?php } elseif ($type == 'text') {
 | 
                                                        
| 1482 | 1482 | |
| 1483 | 1483 | //number and float validation $validation_pattern  | 
                                                        
| 1484 | -            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
 | 
                                                        |
| 1485 | -            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
 | 
                                                        |
| 1484 | +            if (isset($val['data_type']) && $val['data_type'] == 'INT') {$type = 'number'; }
 | 
                                                        |
| 1485 | +            elseif (isset($val['data_type']) && $val['data_type'] == 'FLOAT') {$type = 'float'; }
 | 
                                                        |
| 1486 | 1486 | //print_r($val);  | 
                                                        
| 1487 | 1487 | //validation  | 
                                                        
| 1488 | -            if(isset($val['validation_pattern']) && $val['validation_pattern']){
 | 
                                                        |
| 1488 | +            if (isset($val['validation_pattern']) && $val['validation_pattern']) {
 | 
                                                        |
| 1489 | 1489 | $validation = 'pattern="'.$val['validation_pattern'].'"';  | 
                                                        
| 1490 | -            }else{$validation='';}
 | 
                                                        |
| 1490 | +            } else {$validation = ''; }
 | 
                                                        |
| 1491 | 1491 | |
| 1492 | 1492 | // validation message  | 
                                                        
| 1493 | -            if(isset($val['validation_msg']) && $val['validation_msg']){
 | 
                                                        |
| 1493 | +            if (isset($val['validation_msg']) && $val['validation_msg']) {
 | 
                                                        |
| 1494 | 1494 | $validation_msg = 'title="'.$val['validation_msg'].'"';  | 
                                                        
| 1495 | -            }else{$validation_msg='';}
 | 
                                                        |
| 1495 | +            } else {$validation_msg = ''; }
 | 
                                                        |
| 1496 | 1496 | ?>  | 
                                                        
| 1497 | 1497 | |
| 1498 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1499 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1498 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1499 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1500 | 1500 | <label>  | 
                                                        
| 1501 | 1501 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1502 | 1502 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1503 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1503 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1504 | 1504 | </label>  | 
                                                        
| 1505 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        |
| 1506 | - value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />  | 
                                                        |
| 1507 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1505 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"  | 
                                                        |
| 1506 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />  | 
                                                        |
| 1507 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1508 | 1508 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1509 | 1509 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1510 | 1510 | <?php } ?>  | 
                                                        
@@ -1515,16 +1515,16 @@ discard block  | 
                                                    ||
| 1515 | 1515 | $value = '';  | 
                                                        
| 1516 | 1516 | }?>  | 
                                                        
| 1517 | 1517 | |
| 1518 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1519 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1518 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1519 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1520 | 1520 | <label>  | 
                                                        
| 1521 | 1521 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1522 | 1522 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1523 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1523 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1524 | 1524 | </label>  | 
                                                        
| 1525 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        |
| 1526 | - value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>  | 
                                                        |
| 1527 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1525 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"  | 
                                                        |
| 1526 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>  | 
                                                        |
| 1527 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1528 | 1528 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1529 | 1529 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1530 | 1530 | <?php } ?>  | 
                                                        
@@ -1535,16 +1535,16 @@ discard block  | 
                                                    ||
| 1535 | 1535 | $value = '';  | 
                                                        
| 1536 | 1536 | } ?>  | 
                                                        
| 1537 | 1537 | |
| 1538 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1539 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1538 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1539 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1540 | 1540 | <label>  | 
                                                        
| 1541 | 1541 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1542 | 1542 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1543 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1543 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1544 | 1544 | </label>  | 
                                                        
| 1545 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        |
| 1546 | - value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>  | 
                                                        |
| 1547 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1545 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"  | 
                                                        |
| 1546 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>  | 
                                                        |
| 1547 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1548 | 1548 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1549 | 1549 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1550 | 1550 | <?php } ?>  | 
                                                        
@@ -1555,31 +1555,31 @@ discard block  | 
                                                    ||
| 1555 | 1555 | $value = '';  | 
                                                        
| 1556 | 1556 | }?>  | 
                                                        
| 1557 | 1557 | |
| 1558 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1559 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1558 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1559 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1560 | 1560 | <label>  | 
                                                        
| 1561 | 1561 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1562 | 1562 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1563 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1563 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1564 | 1564 | </label>  | 
                                                        
| 1565 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        |
| 1566 | - value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"  | 
                                                        |
| 1565 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"  | 
                                                        |
| 1566 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"  | 
                                                        |
| 1567 | 1567 |                         oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
 | 
                                                        
| 1568 | 1568 |                         onchange="try{setCustomValidity('')}catch(e){}"
 | 
                                                        
| 1569 | 1569 | />  | 
                                                        
| 1570 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1570 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1571 | 1571 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1572 | 1572 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1573 | 1573 | <?php } ?>  | 
                                                        
| 1574 | 1574 | </div>  | 
                                                        
| 1575 | 1575 | |
| 1576 | 1576 |          <?php } elseif ($type == 'radio') { ?>
 | 
                                                        
| 1577 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1578 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1577 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1578 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1579 | 1579 | <label>  | 
                                                        
| 1580 | 1580 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1581 | 1581 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1582 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1582 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1583 | 1583 | </label>  | 
                                                        
| 1584 | 1584 |                  <?php if ($option_values) {
 | 
                                                        
| 1585 | 1585 | $option_values = geodir_string_values_to_options($option_values, true);  | 
                                                        
@@ -1588,14 +1588,14 @@ discard block  | 
                                                    ||
| 1588 | 1588 |                          foreach ($option_values as $option_value) {
 | 
                                                        
| 1589 | 1589 |                              if (empty($option_value['optgroup'])) {
 | 
                                                        
| 1590 | 1590 | ?>  | 
                                                        
| 1591 | - <span class="gd-radios"><input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?></span>  | 
                                                        |
| 1591 | + <span class="gd-radios"><input name="<?php echo $name; ?>" id="<?php echo $name; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type; ?>" type="radio" /><?php echo $option_value['label']; ?></span>  | 
                                                        |
| 1592 | 1592 | <?php  | 
                                                        
| 1593 | 1593 | }  | 
                                                        
| 1594 | 1594 | }  | 
                                                        
| 1595 | 1595 | }  | 
                                                        
| 1596 | 1596 | }  | 
                                                        
| 1597 | 1597 | ?>  | 
                                                        
| 1598 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1598 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1599 | 1599 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1600 | 1600 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1601 | 1601 | <?php } ?>  | 
                                                        
@@ -1603,22 +1603,22 @@ discard block  | 
                                                    ||
| 1603 | 1603 | |
| 1604 | 1604 |          <?php } elseif ($type == 'checkbox') { ?>
 | 
                                                        
| 1605 | 1605 | |
| 1606 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1607 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1606 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1607 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1608 | 1608 | <label>  | 
                                                        
| 1609 | 1609 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1610 | 1610 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1611 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1611 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1612 | 1612 | </label>  | 
                                                        
| 1613 | 1613 |                  <?php if ($value != '1') {
 | 
                                                        
| 1614 | 1614 | $value = '0';  | 
                                                        
| 1615 | 1615 | }?>  | 
                                                        
| 1616 | - <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/>  | 
                                                        |
| 1616 | + <input type="hidden" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>"/>  | 
                                                        |
| 1617 | 1617 |                  <input  <?php if ($value == '1') {
 | 
                                                        
| 1618 | 1618 | echo 'checked="checked"';  | 
                                                        
| 1619 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"  | 
                                                        |
| 1620 | -                     onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
 | 
                                                        |
| 1621 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1619 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $type; ?>" type="checkbox"  | 
                                                        |
| 1620 | +                     onchange="if(this.checked){jQuery('#<?php echo $name; ?>').val('1');} else{ jQuery('#<?php echo $name; ?>').val('0');}"/>
 | 
                                                        |
| 1621 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1622 | 1622 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1623 | 1623 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1624 | 1624 | <?php } ?>  | 
                                                        
@@ -1627,44 +1627,44 @@ discard block  | 
                                                    ||
| 1627 | 1627 |          <?php } elseif ($type == 'textarea') {
 | 
                                                        
| 1628 | 1628 | ?>  | 
                                                        
| 1629 | 1629 | |
| 1630 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1631 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1630 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1631 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1632 | 1632 | <label>  | 
                                                        
| 1633 | 1633 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1634 | 1634 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1635 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1635 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1636 | 1636 | </label><?php  | 
                                                        
| 1637 | 1637 | |
| 1638 | 1638 | |
| 1639 | 1639 |                  if (is_array($extra_fields) && in_array('1', $extra_fields)) {
 | 
                                                        
| 1640 | 1640 | |
| 1641 | -                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
 | 
                                                        |
| 1641 | +                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
 | 
                                                        |
| 1642 | 1642 | |
| 1643 | - <div class="editor" field_id="<?php echo $name;?>" field_type="editor">  | 
                                                        |
| 1643 | + <div class="editor" field_id="<?php echo $name; ?>" field_type="editor">  | 
                                                        |
| 1644 | 1644 | <?php wp_editor(stripslashes($value), $name, $editor_settings); ?>  | 
                                                        
| 1645 | 1645 | </div><?php  | 
                                                        
| 1646 | 1646 | |
| 1647 | 1647 |                  } else {
 | 
                                                        
| 1648 | 1648 | |
| 1649 | - ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"  | 
                                                        |
| 1650 | - id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php  | 
                                                        |
| 1649 | + ?><textarea field_type="<?php echo $type; ?>" class="geodir_textarea" name="<?php echo $name; ?>"  | 
                                                        |
| 1650 | + id="<?php echo $name; ?>"><?php echo stripslashes($value); ?></textarea><?php  | 
                                                        |
| 1651 | 1651 | |
| 1652 | 1652 | }?>  | 
                                                        
| 1653 | 1653 | |
| 1654 | 1654 | |
| 1655 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1655 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1656 | 1656 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1657 | 1657 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1658 | 1658 | <?php } ?>  | 
                                                        
| 1659 | 1659 | </div>  | 
                                                        
| 1660 | 1660 | |
| 1661 | 1661 |          <?php } elseif ($type == 'select') { ?>
 | 
                                                        
| 1662 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1663 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1662 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1663 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1664 | 1664 | <label>  | 
                                                        
| 1665 | 1665 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1666 | 1666 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1667 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1667 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1668 | 1668 | </label>  | 
                                                        
| 1669 | 1669 | <?php  | 
                                                        
| 1670 | 1670 | $option_values_arr = geodir_string_values_to_options($option_values, true);  | 
                                                        
@@ -1674,22 +1674,22 @@ discard block  | 
                                                    ||
| 1674 | 1674 |                          if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
 | 
                                                        
| 1675 | 1675 | $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        
| 1676 | 1676 | |
| 1677 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';  | 
                                                        |
| 1677 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';  | 
                                                        |
| 1678 | 1678 |                          } else {
 | 
                                                        
| 1679 | 1679 | $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        
| 1680 | 1680 | $option_value = isset($option_row['value']) ? $option_row['value'] : '';  | 
                                                        
| 1681 | 1681 | $selected = $option_value == $value ? 'selected="selected"' : '';  | 
                                                        
| 1682 | 1682 | |
| 1683 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';  | 
                                                        |
| 1683 | + $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';  | 
                                                        |
| 1684 | 1684 | }  | 
                                                        
| 1685 | 1685 | }  | 
                                                        
| 1686 | 1686 | }  | 
                                                        
| 1687 | 1687 | ?>  | 
                                                        
| 1688 | - <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        |
| 1688 | + <select field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"  | 
                                                        |
| 1689 | 1689 | class="geodir_textfield textfield_x chosen_select"  | 
                                                        
| 1690 | -                        data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>"
 | 
                                                        |
| 1691 | - option-ajaxchosen="false"><?php echo $select_options;?></select>  | 
                                                        |
| 1692 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1690 | +                        data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'…'; ?>"
 | 
                                                        |
| 1691 | + option-ajaxchosen="false"><?php echo $select_options; ?></select>  | 
                                                        |
| 1692 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1693 | 1693 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1694 | 1694 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1695 | 1695 | <?php } ?>  | 
                                                        
@@ -1703,7 +1703,7 @@ discard block  | 
                                                    ||
| 1703 | 1703 | }  | 
                                                        
| 1704 | 1704 | ?>  | 
                                                        
| 1705 | 1705 | <div id="<?php echo $name; ?>_row"  | 
                                                        
| 1706 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1706 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1707 | 1707 | <label>  | 
                                                        
| 1708 | 1708 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1709 | 1709 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
@@ -1729,9 +1729,9 @@ discard block  | 
                                                    ||
| 1729 | 1729 | $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        
| 1730 | 1730 | |
| 1731 | 1731 |                                      if ($multi_display == 'select') {
 | 
                                                        
| 1732 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';  | 
                                                        |
| 1732 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';  | 
                                                        |
| 1733 | 1733 |                                      } else {
 | 
                                                        
| 1734 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';  | 
                                                        |
| 1734 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : '';  | 
                                                        |
| 1735 | 1735 | }  | 
                                                        
| 1736 | 1736 |                                  } else {
 | 
                                                        
| 1737 | 1737 | $option_label = isset($option_row['label']) ? $option_row['label'] : '';  | 
                                                        
@@ -1756,9 +1756,9 @@ discard block  | 
                                                    ||
| 1756 | 1756 | }  | 
                                                        
| 1757 | 1757 | |
| 1758 | 1758 |                                      if ($multi_display == 'select') {
 | 
                                                        
| 1759 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';  | 
                                                        |
| 1759 | + $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';  | 
                                                        |
| 1760 | 1760 |                                      } else {
 | 
                                                        
| 1761 | - $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>';  | 
                                                        |
| 1761 | + $select_options .= '<li><input name="'.$name.'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" /> '.$option_label.' </li>';  | 
                                                        |
| 1762 | 1762 | }  | 
                                                        
| 1763 | 1763 | }  | 
                                                        
| 1764 | 1764 | }  | 
                                                        
@@ -1777,7 +1777,7 @@ discard block  | 
                                                    ||
| 1777 | 1777 | ?>  | 
                                                        
| 1778 | 1778 | |
| 1779 | 1779 | <div id="<?php echo $name; ?>_row"  | 
                                                        
| 1780 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1780 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1781 | 1781 | <label>  | 
                                                        
| 1782 | 1782 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1783 | 1783 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
@@ -1802,23 +1802,23 @@ discard block  | 
                                                    ||
| 1802 | 1802 | $extra_fields['date_format'] = 'yy-mm-dd';  | 
                                                        
| 1803 | 1803 | |
| 1804 | 1804 | $date_format = $extra_fields['date_format'];  | 
                                                        
| 1805 | - $jquery_date_format = $date_format;  | 
                                                        |
| 1805 | + $jquery_date_format = $date_format;  | 
                                                        |
| 1806 | 1806 | |
| 1807 | 1807 | |
| 1808 | 1808 | // check if we need to change the format or not  | 
                                                        
| 1809 | 1809 |              $date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        
| 1810 | -            if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 1810 | +            if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
 | 
                                                        |
| 1811 | 1811 | |
| 1812 | -                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 1813 | -                $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 1812 | +                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
 | 
                                                        |
| 1813 | +                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
 | 
                                                        |
| 1814 | 1814 | |
| 1815 | 1815 | $date_format = str_replace($search, $replace, $date_format);  | 
                                                        
| 1816 | -            }else{
 | 
                                                        |
| 1817 | - $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );  | 
                                                        |
| 1816 | +            } else {
 | 
                                                        |
| 1817 | + $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format);  | 
                                                        |
| 1818 | 1818 | }  | 
                                                        
| 1819 | 1819 | |
| 1820 | -            if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
 | 
                                                        |
| 1821 | -            if($value && !isset($_REQUEST['backandedit'])) {
 | 
                                                        |
| 1820 | +            if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
 | 
                                                        |
| 1821 | +            if ($value && !isset($_REQUEST['backandedit'])) {
 | 
                                                        |
| 1822 | 1822 | $time = strtotime($value);  | 
                                                        
| 1823 | 1823 | $value = date_i18n($date_format, $time);  | 
                                                        
| 1824 | 1824 | }  | 
                                                        
@@ -1828,37 +1828,37 @@ discard block  | 
                                                    ||
| 1828 | 1828 | |
| 1829 | 1829 |                  jQuery(function () {
 | 
                                                        
| 1830 | 1830 | |
| 1831 | -                    jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
 | 
                                                        |
| 1831 | +                    jQuery("#<?php echo $name; ?>").datepicker({changeMonth: true, changeYear: true <?php
 | 
                                                        |
| 1832 | 1832 | /**  | 
                                                        
| 1833 | 1833 | * Used to add extra option to datepicker per custom field.  | 
                                                        
| 1834 | 1834 | *  | 
                                                        
| 1835 | 1835 | * @since 1.5.7  | 
                                                        
| 1836 | 1836 | * @param string $name The custom field name.  | 
                                                        
| 1837 | 1837 | */  | 
                                                        
| 1838 | -                        echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
 | 
                                                        |
| 1838 | +                        echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
 | 
                                                        |
| 1839 | 1839 | |
| 1840 | -                    jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
 | 
                                                        |
| 1840 | +                    jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>');
 | 
                                                        |
| 1841 | 1841 | |
| 1842 | -                    <?php if(!empty($value)){?>
 | 
                                                        |
| 1843 | -                    jQuery("#<?php echo $name;?>").datepicker("setDate", "<?php echo $value;?>");
 | 
                                                        |
| 1842 | +                    <?php if (!empty($value)) {?>
 | 
                                                        |
| 1843 | +                    jQuery("#<?php echo $name; ?>").datepicker("setDate", "<?php echo $value; ?>");
 | 
                                                        |
| 1844 | 1844 | <?php } ?>  | 
                                                        
| 1845 | 1845 | |
| 1846 | 1846 | });  | 
                                                        
| 1847 | 1847 | |
| 1848 | 1848 | </script>  | 
                                                        
| 1849 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1850 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1849 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1850 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1851 | 1851 | <label>  | 
                                                        
| 1852 | 1852 | |
| 1853 | 1853 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1854 | 1854 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1855 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1855 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1856 | 1856 | </label>  | 
                                                        
| 1857 | 1857 | |
| 1858 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        |
| 1859 | - value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>  | 
                                                        |
| 1858 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"  | 
                                                        |
| 1859 | + value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>  | 
                                                        |
| 1860 | 1860 | |
| 1861 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1861 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1862 | 1862 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1863 | 1863 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1864 | 1864 | <?php } ?>  | 
                                                        
@@ -1872,25 +1872,25 @@ discard block  | 
                                                    ||
| 1872 | 1872 | <script type="text/javascript">  | 
                                                        
| 1873 | 1873 |                  jQuery(document).ready(function () {
 | 
                                                        
| 1874 | 1874 | |
| 1875 | -                    jQuery('#<?php echo $name;?>').timepicker({
 | 
                                                        |
| 1875 | +                    jQuery('#<?php echo $name; ?>').timepicker({
 | 
                                                        |
| 1876 | 1876 | showPeriod: true,  | 
                                                        
| 1877 | 1877 | showLeadingZero: true,  | 
                                                        
| 1878 | 1878 | showPeriod: true,  | 
                                                        
| 1879 | 1879 | });  | 
                                                        
| 1880 | 1880 | });  | 
                                                        
| 1881 | 1881 | </script>  | 
                                                        
| 1882 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1883 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1882 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1883 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1884 | 1884 | <label>  | 
                                                        
| 1885 | 1885 | |
| 1886 | 1886 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1887 | 1887 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1888 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1888 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1889 | 1889 | </label>  | 
                                                        
| 1890 | - <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"  | 
                                                        |
| 1891 | - id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>  | 
                                                        |
| 1890 | + <input readonly="readonly" field_type="<?php echo $type; ?>" name="<?php echo $name; ?>"  | 
                                                        |
| 1891 | + id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>  | 
                                                        |
| 1892 | 1892 | |
| 1893 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 1893 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 1894 | 1894 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 1895 | 1895 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 1896 | 1896 | <?php } ?>  | 
                                                        
@@ -1900,15 +1900,15 @@ discard block  | 
                                                    ||
| 1900 | 1900 |              if ($value == $val['default']) {
 | 
                                                        
| 1901 | 1901 | $value = '';  | 
                                                        
| 1902 | 1902 | } ?>  | 
                                                        
| 1903 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 1904 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1903 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 1904 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 1905 | 1905 | <label>  | 
                                                        
| 1906 | 1906 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1907 | 1907 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1908 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1908 | + <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1909 | 1909 | </label>  | 
                                                        
| 1910 | 1910 | |
| 1911 | - <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">  | 
                                                        |
| 1911 | + <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">  | 
                                                        |
| 1912 | 1912 | <?php  | 
                                                        
| 1913 | 1913 | global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;  | 
                                                        
| 1914 | 1914 | |
@@ -1920,7 +1920,7 @@ discard block  | 
                                                    ||
| 1920 | 1920 | |
| 1921 | 1921 | $package_info = array();  | 
                                                        
| 1922 | 1922 | |
| 1923 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);  | 
                                                        |
| 1923 | + $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);  | 
                                                        |
| 1924 | 1924 | |
| 1925 | 1925 |                          if (!empty($package_info)) {
 | 
                                                        
| 1926 | 1926 | |
@@ -1949,7 +1949,7 @@ discard block  | 
                                                    ||
| 1949 | 1949 | |
| 1950 | 1950 | $catadd_limit = $wpdb->get_var(  | 
                                                        
| 1951 | 1951 | $wpdb->prepare(  | 
                                                        
| 1952 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",  | 
                                                        |
| 1952 | + "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d",  | 
                                                        |
| 1953 | 1953 | array($package_id)  | 
                                                        
| 1954 | 1954 | )  | 
                                                        
| 1955 | 1955 | );  | 
                                                        
@@ -1965,13 +1965,13 @@ discard block  | 
                                                    ||
| 1965 | 1965 | $required_limit_msg = '';  | 
                                                        
| 1966 | 1966 |                          if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
 | 
                                                        
| 1967 | 1967 | |
| 1968 | -                            $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
 | 
                                                        |
| 1968 | +                            $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
 | 
                                                        |
| 1969 | 1969 | |
| 1970 | 1970 |                          } else {
 | 
                                                        
| 1971 | 1971 | $required_limit_msg = $required_msg;  | 
                                                        
| 1972 | 1972 | }  | 
                                                        
| 1973 | 1973 | |
| 1974 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />';  | 
                                                        |
| 1974 | + echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']" />';  | 
                                                        |
| 1975 | 1975 | |
| 1976 | 1976 | |
| 1977 | 1977 |                          if ($cat_display == 'select' || $cat_display == 'multiselect') {
 | 
                                                        
@@ -1981,11 +1981,11 @@ discard block  | 
                                                    ||
| 1981 | 1981 | if ($cat_display == 'multiselect')  | 
                                                        
| 1982 | 1982 | $multiple = 'multiple="multiple"';  | 
                                                        
| 1983 | 1983 | |
| 1984 | -                            echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
 | 
                                                        |
| 1984 | +                            echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">';
 | 
                                                        |
| 1985 | 1985 | |
| 1986 | 1986 | |
| 1987 | 1987 | if ($cat_display == 'select')  | 
                                                        
| 1988 | -                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
 | 
                                                        |
| 1988 | +                                echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
 | 
                                                        |
| 1989 | 1989 | |
| 1990 | 1990 | }  | 
                                                        
| 1991 | 1991 | |
@@ -2003,7 +2003,7 @@ discard block  | 
                                                    ||
| 2003 | 2003 | ?>  | 
                                                        
| 2004 | 2004 | </div>  | 
                                                        
| 2005 | 2005 | |
| 2006 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>  | 
                                                        |
| 2006 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>  | 
                                                        |
| 2007 | 2007 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 2008 | 2008 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 2009 | 2009 | <?php } ?>  | 
                                                        
@@ -2045,8 +2045,8 @@ discard block  | 
                                                    ||
| 2045 | 2045 | $file_totImg = count($curImages);  | 
                                                        
| 2046 | 2046 | }  | 
                                                        
| 2047 | 2047 | |
| 2048 | -            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
 | 
                                                        |
| 2049 | -            $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
 | 
                                                        |
| 2048 | +            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
 | 
                                                        |
| 2049 | +            $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
 | 
                                                        |
| 2050 | 2050 | |
| 2051 | 2051 | ?>  | 
                                                        
| 2052 | 2052 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>  | 
                                                        
@@ -2056,13 +2056,13 @@ discard block  | 
                                                    ||
| 2056 | 2056 | </h5> <?php */  | 
                                                        
| 2057 | 2057 | ?>  | 
                                                        
| 2058 | 2058 | |
| 2059 | - <div id="<?php echo $name;?>_row"  | 
                                                        |
| 2060 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 2059 | + <div id="<?php echo $name; ?>_row"  | 
                                                        |
| 2060 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">  | 
                                                        |
| 2061 | 2061 | |
| 2062 | 2062 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">  | 
                                                        
| 2063 | 2063 | <label  | 
                                                        
| 2064 | 2064 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 2065 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>  | 
                                                        |
| 2065 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>  | 
                                                        |
| 2066 | 2066 | <input class="geodir-custom-file-upload" field_type="file" type="hidden"  | 
                                                        
| 2067 | 2067 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"  | 
                                                        
| 2068 | 2068 | value="<?php echo esc_attr($file_value); ?>"/>  | 
                                                        
@@ -2070,7 +2070,7 @@ discard block  | 
                                                    ||
| 2070 | 2070 | id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>  | 
                                                        
| 2071 | 2071 |                      <?php if ($allowed_file_types != '') { ?>
 | 
                                                        
| 2072 | 2072 | <input type="hidden" name="<?php echo $file_id; ?>_allowed_types"  | 
                                                        
| 2073 | - id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>  | 
                                                        |
| 2073 | + id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>  | 
                                                        |
| 2074 | 2074 | <?php } ?>  | 
                                                        
| 2075 | 2075 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"  | 
                                                        
| 2076 | 2076 |                             value="<?php if (isset($file_totImg)) {
 | 
                                                        
@@ -2086,10 +2086,10 @@ discard block  | 
                                                    ||
| 2086 | 2086 |                              <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
 | 
                                                        
| 2087 | 2087 | ?>  | 
                                                        
| 2088 | 2088 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"  | 
                                                        
| 2089 | -                                   value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
 | 
                                                        |
| 2089 | +                                   value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
 | 
                                                        |
| 2090 | 2090 | class="geodir_button" style="margin-top:10px;"/>  | 
                                                        
| 2091 | 2091 | <span class="ajaxnonceplu"  | 
                                                        
| 2092 | - id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>  | 
                                                        |
| 2092 | + id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span>  | 
                                                        |
| 2093 | 2093 | <?php if ($file_width && $file_height): ?>  | 
                                                        
| 2094 | 2094 | <span class="plupload-resize"></span>  | 
                                                        
| 2095 | 2095 | <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span>  | 
                                                        
@@ -2109,7 +2109,7 @@ discard block  | 
                                                    ||
| 2109 | 2109 | |
| 2110 | 2110 | </div>  | 
                                                        
| 2111 | 2111 | </div>  | 
                                                        
| 2112 | -                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
 | 
                                                        |
| 2112 | +                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
 | 
                                                        |
| 2113 | 2113 |                  <?php if ($is_required) { ?>
 | 
                                                        
| 2114 | 2114 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>  | 
                                                        
| 2115 | 2115 | <?php } ?>  | 
                                                        
@@ -2128,7 +2128,7 @@ discard block  | 
                                                    ||
| 2128 | 2128 |           * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
 | 
                                                        
| 2129 | 2129 | * @see 'geodir_before_custom_form_field_$name'  | 
                                                        
| 2130 | 2130 | */  | 
                                                        
| 2131 | -        do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
 | 
                                                        |
| 2131 | +        do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
 | 
                                                        |
| 2132 | 2132 | |
| 2133 | 2133 | }  | 
                                                        
| 2134 | 2134 | |
@@ -2154,7 +2154,7 @@ discard block  | 
                                                    ||
| 2154 | 2154 | |
| 2155 | 2155 | $filter = $wpdb->get_row(  | 
                                                        
| 2156 | 2156 | $wpdb->prepare(  | 
                                                        
| 2157 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'",  | 
                                                        |
| 2157 | + "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'",  | 
                                                        |
| 2158 | 2158 | array($geodir_post_type)  | 
                                                        
| 2159 | 2159 | )  | 
                                                        
| 2160 | 2160 | );  | 
                                                        
@@ -2216,7 +2216,7 @@ discard block  | 
                                                    ||
| 2216 | 2216 | |
| 2217 | 2217 | $variables_array = array();  | 
                                                        
| 2218 | 2218 | |
| 2219 | -                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
 | 
                                                        |
| 2219 | +                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int) $type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
 | 
                                                        |
| 2220 | 2220 | continue;  | 
                                                        
| 2221 | 2221 | }  | 
                                                        
| 2222 | 2222 | |
@@ -2231,9 +2231,9 @@ discard block  | 
                                                    ||
| 2231 | 2231 | //if($type['field_icon'])  | 
                                                        
| 2232 | 2232 | |
| 2233 | 2233 |                  if (strpos($type['field_icon'], 'http') !== false) {
 | 
                                                        
| 2234 | -                    $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
 | 
                                                        |
| 2234 | +                    $field_icon = ' background: url('.$type['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
 | 
                                                        |
| 2235 | 2235 |                  } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
 | 
                                                        
| 2236 | - $field_icon = '<i class="' . $type['field_icon'] . '"></i>';  | 
                                                        |
| 2236 | + $field_icon = '<i class="'.$type['field_icon'].'"></i>';  | 
                                                        |
| 2237 | 2237 | }  | 
                                                        
| 2238 | 2238 |                  //else{$field_icon = $type['field_icon'];}
 | 
                                                        
| 2239 | 2239 | |
@@ -2245,9 +2245,9 @@ discard block  | 
                                                    ||
| 2245 | 2245 | $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']);  | 
                                                        
| 2246 | 2246 | |
| 2247 | 2247 |                          if ($field_set_start == 1) {
 | 
                                                        
| 2248 | - echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';  | 
                                                        |
| 2248 | + echo '</div><div class="geodir-company_info field-group '.$type['htmlvar_name'].'"><h2 class="'.$fieldset_class.'">'.__($type['site_title'], 'geodirectory').'</h2>';  | 
                                                        |
| 2249 | 2249 |                          } else {
 | 
                                                        
| 2250 | - echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';  | 
                                                        |
| 2250 | + echo '<h2 class="'.$fieldset_class.'">'.__($type['site_title'], 'geodirectory').'</h2>';  | 
                                                        |
| 2251 | 2251 | $field_set_start = 1;  | 
                                                        
| 2252 | 2252 | }  | 
                                                        
| 2253 | 2253 | |
@@ -2255,7 +2255,7 @@ discard block  | 
                                                    ||
| 2255 | 2255 | |
| 2256 | 2256 | case 'address':  | 
                                                        
| 2257 | 2257 | |
| 2258 | - $html_var = $type['htmlvar_name'] . '_address';  | 
                                                        |
| 2258 | + $html_var = $type['htmlvar_name'].'_address';  | 
                                                        |
| 2259 | 2259 | |
| 2260 | 2260 |                          if ($type['extra_fields']) {
 | 
                                                        
| 2261 | 2261 | |
@@ -2271,17 +2271,17 @@ discard block  | 
                                                    ||
| 2271 | 2271 | */  | 
                                                        
| 2272 | 2272 |                                  $show_city_in_address = apply_filters('geodir_show_city_in_address', false);
 | 
                                                        
| 2273 | 2273 |                                  if (isset($extra_fields['show_city']) && $extra_fields['show_city'] && $show_city_in_address) {
 | 
                                                        
| 2274 | - $field = $type['htmlvar_name'] . '_city';  | 
                                                        |
| 2274 | + $field = $type['htmlvar_name'].'_city';  | 
                                                        |
| 2275 | 2275 |                                      if ($post->{$field}) {
 | 
                                                        
| 2276 | -                                        $addition_fields .= ', ' . $post->{$field};
 | 
                                                        |
| 2276 | +                                        $addition_fields .= ', '.$post->{$field};
 | 
                                                        |
| 2277 | 2277 | }  | 
                                                        
| 2278 | 2278 | }  | 
                                                        
| 2279 | 2279 | |
| 2280 | 2280 | |
| 2281 | 2281 |                                  if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
 | 
                                                        
| 2282 | - $field = $type['htmlvar_name'] . '_zip';  | 
                                                        |
| 2282 | + $field = $type['htmlvar_name'].'_zip';  | 
                                                        |
| 2283 | 2283 |                                      if ($post->{$field}) {
 | 
                                                        
| 2284 | -                                        $addition_fields .= ', ' . $post->{$field};
 | 
                                                        |
| 2284 | +                                        $addition_fields .= ', '.$post->{$field};
 | 
                                                        |
| 2285 | 2285 | }  | 
                                                        
| 2286 | 2286 | }  | 
                                                        
| 2287 | 2287 | |
@@ -2358,28 +2358,28 @@ discard block  | 
                                                    ||
| 2358 | 2358 | $i++;  | 
                                                        
| 2359 | 2359 | }  | 
                                                        
| 2360 | 2360 | |
| 2361 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;" itemscope itemtype="http://schema.org/PostalAddress">';  | 
                                                        |
| 2362 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2363 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2361 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;" itemscope itemtype="http://schema.org/PostalAddress">';  | 
                                                        |
| 2362 | + $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2363 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ' ';  | 
                                                        |
| 2364 | 2364 | $html .= '</span>';  | 
                                                        
| 2365 | 2365 | |
| 2366 | 2366 |                              if ($preview) {
 | 
                                                        
| 2367 | -                                $html .= $post->{$html_var} . $addition_fields . '</p></div>';
 | 
                                                        |
| 2367 | +                                $html .= $post->{$html_var}.$addition_fields.'</p></div>';
 | 
                                                        |
| 2368 | 2368 |                              } else {
 | 
                                                        
| 2369 | 2369 |                                  if ($post->post_address) {
 | 
                                                        
| 2370 | - $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';  | 
                                                        |
| 2370 | + $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';  | 
                                                        |
| 2371 | 2371 | }  | 
                                                        
| 2372 | 2372 |                                  if ($post->post_city) {
 | 
                                                        
| 2373 | - $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';  | 
                                                        |
| 2373 | + $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';  | 
                                                        |
| 2374 | 2374 | }  | 
                                                        
| 2375 | 2375 |                                  if ($post->post_region) {
 | 
                                                        
| 2376 | - $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';  | 
                                                        |
| 2376 | + $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';  | 
                                                        |
| 2377 | 2377 | }  | 
                                                        
| 2378 | 2378 |                                  if ($post->post_zip) {
 | 
                                                        
| 2379 | - $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';  | 
                                                        |
| 2379 | + $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';  | 
                                                        |
| 2380 | 2380 | }  | 
                                                        
| 2381 | 2381 |                                  if ($post->post_country) {
 | 
                                                        
| 2382 | - $html .= '<span itemprop="addressCountry">' . __($post->post_country, 'geodirectory') . '</span><br>';  | 
                                                        |
| 2382 | + $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>';  | 
                                                        |
| 2383 | 2383 | }  | 
                                                        
| 2384 | 2384 | $html .= '</div>';  | 
                                                        
| 2385 | 2385 | }  | 
                                                        
@@ -2419,7 +2419,7 @@ discard block  | 
                                                    ||
| 2419 | 2419 | |
| 2420 | 2420 | $website = !empty($a_url['url']) ? $a_url['url'] : '';  | 
                                                        
| 2421 | 2421 | $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];  | 
                                                        
| 2422 | -                            if(!empty($type['default_value'])){$title = $type['default_value'];}
 | 
                                                        |
| 2422 | +                            if (!empty($type['default_value'])) {$title = $type['default_value']; }
 | 
                                                        |
| 2423 | 2423 | $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';  | 
                                                        
| 2424 | 2424 | |
| 2425 | 2425 | |
@@ -2445,7 +2445,7 @@ discard block  | 
                                                    ||
| 2445 | 2445 | * @param string $website Website URL.  | 
                                                        
| 2446 | 2446 | * @param int $post->ID Post ID.  | 
                                                        
| 2447 | 2447 | */  | 
                                                        
| 2448 | -                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
 | 
                                                        |
| 2448 | +                            $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
 | 
                                                        |
| 2449 | 2449 | |
| 2450 | 2450 | endif;  | 
                                                        
| 2451 | 2451 | |
@@ -2476,9 +2476,9 @@ discard block  | 
                                                    ||
| 2476 | 2476 | $i++;  | 
                                                        
| 2477 | 2477 | }  | 
                                                        
| 2478 | 2478 | |
| 2479 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .  | 
                                                        |
| 2480 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2481 | -                            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}) . '">' . $post->{$type['htmlvar_name']} . '</a></div>';
 | 
                                                        |
| 2479 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.  | 
                                                        |
| 2480 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ' ';  | 
                                                        |
| 2481 | +                            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}).'">'.$post->{$type['htmlvar_name']}.'</a></div>';
 | 
                                                        |
| 2482 | 2482 | |
| 2483 | 2483 | endif;  | 
                                                        
| 2484 | 2484 | |
@@ -2514,9 +2514,9 @@ discard block  | 
                                                    ||
| 2514 | 2514 | $i++;  | 
                                                        
| 2515 | 2515 | }  | 
                                                        
| 2516 | 2516 | |
| 2517 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2518 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2519 | - $html .= '</span>' . $value . '</div>';  | 
                                                        |
| 2517 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2518 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ' ';  | 
                                                        |
| 2519 | + $html .= '</span>'.$value.'</div>';  | 
                                                        |
| 2520 | 2520 | |
| 2521 | 2521 | endif;  | 
                                                        
| 2522 | 2522 | |
@@ -2533,21 +2533,21 @@ discard block  | 
                                                    ||
| 2533 | 2533 | }  | 
                                                        
| 2534 | 2534 | // check if we need to change the format or not  | 
                                                        
| 2535 | 2535 |                              $date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        
| 2536 | -                            if($date_format_len>5){// if greater then 4 then it's the old style format.
 | 
                                                        |
| 2536 | +                            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
 | 
                                                        |
| 2537 | 2537 | |
| 2538 | -                                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 2539 | -                                $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 2538 | +                                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
 | 
                                                        |
| 2539 | +                                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
 | 
                                                        |
| 2540 | 2540 | |
| 2541 | 2541 | $date_format = str_replace($search, $replace, $date_format);  | 
                                                        
| 2542 | 2542 | |
| 2543 | -                                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        |
| 2544 | -                            }else{
 | 
                                                        |
| 2543 | +                                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        |
| 2544 | +                            } else {
 | 
                                                        |
| 2545 | 2545 |                                  $post_htmlvar_value = $post->{$type['htmlvar_name']};
 | 
                                                        
| 2546 | 2546 | }  | 
                                                        
| 2547 | 2547 | |
| 2548 | -                            if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
 | 
                                                        |
| 2548 | +                            if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']} != "0000-00-00") {
 | 
                                                        |
| 2549 | 2549 | $value = date_i18n($date_format, strtotime($post_htmlvar_value));  | 
                                                        
| 2550 | -                            }else{
 | 
                                                        |
| 2550 | +                            } else {
 | 
                                                        |
| 2551 | 2551 | continue;  | 
                                                        
| 2552 | 2552 | }  | 
                                                        
| 2553 | 2553 | |
@@ -2570,9 +2570,9 @@ discard block  | 
                                                    ||
| 2570 | 2570 | $i++;  | 
                                                        
| 2571 | 2571 | }  | 
                                                        
| 2572 | 2572 | |
| 2573 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2574 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2575 | - $html .= '</span>' . $value . '</div>';  | 
                                                        |
| 2573 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2574 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 2575 | + $html .= '</span>'.$value.'</div>';  | 
                                                        |
| 2576 | 2576 | |
| 2577 | 2577 | endif;  | 
                                                        
| 2578 | 2578 | |
@@ -2603,9 +2603,9 @@ discard block  | 
                                                    ||
| 2603 | 2603 | $i++;  | 
                                                        
| 2604 | 2604 | }  | 
                                                        
| 2605 | 2605 | |
| 2606 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2607 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' ';  | 
                                                        |
| 2608 | -                            $html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2606 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2607 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ' ';  | 
                                                        |
| 2608 | +                            $html .= '</span>'.$post->{$type['htmlvar_name']}.'</div>';
 | 
                                                        |
| 2609 | 2609 | |
| 2610 | 2610 |                          elseif (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']}):
 | 
                                                        
| 2611 | 2611 | |
@@ -2628,9 +2628,9 @@ discard block  | 
                                                    ||
| 2628 | 2628 | $i++;  | 
                                                        
| 2629 | 2629 | }  | 
                                                        
| 2630 | 2630 | |
| 2631 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2632 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2633 | -                            $html .= '</span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2631 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2632 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 2633 | +                            $html .= '</span>'.$post->{$type['htmlvar_name']}.'</div>';
 | 
                                                        |
| 2634 | 2634 | |
| 2635 | 2635 | endif;  | 
                                                        
| 2636 | 2636 | |
@@ -2639,7 +2639,7 @@ discard block  | 
                                                    ||
| 2639 | 2639 | case 'radio':  | 
                                                        
| 2640 | 2640 | |
| 2641 | 2641 | $html_var = $type['htmlvar_name'];  | 
                                                        
| 2642 | -                        if(!isset($post->{$type['htmlvar_name']})){continue;}
 | 
                                                        |
| 2642 | +                        if (!isset($post->{$type['htmlvar_name']})) {continue; }
 | 
                                                        |
| 2643 | 2643 |                          $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        
| 2644 | 2644 |                          if ($post->{$type['htmlvar_name']} != ''):
 | 
                                                        
| 2645 | 2645 | |
@@ -2680,9 +2680,9 @@ discard block  | 
                                                    ||
| 2680 | 2680 | $i++;  | 
                                                        
| 2681 | 2681 | }  | 
                                                        
| 2682 | 2682 | |
| 2683 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2684 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2685 | - $html .= '</span>' . $html_val . '</div>';  | 
                                                        |
| 2683 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2684 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 2685 | + $html .= '</span>'.$html_val.'</div>';  | 
                                                        |
| 2686 | 2686 | endif;  | 
                                                        
| 2687 | 2687 | |
| 2688 | 2688 | break;  | 
                                                        
@@ -2691,7 +2691,7 @@ discard block  | 
                                                    ||
| 2691 | 2691 | |
| 2692 | 2692 | $html_var = $type['htmlvar_name'];  | 
                                                        
| 2693 | 2693 | |
| 2694 | -                        if ((int)$post->{$html_var} == 1):
 | 
                                                        |
| 2694 | +                        if ((int) $post->{$html_var} == 1):
 | 
                                                        |
| 2695 | 2695 | |
| 2696 | 2696 |                              if ($post->{$type['htmlvar_name']} == '1'):
 | 
                                                        
| 2697 | 2697 |                                  $html_val = __('Yes', 'geodirectory');
 | 
                                                        
@@ -2718,9 +2718,9 @@ discard block  | 
                                                    ||
| 2718 | 2718 | $i++;  | 
                                                        
| 2719 | 2719 | }  | 
                                                        
| 2720 | 2720 | |
| 2721 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2722 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2723 | - $html .= '</span>' . $html_val . '</div>';  | 
                                                        |
| 2721 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2722 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 2723 | + $html .= '</span>'.$html_val.'</div>';  | 
                                                        |
| 2724 | 2724 | endif;  | 
                                                        
| 2725 | 2725 | |
| 2726 | 2726 | break;  | 
                                                        
@@ -2728,7 +2728,7 @@ discard block  | 
                                                    ||
| 2728 | 2728 | case 'select':  | 
                                                        
| 2729 | 2729 | |
| 2730 | 2730 | $html_var = $type['htmlvar_name'];  | 
                                                        
| 2731 | -                        if(!isset($post->{$type['htmlvar_name']})){continue;}
 | 
                                                        |
| 2731 | +                        if (!isset($post->{$type['htmlvar_name']})) {continue; }
 | 
                                                        |
| 2732 | 2732 |                          if ($post->{$type['htmlvar_name']}):
 | 
                                                        
| 2733 | 2733 |                              $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        
| 2734 | 2734 | |
@@ -2763,9 +2763,9 @@ discard block  | 
                                                    ||
| 2763 | 2763 | $i++;  | 
                                                        
| 2764 | 2764 | }  | 
                                                        
| 2765 | 2765 | |
| 2766 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2767 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2768 | - $html .= '</span>' . $field_value . '</div>';  | 
                                                        |
| 2766 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2767 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 2768 | + $html .= '</span>'.$field_value.'</div>';  | 
                                                        |
| 2769 | 2769 | endif;  | 
                                                        
| 2770 | 2770 | |
| 2771 | 2771 | break;  | 
                                                        
@@ -2815,15 +2815,15 @@ discard block  | 
                                                    ||
| 2815 | 2815 | $i++;  | 
                                                        
| 2816 | 2816 | }  | 
                                                        
| 2817 | 2817 | |
| 2818 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2819 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2818 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2819 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 2820 | 2820 | $html .= '</span>';  | 
                                                        
| 2821 | 2821 | |
| 2822 | 2822 |                              if (count($option_values) > 1) {
 | 
                                                        
| 2823 | 2823 | $html .= '<ul>';  | 
                                                        
| 2824 | 2824 | |
| 2825 | 2825 |                                  foreach ($option_values as $val) {
 | 
                                                        
| 2826 | - $html .= '<li>' . $val . '</li>';  | 
                                                        |
| 2826 | + $html .= '<li>'.$val.'</li>';  | 
                                                        |
| 2827 | 2827 | }  | 
                                                        
| 2828 | 2828 | |
| 2829 | 2829 | $html .= '</ul>';  | 
                                                        
@@ -2849,7 +2849,7 @@ discard block  | 
                                                    ||
| 2849 | 2849 |                              if (!$preview) {
 | 
                                                        
| 2850 | 2850 | $b_send_inquiry = 'b_send_inquiry';  | 
                                                        
| 2851 | 2851 | $b_sendtofriend = 'b_sendtofriend';  | 
                                                        
| 2852 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';  | 
                                                        |
| 2852 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';  | 
                                                        |
| 2853 | 2853 | }  | 
                                                        
| 2854 | 2854 | |
| 2855 | 2855 |                              if (strpos($field_icon, 'http') !== false) {
 | 
                                                        
@@ -2871,26 +2871,26 @@ discard block  | 
                                                    ||
| 2871 | 2871 | $i++;  | 
                                                        
| 2872 | 2872 | }  | 
                                                        
| 2873 | 2873 | |
| 2874 | - $html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2874 | + $html .= '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2875 | 2875 | $seperator = '';  | 
                                                        
| 2876 | 2876 |                              if ($post->{$type['htmlvar_name']}) {
 | 
                                                        
| 2877 | - $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';  | 
                                                        |
| 2877 | + $html .= '<a href="javascript:void(0);" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';  | 
                                                        |
| 2878 | 2878 | $seperator = ' | ';  | 
                                                        
| 2879 | 2879 | }  | 
                                                        
| 2880 | 2880 | |
| 2881 | 2881 |                              if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
 | 
                                                        
| 2882 | - $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';  | 
                                                        |
| 2882 | + $html .= $seperator.'<a href="javascript:void(0);" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';  | 
                                                        |
| 2883 | 2883 | }  | 
                                                        
| 2884 | 2884 | |
| 2885 | 2885 | $html .= '</span></div>';  | 
                                                        
| 2886 | 2886 | |
| 2887 | 2887 | |
| 2888 | 2888 |                              if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
 | 
                                                        
| 2889 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';  | 
                                                        |
| 2889 | + $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';  | 
                                                        |
| 2890 | 2890 |                              } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
 | 
                                                        
| 2891 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';  | 
                                                        |
| 2891 | + $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';  | 
                                                        |
| 2892 | 2892 |                              } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
 | 
                                                        
| 2893 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';  | 
                                                        |
| 2893 | + $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';  | 
                                                        |
| 2894 | 2894 | }  | 
                                                        
| 2895 | 2895 | |
| 2896 | 2896 |                              /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
 | 
                                                        
@@ -2917,11 +2917,11 @@ discard block  | 
                                                    ||
| 2917 | 2917 | $i++;  | 
                                                        
| 2918 | 2918 | }  | 
                                                        
| 2919 | 2919 | |
| 2920 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2921 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 2920 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2921 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 2922 | 2922 | $html .= '</span><span class="geodir-email-address-output">';  | 
                                                        
| 2923 | 2923 |                                  $email = $post->{$type['htmlvar_name']} ;
 | 
                                                        
| 2924 | -                                if($e_split = explode('@',$email)){
 | 
                                                        |
| 2924 | +                                if ($e_split = explode('@', $email)) {
 | 
                                                        |
| 2925 | 2925 | /**  | 
                                                        
| 2926 | 2926 | * Filter email custom field name output.  | 
                                                        
| 2927 | 2927 | *  | 
                                                        
@@ -2930,10 +2930,10 @@ discard block  | 
                                                    ||
| 2930 | 2930 | * @param string $email The email string being output.  | 
                                                        
| 2931 | 2931 | * @param array $type Custom field variables array.  | 
                                                        
| 2932 | 2932 | */  | 
                                                        
| 2933 | -                                    $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
 | 
                                                        |
| 2934 | -                                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
 | 
                                                        |
| 2935 | -                                }else{
 | 
                                                        |
| 2936 | - $html .= $email;  | 
                                                        |
| 2933 | +                                    $email_name = apply_filters('geodir_email_field_name_output', $email, $type);
 | 
                                                        |
| 2934 | +                                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
 | 
                                                        |
| 2935 | +                                } else {
 | 
                                                        |
| 2936 | + $html .= $email;  | 
                                                        |
| 2937 | 2937 | }  | 
                                                        
| 2938 | 2938 | $html .= '</span></div>';  | 
                                                        
| 2939 | 2939 | }  | 
                                                        
@@ -2953,7 +2953,7 @@ discard block  | 
                                                    ||
| 2953 | 2953 | if (!empty($files)):  | 
                                                        
| 2954 | 2954 | |
| 2955 | 2955 | $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;  | 
                                                        
| 2956 | -                                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 2956 | +                                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 2957 | 2957 | |
| 2958 | 2958 | $file_paths = '';  | 
                                                        
| 2959 | 2959 |                                  foreach ($files as $file) {
 | 
                                                        
@@ -2990,9 +2990,9 @@ discard block  | 
                                                    ||
| 2990 | 2990 | //$file_paths .= '<img src="'.$file.'" />';  | 
                                                        
| 2991 | 2991 | $file_paths .= '</div>';  | 
                                                        
| 2992 | 2992 |                                          } else {
 | 
                                                        
| 2993 | - $ext_path = '_' . $html_var . '_';  | 
                                                        |
| 2993 | + $ext_path = '_'.$html_var.'_';  | 
                                                        |
| 2994 | 2994 | $filename = explode($ext_path, $filename);  | 
                                                        
| 2995 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';  | 
                                                        |
| 2995 | + $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';  | 
                                                        |
| 2996 | 2996 | }  | 
                                                        
| 2997 | 2997 | }  | 
                                                        
| 2998 | 2998 | }  | 
                                                        
@@ -3016,11 +3016,11 @@ discard block  | 
                                                    ||
| 3016 | 3016 | $i++;  | 
                                                        
| 3017 | 3017 | }  | 
                                                        
| 3018 | 3018 | |
| 3019 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' geodir-custom-file-box ' . $type['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3019 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' geodir-custom-file-box '.$type['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 3020 | 3020 | $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';  | 
                                                        
| 3021 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3021 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 3022 | 3022 | $html .= '</span>';  | 
                                                        
| 3023 | - $html .= $file_paths . '</div></div>';  | 
                                                        |
| 3023 | + $html .= $file_paths.'</div></div>';  | 
                                                        |
| 3024 | 3024 | |
| 3025 | 3025 | endif;  | 
                                                        
| 3026 | 3026 | endif;  | 
                                                        
@@ -3051,9 +3051,9 @@ discard block  | 
                                                    ||
| 3051 | 3051 | $i++;  | 
                                                        
| 3052 | 3052 | }  | 
                                                        
| 3053 | 3053 | |
| 3054 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3055 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3056 | -                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 3054 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 3055 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 3056 | +                            $html .= '</span>'.wpautop($post->{$type['htmlvar_name']}).'</div>';
 | 
                                                        |
| 3057 | 3057 | |
| 3058 | 3058 | }  | 
                                                        
| 3059 | 3059 | break;  | 
                                                        
@@ -3080,16 +3080,16 @@ discard block  | 
                                                    ||
| 3080 | 3080 | $i++;  | 
                                                        
| 3081 | 3081 | }  | 
                                                        
| 3082 | 3082 | |
| 3083 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3084 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3085 | -                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 3083 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 3084 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 3085 | +                            $html .= '</span>'.wpautop($post->{$type['htmlvar_name']}).'</div>';
 | 
                                                        |
| 3086 | 3086 | |
| 3087 | 3087 | }  | 
                                                        
| 3088 | 3088 | break;  | 
                                                        
| 3089 | 3089 |                      case 'taxonomy': {
 | 
                                                        
| 3090 | 3090 | $html_var = $type['htmlvar_name'];  | 
                                                        
| 3091 | -                        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
 | 
                                                        |
| 3092 | - $post_taxonomy = $post->post_type . 'category';  | 
                                                        |
| 3091 | +                        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
 | 
                                                        |
| 3092 | + $post_taxonomy = $post->post_type.'category';  | 
                                                        |
| 3093 | 3093 |                              $field_value = $post->{$html_var};
 | 
                                                        
| 3094 | 3094 | $links = array();  | 
                                                        
| 3095 | 3095 | $terms = array();  | 
                                                        
@@ -3107,7 +3107,7 @@ discard block  | 
                                                    ||
| 3107 | 3107 |                                      if ($term != '') {
 | 
                                                        
| 3108 | 3108 |                                          $term = get_term_by('id', $term, $html_var);
 | 
                                                        
| 3109 | 3109 |                                          if (is_object($term)) {
 | 
                                                        
| 3110 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";  | 
                                                        |
| 3110 | + $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";  | 
                                                        |
| 3111 | 3111 | $terms[] = $term;  | 
                                                        
| 3112 | 3112 | }  | 
                                                        
| 3113 | 3113 | }  | 
                                                        
@@ -3121,7 +3121,7 @@ discard block  | 
                                                    ||
| 3121 | 3121 | $terms = $termsOrdered;  | 
                                                        
| 3122 | 3122 | }  | 
                                                        
| 3123 | 3123 | }  | 
                                                        
| 3124 | -                            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
 | 
                                                        |
| 3124 | +                            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
 | 
                                                        |
| 3125 | 3125 | |
| 3126 | 3126 |                              if ($html_value != '') {
 | 
                                                        
| 3127 | 3127 |                                  if (strpos($field_icon, 'http') !== false) {
 | 
                                                        
@@ -3142,9 +3142,9 @@ discard block  | 
                                                    ||
| 3142 | 3142 | $i++;  | 
                                                        
| 3143 | 3143 | }  | 
                                                        
| 3144 | 3144 | |
| 3145 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 3146 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';  | 
                                                        |
| 3147 | - $html .= '</span> ' . $html_value . '</div>';  | 
                                                        |
| 3145 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 3146 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : '';  | 
                                                        |
| 3147 | + $html .= '</span> '.$html_value.'</div>';  | 
                                                        |
| 3148 | 3148 | }  | 
                                                        
| 3149 | 3149 | }  | 
                                                        
| 3150 | 3150 | }  | 
                                                        
@@ -3264,7 +3264,7 @@ discard block  | 
                                                    ||
| 3264 | 3264 | |
| 3265 | 3265 | $post_type = get_post_type($post_id);  | 
                                                        
| 3266 | 3266 | //echo $field_id; exit;  | 
                                                        
| 3267 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3267 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 3268 | 3268 | |
| 3269 | 3269 | $postcurr_images = array();  | 
                                                        
| 3270 | 3270 | $postcurr_images = geodir_get_post_meta($post_id, $field_id, true);  | 
                                                        
@@ -3283,13 +3283,13 @@ discard block  | 
                                                    ||
| 3283 | 3283 | $geodir_uploadurl = $uploads['url'];  | 
                                                        
| 3284 | 3284 | $sub_dir = $uploads['subdir'];  | 
                                                        
| 3285 | 3285 | |
| 3286 | -            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 3286 | +            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 3287 | 3287 | |
| 3288 | 3288 |              for ($m = 0; $m < count($post_image); $m++) {
 | 
                                                        
| 3289 | 3289 | |
| 3290 | 3290 | /* --------- start ------- */  | 
                                                        
| 3291 | 3291 | |
| 3292 | -                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
 | 
                                                        |
| 3292 | +                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM ".$table." WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
 | 
                                                        |
| 3293 | 3293 | |
| 3294 | 3294 | |
| 3295 | 3295 | $curr_img_url = $post_image[$m];  | 
                                                        
@@ -3315,24 +3315,24 @@ discard block  | 
                                                    ||
| 3315 | 3315 |                      //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
 | 
                                                        
| 3316 | 3316 | |
| 3317 | 3317 |                      if (!function_exists('wp_handle_upload'))
 | 
                                                        
| 3318 | - require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 3318 | + require_once(ABSPATH.'wp-admin/includes/file.php');  | 
                                                        |
| 3319 | 3319 | |
| 3320 | 3320 | if (!is_dir($geodir_uploadpath))  | 
                                                        
| 3321 | 3321 | mkdir($geodir_uploadpath);  | 
                                                        
| 3322 | 3322 | |
| 3323 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];  | 
                                                        |
| 3323 | + $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1];  | 
                                                        |
| 3324 | 3324 |                      $explode_sub_dir = explode("/", $sub_dir);
 | 
                                                        
| 3325 | 3325 |                      if ($curr_img_dir == end($explode_sub_dir)) {
 | 
                                                        
| 3326 | - $img_path = $geodir_uploadpath . '/' . $filename;  | 
                                                        |
| 3327 | - $img_url = $geodir_uploadurl . '/' . $filename;  | 
                                                        |
| 3326 | + $img_path = $geodir_uploadpath.'/'.$filename;  | 
                                                        |
| 3327 | + $img_url = $geodir_uploadurl.'/'.$filename;  | 
                                                        |
| 3328 | 3328 |                      } else {
 | 
                                                        
| 3329 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 3330 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 3329 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;  | 
                                                        |
| 3330 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;  | 
                                                        |
| 3331 | 3331 | }  | 
                                                        
| 3332 | 3332 | |
| 3333 | 3333 | $uploaded_file = '';  | 
                                                        
| 3334 | 3334 | if (file_exists($img_path))  | 
                                                        
| 3335 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);  | 
                                                        |
| 3335 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);  | 
                                                        |
| 3336 | 3336 | |
| 3337 | 3337 |                      if ($curr_img_dir != $geodir_uploaddir) {
 | 
                                                        
| 3338 | 3338 | if (file_exists($img_path))  | 
                                                        
@@ -3340,7 +3340,7 @@ discard block  | 
                                                    ||
| 3340 | 3340 | }  | 
                                                        
| 3341 | 3341 | |
| 3342 | 3342 | if (!empty($uploaded_file))  | 
                                                        
| 3343 | - $file_urls = $geodir_uploadurl . '/' . $new_name;  | 
                                                        |
| 3343 | + $file_urls = $geodir_uploadurl.'/'.$new_name;  | 
                                                        |
| 3344 | 3344 | |
| 3345 | 3345 |                  } else {
 | 
                                                        
| 3346 | 3346 | $file_urls = $post_image[$m];  | 
                                                        
@@ -3354,8 +3354,8 @@ discard block  | 
                                                    ||
| 3354 | 3354 |          if (!empty($postcurr_images)) {
 | 
                                                        
| 3355 | 3355 | |
| 3356 | 3356 |              if ($file_urls != $postcurr_images) {
 | 
                                                        
| 3357 | -                $invalid_files[] = (object)array('src' => $postcurr_images);
 | 
                                                        |
| 3358 | - $invalid_files = (object)$invalid_files;  | 
                                                        |
| 3357 | +                $invalid_files[] = (object) array('src' => $postcurr_images);
 | 
                                                        |
| 3358 | + $invalid_files = (object) $invalid_files;  | 
                                                        |
| 3359 | 3359 | }  | 
                                                        
| 3360 | 3360 | }  | 
                                                        
| 3361 | 3361 | |
@@ -3407,9 +3407,9 @@ discard block  | 
                                                    ||
| 3407 | 3407 | function geodir_upload_dir($upload)  | 
                                                        
| 3408 | 3408 |      {
 | 
                                                        
| 3409 | 3409 | global $current_user;  | 
                                                        
| 3410 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;  | 
                                                        |
| 3411 | - $upload['path'] = $upload['basedir'] . $upload['subdir'];  | 
                                                        |
| 3412 | - $upload['url'] = $upload['baseurl'] . $upload['subdir'];  | 
                                                        |
| 3410 | + $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID;  | 
                                                        |
| 3411 | + $upload['path'] = $upload['basedir'].$upload['subdir'];  | 
                                                        |
| 3412 | + $upload['url'] = $upload['baseurl'].$upload['subdir'];  | 
                                                        |
| 3413 | 3413 | return $upload;  | 
                                                        
| 3414 | 3414 | }  | 
                                                        
| 3415 | 3415 | |
@@ -3424,20 +3424,20 @@ discard block  | 
                                                    ||
| 3424 | 3424 | // check ajax noonce  | 
                                                        
| 3425 | 3425 | $imgid = $_POST["imgid"];  | 
                                                        
| 3426 | 3426 | |
| 3427 | - check_ajax_referer($imgid . 'pluploadan');  | 
                                                        |
| 3427 | + check_ajax_referer($imgid.'pluploadan');  | 
                                                        |
| 3428 | 3428 | |
| 3429 | 3429 | // handle custom file uploaddir  | 
                                                        
| 3430 | 3430 |          add_filter('upload_dir', 'geodir_upload_dir');
 | 
                                                        
| 3431 | 3431 | |
| 3432 | 3432 | // change file orinetation if needed  | 
                                                        
| 3433 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']);  | 
                                                        |
| 3433 | + $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']);  | 
                                                        |
| 3434 | 3434 | |
| 3435 | 3435 | // handle file upload  | 
                                                        
| 3436 | 3436 |          $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
 | 
                                                        
| 3437 | 3437 | // remove handle custom file uploaddir  | 
                                                        
| 3438 | 3438 |          remove_filter('upload_dir', 'geodir_upload_dir');
 | 
                                                        
| 3439 | 3439 | |
| 3440 | -        if(!isset($status['url']) && isset($status['error'])){
 | 
                                                        |
| 3440 | +        if (!isset($status['url']) && isset($status['error'])) {
 | 
                                                        |
| 3441 | 3441 | print_r($status);  | 
                                                        
| 3442 | 3442 | }  | 
                                                        
| 3443 | 3443 | |
@@ -3467,9 +3467,9 @@ discard block  | 
                                                    ||
| 3467 | 3467 | |
| 3468 | 3468 | $post_type = get_post_type($post_id);  | 
                                                        
| 3469 | 3469 | |
| 3470 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3470 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 3471 | 3471 | |
| 3472 | -    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
 | 
                                                        |
| 3472 | +    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
 | 
                                                        |
| 3473 | 3473 | |
| 3474 | 3474 |      if ($results) {
 | 
                                                        
| 3475 | 3475 | return $results[0]->geodir_video;  | 
                                                        
@@ -3493,9 +3493,9 @@ discard block  | 
                                                    ||
| 3493 | 3493 | |
| 3494 | 3494 | $post_type = get_post_type($post_id);  | 
                                                        
| 3495 | 3495 | |
| 3496 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 3496 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 3497 | 3497 | |
| 3498 | -    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
 | 
                                                        |
| 3498 | +    $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
 | 
                                                        |
| 3499 | 3499 | |
| 3500 | 3500 |      if ($results) {
 | 
                                                        
| 3501 | 3501 | return $results[0]->geodir_special_offers;  | 
                                                        
@@ -3513,12 +3513,12 @@ discard block  | 
                                                    ||
| 3513 | 3513 | */  | 
                                                        
| 3514 | 3514 | function geodir_max_upload_size()  | 
                                                        
| 3515 | 3515 |      {
 | 
                                                        
| 3516 | -        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
 | 
                                                        |
| 3516 | +        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
 | 
                                                        |
| 3517 | 3517 | |
| 3518 | 3518 |          if ($max_filesize > 0 && $max_filesize < 1) {
 | 
                                                        
| 3519 | - $max_filesize = (int)($max_filesize * 1024) . 'kb';  | 
                                                        |
| 3519 | + $max_filesize = (int) ($max_filesize * 1024).'kb';  | 
                                                        |
| 3520 | 3520 |          } else {
 | 
                                                        
| 3521 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';  | 
                                                        |
| 3521 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb';  | 
                                                        |
| 3522 | 3522 | }  | 
                                                        
| 3523 | 3523 | /** Filter documented in geodirectory-functions/general_functions.php **/  | 
                                                        
| 3524 | 3524 |          return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
 | 
                                                        
@@ -3550,7 +3550,7 @@ discard block  | 
                                                    ||
| 3550 | 3550 | |
| 3551 | 3551 | $custom_fields = $wpdb->get_results(  | 
                                                        
| 3552 | 3552 | $wpdb->prepare(  | 
                                                        
| 3553 | - "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",  | 
                                                        |
| 3553 | + "select post_type,data_type,field_type,site_title,htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc",  | 
                                                        |
| 3554 | 3554 | array($post_type)  | 
                                                        
| 3555 | 3555 | ), 'ARRAY_A'  | 
                                                        
| 3556 | 3556 | );  | 
                                                        
@@ -3667,7 +3667,7 @@ discard block  | 
                                                    ||
| 3667 | 3667 | |
| 3668 | 3668 | $post_meta_info = $wpdb->query(  | 
                                                        
| 3669 | 3669 | $wpdb->prepare(  | 
                                                        
| 3670 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3670 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set  | 
                                                        |
| 3671 | 3671 | sort_order=%d  | 
                                                        
| 3672 | 3672 | where id= %d",  | 
                                                        
| 3673 | 3673 | array($count, $cf)  | 
                                                        
@@ -3749,14 +3749,14 @@ discard block  | 
                                                    ||
| 3749 | 3749 | |
| 3750 | 3750 | $check_html_variable = $wpdb->get_var(  | 
                                                        
| 3751 | 3751 | $wpdb->prepare(  | 
                                                        
| 3752 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ",  | 
                                                        |
| 3752 | + "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ",  | 
                                                        |
| 3753 | 3753 | array($cehhtmlvar_name, $post_type, $field_type)  | 
                                                        
| 3754 | 3754 | )  | 
                                                        
| 3755 | 3755 | );  | 
                                                        
| 3756 | 3756 | |
| 3757 | 3757 |          if ($is_default == 1) {
 | 
                                                        
| 3758 | 3758 | |
| 3759 | -            $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
 | 
                                                        |
| 3759 | +            $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
 | 
                                                        |
| 3760 | 3760 | |
| 3761 | 3761 | }  | 
                                                        
| 3762 | 3762 | |
@@ -3767,7 +3767,7 @@ discard block  | 
                                                    ||
| 3767 | 3767 | |
| 3768 | 3768 | $wpdb->prepare(  | 
                                                        
| 3769 | 3769 | |
| 3770 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3770 | + "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set  | 
                                                        |
| 3771 | 3771 | post_type = %s,  | 
                                                        
| 3772 | 3772 | data_type = %s,  | 
                                                        
| 3773 | 3773 | field_type = %s,  | 
                                                        
@@ -3798,7 +3798,7 @@ discard block  | 
                                                    ||
| 3798 | 3798 | |
| 3799 | 3799 | $wpdb->prepare(  | 
                                                        
| 3800 | 3800 | |
| 3801 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set  | 
                                                        |
| 3801 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set  | 
                                                        |
| 3802 | 3802 | post_type = %s,  | 
                                                        
| 3803 | 3803 | data_type = %s,  | 
                                                        
| 3804 | 3804 | field_type = %s,  | 
                                                        
@@ -3824,7 +3824,7 @@ discard block  | 
                                                    ||
| 3824 | 3824 | }  | 
                                                        
| 3825 | 3825 | |
| 3826 | 3826 | |
| 3827 | - return (int)$lastid;  | 
                                                        |
| 3827 | + return (int) $lastid;  | 
                                                        |
| 3828 | 3828 | |
| 3829 | 3829 | }  | 
                                                        
| 3830 | 3830 | }  | 
                                                        
@@ -3847,7 +3847,7 @@ discard block  | 
                                                    ||
| 3847 | 3847 |          if ($field_id != '') {
 | 
                                                        
| 3848 | 3848 | $cf = trim($field_id, '_');  | 
                                                        
| 3849 | 3849 | |
| 3850 | -            $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
 | 
                                                        |
| 3850 | +            $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
 | 
                                                        |
| 3851 | 3851 | |
| 3852 | 3852 | return $field_id;  | 
                                                        
| 3853 | 3853 | |
@@ -3875,7 +3875,7 @@ discard block  | 
                                                    ||
| 3875 | 3875 | global $wpdb;  | 
                                                        
| 3876 | 3876 | $cf = $result_str;  | 
                                                        
| 3877 | 3877 |          if (!is_object($cf)) {
 | 
                                                        
| 3878 | -            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
 | 
                                                        |
| 3878 | +            $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
 | 
                                                        |
| 3879 | 3879 |          } else {
 | 
                                                        
| 3880 | 3880 | $field_info = $cf;  | 
                                                        
| 3881 | 3881 | $result_str = $cf->id;  | 
                                                        
@@ -3912,41 +3912,41 @@ discard block  | 
                                                    ||
| 3912 | 3912 | if ($htmlvar_name == '')  | 
                                                        
| 3913 | 3913 | $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';  | 
                                                        
| 3914 | 3914 | |
| 3915 | -        $nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 3915 | +        $nonce = wp_create_nonce('custom_fields_'.$result_str);
 | 
                                                        |
| 3916 | 3916 | |
| 3917 | 3917 | ?>  | 
                                                        
| 3918 | - <li class="text" id="licontainer_<?php echo $result_str;?>">  | 
                                                        |
| 3919 | - <div class="title title<?php echo $result_str;?> gt-fieldset"  | 
                                                        |
| 3920 | -                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
 | 
                                                        |
| 3921 | -                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
 | 
                                                        |
| 3918 | + <li class="text" id="licontainer_<?php echo $result_str; ?>">  | 
                                                        |
| 3919 | + <div class="title title<?php echo $result_str; ?> gt-fieldset"  | 
                                                        |
| 3920 | +                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
 | 
                                                        |
| 3921 | +                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
 | 
                                                        |
| 3922 | 3922 | <?php  | 
                                                        
| 3923 | 3923 | |
| 3924 | -                $nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 3924 | +                $nonce = wp_create_nonce('custom_fields_'.$result_str);
 | 
                                                        |
| 3925 | 3925 | ?>  | 
                                                        
| 3926 | 3926 | |
| 3927 | -                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
 | 
                                                        |
| 3928 | -                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
 | 
                                                        |
| 3927 | +                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
 | 
                                                        |
| 3928 | +                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
 | 
                                                        |
| 3929 | 3929 | class="handlediv close"></div>  | 
                                                        
| 3930 | 3930 | |
| 3931 | 3931 | <b style="cursor:pointer;"  | 
                                                        
| 3932 | -                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
 | 
                                                        |
| 3932 | +                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
 | 
                                                        |
| 3933 | 3933 | |
| 3934 | 3934 | </div>  | 
                                                        
| 3935 | 3935 | |
| 3936 | - <div id="field_frm<?php echo $result_str;?>" class="field_frm"  | 
                                                        |
| 3936 | + <div id="field_frm<?php echo $result_str; ?>" class="field_frm"  | 
                                                        |
| 3937 | 3937 |                   style="display:<?php if ($field_ins_upd == 'submit') {
 | 
                                                        
| 3938 | 3938 | echo 'block;';  | 
                                                        
| 3939 | 3939 |                   } else {
 | 
                                                        
| 3940 | 3940 | echo 'none;';  | 
                                                        
| 3941 | 3941 | } ?>">  | 
                                                        
| 3942 | 3942 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>  | 
                                                        
| 3943 | - <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>  | 
                                                        |
| 3944 | - <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>  | 
                                                        |
| 3945 | - <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>  | 
                                                        |
| 3943 | + <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>  | 
                                                        |
| 3944 | + <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>  | 
                                                        |
| 3945 | + <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>  | 
                                                        |
| 3946 | 3946 |                  <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
 | 
                                                        
| 3947 | 3947 | echo $field_info->data_type;  | 
                                                        
| 3948 | 3948 | }?>"/>  | 
                                                        
| 3949 | - <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>  | 
                                                        |
| 3949 | + <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>  | 
                                                        |
| 3950 | 3950 | |
| 3951 | 3951 | |
| 3952 | 3952 | <table class="widefat post fixed" border="0" style="width:100%;">  | 
                                                        
@@ -3970,7 +3970,7 @@ discard block  | 
                                                    ||
| 3970 | 3970 | } ?>" style="width:45%;"/>  | 
                                                        
| 3971 | 3971 | |
| 3972 | 3972 | <input type="radio" name="is_default"  | 
                                                        
| 3973 | -                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
 | 
                                                        |
| 3973 | +                                       value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
 | 
                                                        |
| 3974 | 3974 | echo 'checked="checked"';  | 
                                                        
| 3975 | 3975 |                                  } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
 | 
                                                        
| 3976 | 3976 | |
@@ -3993,7 +3993,7 @@ discard block  | 
                                                    ||
| 3993 | 3993 | echo esc_attr($field_info->desc_title);  | 
                                                        
| 3994 | 3994 | } ?>" style="width:45%;"/>  | 
                                                        
| 3995 | 3995 | <input type="radio" name="is_default"  | 
                                                        
| 3996 | -                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
 | 
                                                        |
| 3996 | +                                       value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
 | 
                                                        |
| 3997 | 3997 | echo 'checked="checked"';  | 
                                                        
| 3998 | 3998 |                                  } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
 | 
                                                        
| 3999 | 3999 | <br/>  | 
                                                        
@@ -4028,42 +4028,42 @@ discard block  | 
                                                    ||
| 4028 | 4028 | <?php } ?>  | 
                                                        
| 4029 | 4029 | |
| 4030 | 4030 | <tr>  | 
                                                        
| 4031 | -                        <td><strong><?php _e('Is active :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 4031 | +                        <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 4032 | 4032 | <td align="left">  | 
                                                        
| 4033 | 4033 | <select name="is_active" id="is_active">  | 
                                                        
| 4034 | 4034 | <option  | 
                                                        
| 4035 | 4035 |                                      value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
 | 
                                                        
| 4036 | 4036 | echo 'selected="selected"';  | 
                                                        
| 4037 | -                                }?>><?php _e('Yes', 'geodirectory');?></option>
 | 
                                                        |
| 4037 | +                                }?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 4038 | 4038 | <option  | 
                                                        
| 4039 | 4039 |                                      value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
 | 
                                                        
| 4040 | 4040 | echo 'selected="selected"';  | 
                                                        
| 4041 | -                                }?>><?php _e('No', 'geodirectory');?></option>
 | 
                                                        |
| 4041 | +                                }?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 4042 | 4042 | </select>  | 
                                                        
| 4043 | 4043 | <br/>  | 
                                                        
| 4044 | -                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
 | 
                                                        |
| 4044 | +                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory'); ?></span>
 | 
                                                        |
| 4045 | 4045 | </td>  | 
                                                        
| 4046 | 4046 | </tr>  | 
                                                        
| 4047 | 4047 | |
| 4048 | 4048 | <tr>  | 
                                                        
| 4049 | -                        <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 4049 | +                        <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 4050 | 4050 | <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"  | 
                                                        
| 4051 | 4051 |                                                  value="<?php if (isset($field_info->sort_order)) {
 | 
                                                        
| 4052 | 4052 | echo esc_attr($field_info->sort_order);  | 
                                                        
| 4053 | 4053 | }?>" size="50"/>  | 
                                                        
| 4054 | 4054 | <br/>  | 
                                                        
| 4055 | -                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
 | 
                                                        |
| 4055 | +                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
 | 
                                                        |
| 4056 | 4056 | </td>  | 
                                                        
| 4057 | 4057 | </tr>  | 
                                                        
| 4058 | 4058 | |
| 4059 | 4059 | <tr>  | 
                                                        
| 4060 | 4060 | <td> </td>  | 
                                                        
| 4061 | 4061 | <td align="left">  | 
                                                        
| 4062 | -                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory');?>"
 | 
                                                        |
| 4063 | -                                   onclick="save_sort_field('<?php echo $result_str;?>')"/>
 | 
                                                        |
| 4062 | +                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory'); ?>"
 | 
                                                        |
| 4063 | +                                   onclick="save_sort_field('<?php echo $result_str; ?>')"/>
 | 
                                                        |
| 4064 | 4064 | |
| 4065 | -                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory');?>"
 | 
                                                        |
| 4066 | -                                                                onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
 | 
                                                        |
| 4065 | +                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory'); ?>"
 | 
                                                        |
| 4066 | +                                                                onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
 | 
                                                        |
| 4067 | 4067 | class="button_n"/></a>  | 
                                                        
| 4068 | 4068 | |
| 4069 | 4069 | </td>  | 
                                                        
@@ -4098,7 +4098,7 @@ discard block  | 
                                                    ||
| 4098 | 4098 |          if (!$package_id || !$field_name || !$post_type) {
 | 
                                                        
| 4099 | 4099 | return true;  | 
                                                        
| 4100 | 4100 | }  | 
                                                        
| 4101 | -        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
 | 
                                                        |
| 4101 | +        $sql = $wpdb->prepare("SELECT id FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
 | 
                                                        |
| 4102 | 4102 | |
| 4103 | 4103 |          if ($wpdb->get_var($sql)) {
 | 
                                                        
| 4104 | 4104 | return true;  | 
                                                        
@@ -51,8 +51,9 @@ discard block  | 
                                                    ||
| 51 | 51 | global $wpdb;  | 
                                                        
| 52 | 52 | $result = 0;// no rows affected  | 
                                                        
| 53 | 53 |          if (!geodir_column_exist($db, $column)) {
 | 
                                                        
| 54 | - if (!empty($db) && !empty($column))  | 
                                                        |
| 55 | -                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
 | 
                                                        |
| 54 | +            if (!empty($db) && !empty($column)) { | 
                                                        |
| 55 | +                            $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr"); | 
                                                        |
| 56 | + }  | 
                                                        |
| 56 | 57 | }  | 
                                                        
| 57 | 58 | return $result;  | 
                                                        
| 58 | 59 | }  | 
                                                        
@@ -82,10 +83,11 @@ discard block  | 
                                                    ||
| 82 | 83 | |
| 83 | 84 | $default_query = '';  | 
                                                        
| 84 | 85 | |
| 85 | - if ($default == 'default')  | 
                                                        |
| 86 | -        $default_query = " and is_default IN ('1') ";
 | 
                                                        |
| 87 | - elseif ($default == 'custom')  | 
                                                        |
| 88 | - $default_query = " and is_default = '0' ";  | 
                                                        |
| 86 | +    if ($default == 'default') { | 
                                                        |
| 87 | +            $default_query = " and is_default IN ('1') "; | 
                                                        |
| 88 | +    } elseif ($default == 'custom') { | 
                                                        |
| 89 | + $default_query = " and is_default = '0' ";  | 
                                                        |
| 90 | + }  | 
                                                        |
| 89 | 91 | |
| 90 | 92 |      if ($fields_location == 'detail') {
 | 
                                                        
| 91 | 93 | $default_query = " and show_on_detail='1' ";  | 
                                                        
@@ -240,10 +242,12 @@ discard block  | 
                                                    ||
| 240 | 242 | }  | 
                                                        
| 241 | 243 | |
| 242 | 244 | return $field_id;  | 
                                                        
| 243 | - } else  | 
                                                        |
| 244 | - return 0;  | 
                                                        |
| 245 | - } else  | 
                                                        |
| 246 | - return 0;  | 
                                                        |
| 245 | +            } else { | 
                                                        |
| 246 | + return 0;  | 
                                                        |
| 247 | + }  | 
                                                        |
| 248 | +        } else { | 
                                                        |
| 249 | + return 0;  | 
                                                        |
| 250 | + }  | 
                                                        |
| 247 | 251 | }  | 
                                                        
| 248 | 252 | }  | 
                                                        
| 249 | 253 | |
@@ -349,7 +353,9 @@ discard block  | 
                                                    ||
| 349 | 353 | |
| 350 | 354 | |
| 351 | 355 | |
| 352 | - if ($post_type == '') $post_type = 'gd_place';  | 
                                                        |
| 356 | +            if ($post_type == '') { | 
                                                        |
| 357 | + $post_type = 'gd_place';  | 
                                                        |
| 358 | + }  | 
                                                        |
| 353 | 359 | |
| 354 | 360 | |
| 355 | 361 | $detail_table = $plugin_prefix . $post_type . '_detail';  | 
                                                        
@@ -382,20 +388,23 @@ discard block  | 
                                                    ||
| 382 | 388 | }  | 
                                                        
| 383 | 389 | |
| 384 | 390 | $option_values = '';  | 
                                                        
| 385 | - if (isset($request_field['option_values']))  | 
                                                        |
| 386 | - $option_values = $request_field['option_values'];  | 
                                                        |
| 391 | +            if (isset($request_field['option_values'])) { | 
                                                        |
| 392 | + $option_values = $request_field['option_values'];  | 
                                                        |
| 393 | + }  | 
                                                        |
| 387 | 394 | |
| 388 | 395 | $cat_sort = '';  | 
                                                        
| 389 | - if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort']))  | 
                                                        |
| 390 | -                $cat_sort = implode(",", $request_field['cat_sort']);
 | 
                                                        |
| 396 | +            if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) { | 
                                                        |
| 397 | +                            $cat_sort = implode(",", $request_field['cat_sort']); | 
                                                        |
| 398 | + }  | 
                                                        |
| 391 | 399 | |
| 392 | 400 | $cat_filter = '';  | 
                                                        
| 393 | - if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter']))  | 
                                                        |
| 394 | -                $cat_filter = implode(",", $request_field['cat_filter']);
 | 
                                                        |
| 401 | +            if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) { | 
                                                        |
| 402 | +                            $cat_filter = implode(",", $request_field['cat_filter']); | 
                                                        |
| 403 | + }  | 
                                                        |
| 395 | 404 | |
| 396 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))  | 
                                                        |
| 397 | -                $price_pkg = implode(",", $request_field['show_on_pkg']);
 | 
                                                        |
| 398 | -            else {
 | 
                                                        |
| 405 | +            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) { | 
                                                        |
| 406 | +                            $price_pkg = implode(",", $request_field['show_on_pkg']); | 
                                                        |
| 407 | +            } else {
 | 
                                                        |
| 399 | 408 | $package_info = array();  | 
                                                        
| 400 | 409 | |
| 401 | 410 | $package_info = geodir_post_package_info($package_info, '', $post_type);  | 
                                                        
@@ -403,22 +412,29 @@ discard block  | 
                                                    ||
| 403 | 412 | }  | 
                                                        
| 404 | 413 | |
| 405 | 414 | |
| 406 | - if (isset($request_field['extra']) && !empty($request_field['extra']))  | 
                                                        |
| 407 | - $extra_fields = $request_field['extra'];  | 
                                                        |
| 415 | +            if (isset($request_field['extra']) && !empty($request_field['extra'])) { | 
                                                        |
| 416 | + $extra_fields = $request_field['extra'];  | 
                                                        |
| 417 | + }  | 
                                                        |
| 408 | 418 | |
| 409 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '')  | 
                                                        |
| 410 | - $is_default = $request_field['is_default'];  | 
                                                        |
| 411 | - else  | 
                                                        |
| 412 | - $is_default = '0';  | 
                                                        |
| 419 | +            if (isset($request_field['is_default']) && $request_field['is_default'] != '') { | 
                                                        |
| 420 | + $is_default = $request_field['is_default'];  | 
                                                        |
| 421 | +            } else { | 
                                                        |
| 422 | + $is_default = '0';  | 
                                                        |
| 423 | + }  | 
                                                        |
| 413 | 424 | |
| 414 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')  | 
                                                        |
| 415 | - $is_admin = $request_field['is_admin'];  | 
                                                        |
| 416 | - else  | 
                                                        |
| 417 | - $is_admin = '0';  | 
                                                        |
| 425 | +            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') { | 
                                                        |
| 426 | + $is_admin = $request_field['is_admin'];  | 
                                                        |
| 427 | +            } else { | 
                                                        |
| 428 | + $is_admin = '0';  | 
                                                        |
| 429 | + }  | 
                                                        |
| 418 | 430 | |
| 419 | 431 | |
| 420 | - if ($is_active == '') $is_active = 1;  | 
                                                        |
| 421 | - if ($is_required == '') $is_required = 0;  | 
                                                        |
| 432 | +            if ($is_active == '') { | 
                                                        |
| 433 | + $is_active = 1;  | 
                                                        |
| 434 | + }  | 
                                                        |
| 435 | +            if ($is_required == '') { | 
                                                        |
| 436 | + $is_required = 0;  | 
                                                        |
| 437 | + }  | 
                                                        |
| 422 | 438 | |
| 423 | 439 | |
| 424 | 440 |              if ($sort_order == '') {
 | 
                                                        
@@ -687,7 +703,7 @@ discard block  | 
                                                    ||
| 687 | 703 | }  | 
                                                        
| 688 | 704 |                                  if($op_max){$op_size =$op_max; }
 | 
                                                        
| 689 | 705 | }  | 
                                                        
| 690 | -                        }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
 | 
                                                        |
| 706 | +                        } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
 | 
                                                        |
| 691 | 707 |                              if(strlen($option_values)){
 | 
                                                        
| 692 | 708 | $op_size = strlen($option_values);  | 
                                                        
| 693 | 709 | }  | 
                                                        
@@ -704,11 +720,13 @@ discard block  | 
                                                    ||
| 704 | 720 |                              return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        
| 705 | 721 | }  | 
                                                        
| 706 | 722 | |
| 707 | - if (isset($request_field['cat_display_type']))  | 
                                                        |
| 708 | - $extra_fields = $request_field['cat_display_type'];  | 
                                                        |
| 723 | +                        if (isset($request_field['cat_display_type'])) { | 
                                                        |
| 724 | + $extra_fields = $request_field['cat_display_type'];  | 
                                                        |
| 725 | + }  | 
                                                        |
| 709 | 726 | |
| 710 | - if (isset($request_field['multi_display_type']))  | 
                                                        |
| 711 | - $extra_fields = $request_field['multi_display_type'];  | 
                                                        |
| 727 | +                        if (isset($request_field['multi_display_type'])) { | 
                                                        |
| 728 | + $extra_fields = $request_field['multi_display_type'];  | 
                                                        |
| 729 | + }  | 
                                                        |
| 712 | 730 | |
| 713 | 731 | |
| 714 | 732 | break;  | 
                                                        
@@ -722,8 +740,9 @@ discard block  | 
                                                    ||
| 722 | 740 |                          if($alter_result===false){
 | 
                                                        
| 723 | 741 |                              return __('Column change failed, you may have too many columns.','geodirectory');
 | 
                                                        
| 724 | 742 | }  | 
                                                        
| 725 | - if (isset($request_field['advanced_editor']))  | 
                                                        |
| 726 | - $extra_fields = $request_field['advanced_editor'];  | 
                                                        |
| 743 | +                        if (isset($request_field['advanced_editor'])) { | 
                                                        |
| 744 | + $extra_fields = $request_field['advanced_editor'];  | 
                                                        |
| 745 | + }  | 
                                                        |
| 727 | 746 | |
| 728 | 747 | break;  | 
                                                        
| 729 | 748 | |
@@ -817,8 +836,9 @@ discard block  | 
                                                    ||
| 817 | 836 | );  | 
                                                        
| 818 | 837 | |
| 819 | 838 | |
| 820 | - if ($cat_sort == '')  | 
                                                        |
| 821 | -                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
 | 
                                                        |
| 839 | +                if ($cat_sort == '') { | 
                                                        |
| 840 | +                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name))); | 
                                                        |
| 841 | + }  | 
                                                        |
| 822 | 842 | |
| 823 | 843 | |
| 824 | 844 | /**  | 
                                                        
@@ -1186,8 +1206,10 @@ discard block  | 
                                                    ||
| 1186 | 1206 | }  | 
                                                        
| 1187 | 1207 | |
| 1188 | 1208 | return $post_meta_info;  | 
                                                        
| 1189 | - else:  | 
                                                        |
| 1190 | - return false;  | 
                                                        |
| 1209 | +    else { | 
                                                        |
| 1210 | + :  | 
                                                        |
| 1211 | + return false;  | 
                                                        |
| 1212 | + }  | 
                                                        |
| 1191 | 1213 | endif;  | 
                                                        
| 1192 | 1214 | }  | 
                                                        
| 1193 | 1215 | |
@@ -1240,8 +1262,9 @@ discard block  | 
                                                    ||
| 1240 | 1262 |          if (is_admin()) {
 | 
                                                        
| 1241 | 1263 | global $post;  | 
                                                        
| 1242 | 1264 | |
| 1243 | - if (isset($_REQUEST['post']))  | 
                                                        |
| 1244 | - $_REQUEST['pid'] = $_REQUEST['post'];  | 
                                                        |
| 1265 | +            if (isset($_REQUEST['post'])) { | 
                                                        |
| 1266 | + $_REQUEST['pid'] = $_REQUEST['post'];  | 
                                                        |
| 1267 | + }  | 
                                                        |
| 1245 | 1268 | }  | 
                                                        
| 1246 | 1269 | |
| 1247 | 1270 |          if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
 | 
                                                        
@@ -1273,7 +1296,10 @@ discard block  | 
                                                    ||
| 1273 | 1296 | $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;  | 
                                                        
| 1274 | 1297 | ?>  | 
                                                        
| 1275 | 1298 | <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>  | 
                                                        
| 1276 | - <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>  | 
                                                        |
| 1299 | +                <?php if ($admin_desc != '') { | 
                                                        |
| 1300 | + echo '<small>( ' . $admin_desc . ' )</small>';  | 
                                                        |
| 1301 | +}  | 
                                                        |
| 1302 | +?></h5>  | 
                                                        |
| 1277 | 1303 | <?php  | 
                                                        
| 1278 | 1304 |          } else if ($type == 'address') {
 | 
                                                        
| 1279 | 1305 | $prefix = $name . '_';  | 
                                                        
@@ -1310,17 +1336,27 @@ discard block  | 
                                                    ||
| 1310 | 1336 | }  | 
                                                        
| 1311 | 1337 | |
| 1312 | 1338 | $location = geodir_get_default_location();  | 
                                                        
| 1313 | - if (empty($city)) $city = isset($location->city) ? $location->city : '';  | 
                                                        |
| 1314 | - if (empty($region)) $region = isset($location->region) ? $location->region : '';  | 
                                                        |
| 1315 | - if (empty($country)) $country = isset($location->country) ? $location->country : '';  | 
                                                        |
| 1339 | +            if (empty($city)) { | 
                                                        |
| 1340 | + $city = isset($location->city) ? $location->city : '';  | 
                                                        |
| 1341 | + }  | 
                                                        |
| 1342 | +            if (empty($region)) { | 
                                                        |
| 1343 | + $region = isset($location->region) ? $location->region : '';  | 
                                                        |
| 1344 | + }  | 
                                                        |
| 1345 | +            if (empty($country)) { | 
                                                        |
| 1346 | + $country = isset($location->country) ? $location->country : '';  | 
                                                        |
| 1347 | + }  | 
                                                        |
| 1316 | 1348 | |
| 1317 | 1349 | $lat_lng_blank = false;  | 
                                                        
| 1318 | 1350 |              if (empty($lat) && empty($lng)) {
 | 
                                                        
| 1319 | 1351 | $lat_lng_blank = true;  | 
                                                        
| 1320 | 1352 | }  | 
                                                        
| 1321 | 1353 | |
| 1322 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';  | 
                                                        |
| 1323 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';  | 
                                                        |
| 1354 | +            if (empty($lat)) { | 
                                                        |
| 1355 | + $lat = isset($location->city_latitude) ? $location->city_latitude : '';  | 
                                                        |
| 1356 | + }  | 
                                                        |
| 1357 | +            if (empty($lng)) { | 
                                                        |
| 1358 | + $lng = isset($location->city_longitude) ? $location->city_longitude : '';  | 
                                                        |
| 1359 | + }  | 
                                                        |
| 1324 | 1360 | |
| 1325 | 1361 | /**  | 
                                                        
| 1326 | 1362 | * Filter the default latitude.  | 
                                                        
@@ -1344,10 +1380,16 @@ discard block  | 
                                                    ||
| 1344 | 1380 | ?>  | 
                                                        
| 1345 | 1381 | |
| 1346 | 1382 | <div id="geodir_<?php echo $prefix . 'address';?>_row"  | 
                                                        
| 1347 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1383 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1384 | + echo 'required_field';  | 
                                                        |
| 1385 | +}  | 
                                                        |
| 1386 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1348 | 1387 | <label>  | 
                                                        
| 1349 | 1388 | <?php _e($address_title, 'geodirectory'); ?>  | 
                                                        
| 1350 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1389 | +                    <?php if ($is_required) { | 
                                                        |
| 1390 | + echo '<span>*</span>';  | 
                                                        |
| 1391 | +}  | 
                                                        |
| 1392 | +?>  | 
                                                        |
| 1351 | 1393 | </label>  | 
                                                        
| 1352 | 1394 | <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"  | 
                                                        
| 1353 | 1395 | id="<?php echo $prefix . 'address';?>" class="geodir_textfield"  | 
                                                        
@@ -1408,10 +1450,16 @@ discard block  | 
                                                    ||
| 1408 | 1450 | /* show lat lng */  | 
                                                        
| 1409 | 1451 | $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>  | 
                                                        
| 1410 | 1452 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"  | 
                                                        
| 1411 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>  | 
                                                        |
| 1453 | +                     class="<?php if ($is_required) { | 
                                                        |
| 1454 | + echo 'required_field';  | 
                                                        |
| 1455 | +}  | 
                                                        |
| 1456 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>  | 
                                                        |
| 1412 | 1457 | <label>  | 
                                                        
| 1413 | 1458 | <?php echo PLACE_ADDRESS_LAT; ?>  | 
                                                        
| 1414 | - <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1459 | +                        <?php if ($is_required) { | 
                                                        |
| 1460 | + echo '<span>*</span>';  | 
                                                        |
| 1461 | +}  | 
                                                        |
| 1462 | +?>  | 
                                                        |
| 1415 | 1463 | </label>  | 
                                                        
| 1416 | 1464 | <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"  | 
                                                        
| 1417 | 1465 | id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"  | 
                                                        
@@ -1423,10 +1471,16 @@ discard block  | 
                                                    ||
| 1423 | 1471 | </div>  | 
                                                        
| 1424 | 1472 | |
| 1425 | 1473 | <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"  | 
                                                        
| 1426 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>  | 
                                                        |
| 1474 | +                     class="<?php if ($is_required) { | 
                                                        |
| 1475 | + echo 'required_field';  | 
                                                        |
| 1476 | +}  | 
                                                        |
| 1477 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>  | 
                                                        |
| 1427 | 1478 | <label>  | 
                                                        
| 1428 | 1479 | <?php echo PLACE_ADDRESS_LNG; ?>  | 
                                                        
| 1429 | - <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1480 | +                        <?php if ($is_required) { | 
                                                        |
| 1481 | + echo '<span>*</span>';  | 
                                                        |
| 1482 | +}  | 
                                                        |
| 1483 | +?>  | 
                                                        |
| 1430 | 1484 | </label>  | 
                                                        
| 1431 | 1485 | <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"  | 
                                                        
| 1432 | 1486 | id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"  | 
                                                        
@@ -1481,26 +1535,31 @@ discard block  | 
                                                    ||
| 1481 | 1535 |          <?php } elseif ($type == 'text') {
 | 
                                                        
| 1482 | 1536 | |
| 1483 | 1537 | //number and float validation $validation_pattern  | 
                                                        
| 1484 | -            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
 | 
                                                        |
| 1485 | -            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
 | 
                                                        |
| 1538 | +            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';} elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
 | 
                                                        |
| 1486 | 1539 | //print_r($val);  | 
                                                        
| 1487 | 1540 | //validation  | 
                                                        
| 1488 | 1541 |              if(isset($val['validation_pattern']) && $val['validation_pattern']){
 | 
                                                        
| 1489 | 1542 | $validation = 'pattern="'.$val['validation_pattern'].'"';  | 
                                                        
| 1490 | -            }else{$validation='';}
 | 
                                                        |
| 1543 | +            } else{$validation='';}
 | 
                                                        |
| 1491 | 1544 | |
| 1492 | 1545 | // validation message  | 
                                                        
| 1493 | 1546 |              if(isset($val['validation_msg']) && $val['validation_msg']){
 | 
                                                        
| 1494 | 1547 | $validation_msg = 'title="'.$val['validation_msg'].'"';  | 
                                                        
| 1495 | -            }else{$validation_msg='';}
 | 
                                                        |
| 1548 | +            } else{$validation_msg='';}
 | 
                                                        |
| 1496 | 1549 | ?>  | 
                                                        
| 1497 | 1550 | |
| 1498 | 1551 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1499 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1552 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1553 | + echo 'required_field';  | 
                                                        |
| 1554 | +}  | 
                                                        |
| 1555 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1500 | 1556 | <label>  | 
                                                        
| 1501 | 1557 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1502 | 1558 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1503 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1559 | +                    <?php if ($is_required) { | 
                                                        |
| 1560 | + echo '<span>*</span>';  | 
                                                        |
| 1561 | +}  | 
                                                        |
| 1562 | +?>  | 
                                                        |
| 1504 | 1563 | </label>  | 
                                                        
| 1505 | 1564 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
| 1506 | 1565 | value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />  | 
                                                        
@@ -1516,11 +1575,17 @@ discard block  | 
                                                    ||
| 1516 | 1575 | }?>  | 
                                                        
| 1517 | 1576 | |
| 1518 | 1577 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1519 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1578 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1579 | + echo 'required_field';  | 
                                                        |
| 1580 | +}  | 
                                                        |
| 1581 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1520 | 1582 | <label>  | 
                                                        
| 1521 | 1583 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1522 | 1584 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1523 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1585 | +                    <?php if ($is_required) { | 
                                                        |
| 1586 | + echo '<span>*</span>';  | 
                                                        |
| 1587 | +}  | 
                                                        |
| 1588 | +?>  | 
                                                        |
| 1524 | 1589 | </label>  | 
                                                        
| 1525 | 1590 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
| 1526 | 1591 | value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>  | 
                                                        
@@ -1536,11 +1601,17 @@ discard block  | 
                                                    ||
| 1536 | 1601 | } ?>  | 
                                                        
| 1537 | 1602 | |
| 1538 | 1603 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1539 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1604 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1605 | + echo 'required_field';  | 
                                                        |
| 1606 | +}  | 
                                                        |
| 1607 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1540 | 1608 | <label>  | 
                                                        
| 1541 | 1609 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1542 | 1610 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1543 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1611 | +                    <?php if ($is_required) { | 
                                                        |
| 1612 | + echo '<span>*</span>';  | 
                                                        |
| 1613 | +}  | 
                                                        |
| 1614 | +?>  | 
                                                        |
| 1544 | 1615 | </label>  | 
                                                        
| 1545 | 1616 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
| 1546 | 1617 | value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>  | 
                                                        
@@ -1556,11 +1627,17 @@ discard block  | 
                                                    ||
| 1556 | 1627 | }?>  | 
                                                        
| 1557 | 1628 | |
| 1558 | 1629 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1559 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1630 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1631 | + echo 'required_field';  | 
                                                        |
| 1632 | +}  | 
                                                        |
| 1633 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1560 | 1634 | <label>  | 
                                                        
| 1561 | 1635 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1562 | 1636 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1563 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1637 | +                    <?php if ($is_required) { | 
                                                        |
| 1638 | + echo '<span>*</span>';  | 
                                                        |
| 1639 | +}  | 
                                                        |
| 1640 | +?>  | 
                                                        |
| 1564 | 1641 | </label>  | 
                                                        
| 1565 | 1642 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
| 1566 | 1643 | value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"  | 
                                                        
@@ -1575,11 +1652,17 @@ discard block  | 
                                                    ||
| 1575 | 1652 | |
| 1576 | 1653 |          <?php } elseif ($type == 'radio') { ?>
 | 
                                                        
| 1577 | 1654 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1578 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1655 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1656 | + echo 'required_field';  | 
                                                        |
| 1657 | +}  | 
                                                        |
| 1658 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1579 | 1659 | <label>  | 
                                                        
| 1580 | 1660 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1581 | 1661 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1582 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1662 | +                    <?php if ($is_required) { | 
                                                        |
| 1663 | + echo '<span>*</span>';  | 
                                                        |
| 1664 | +}  | 
                                                        |
| 1665 | +?>  | 
                                                        |
| 1583 | 1666 | </label>  | 
                                                        
| 1584 | 1667 |                  <?php if ($option_values) {
 | 
                                                        
| 1585 | 1668 | $option_values = geodir_string_values_to_options($option_values, true);  | 
                                                        
@@ -1604,11 +1687,17 @@ discard block  | 
                                                    ||
| 1604 | 1687 |          <?php } elseif ($type == 'checkbox') { ?>
 | 
                                                        
| 1605 | 1688 | |
| 1606 | 1689 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1607 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1690 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1691 | + echo 'required_field';  | 
                                                        |
| 1692 | +}  | 
                                                        |
| 1693 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1608 | 1694 | <label>  | 
                                                        
| 1609 | 1695 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1610 | 1696 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1611 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1697 | +                    <?php if ($is_required) { | 
                                                        |
| 1698 | + echo '<span>*</span>';  | 
                                                        |
| 1699 | +}  | 
                                                        |
| 1700 | +?>  | 
                                                        |
| 1612 | 1701 | </label>  | 
                                                        
| 1613 | 1702 |                  <?php if ($value != '1') {
 | 
                                                        
| 1614 | 1703 | $value = '0';  | 
                                                        
@@ -1628,11 +1717,17 @@ discard block  | 
                                                    ||
| 1628 | 1717 | ?>  | 
                                                        
| 1629 | 1718 | |
| 1630 | 1719 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1631 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1720 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1721 | + echo 'required_field';  | 
                                                        |
| 1722 | +}  | 
                                                        |
| 1723 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1632 | 1724 | <label>  | 
                                                        
| 1633 | 1725 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1634 | 1726 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1635 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1727 | +                    <?php if ($is_required) { | 
                                                        |
| 1728 | + echo '<span>*</span>';  | 
                                                        |
| 1729 | +}  | 
                                                        |
| 1730 | +?>  | 
                                                        |
| 1636 | 1731 | </label><?php  | 
                                                        
| 1637 | 1732 | |
| 1638 | 1733 | |
@@ -1660,11 +1755,17 @@ discard block  | 
                                                    ||
| 1660 | 1755 | |
| 1661 | 1756 |          <?php } elseif ($type == 'select') { ?>
 | 
                                                        
| 1662 | 1757 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1663 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1758 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1759 | + echo 'required_field';  | 
                                                        |
| 1760 | +}  | 
                                                        |
| 1761 | +?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1664 | 1762 | <label>  | 
                                                        
| 1665 | 1763 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1666 | 1764 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1667 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1765 | +                    <?php if ($is_required) { | 
                                                        |
| 1766 | + echo '<span>*</span>';  | 
                                                        |
| 1767 | +}  | 
                                                        |
| 1768 | +?>  | 
                                                        |
| 1668 | 1769 | </label>  | 
                                                        
| 1669 | 1770 | <?php  | 
                                                        
| 1670 | 1771 | $option_values_arr = geodir_string_values_to_options($option_values, true);  | 
                                                        
@@ -1703,11 +1804,17 @@ discard block  | 
                                                    ||
| 1703 | 1804 | }  | 
                                                        
| 1704 | 1805 | ?>  | 
                                                        
| 1705 | 1806 | <div id="<?php echo $name; ?>_row"  | 
                                                        
| 1706 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1807 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1808 | + echo 'required_field';  | 
                                                        |
| 1809 | +}  | 
                                                        |
| 1810 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1707 | 1811 | <label>  | 
                                                        
| 1708 | 1812 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1709 | 1813 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1710 | - <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1814 | +                    <?php if ($is_required) { | 
                                                        |
| 1815 | + echo '<span>*</span>';  | 
                                                        |
| 1816 | +}  | 
                                                        |
| 1817 | +?>  | 
                                                        |
| 1711 | 1818 | </label>  | 
                                                        
| 1712 | 1819 | <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/>  | 
                                                        
| 1713 | 1820 |                  <?php if ($multi_display == 'select') { ?>
 | 
                                                        
@@ -1777,11 +1884,17 @@ discard block  | 
                                                    ||
| 1777 | 1884 | ?>  | 
                                                        
| 1778 | 1885 | |
| 1779 | 1886 | <div id="<?php echo $name; ?>_row"  | 
                                                        
| 1780 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1887 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1888 | + echo 'required_field';  | 
                                                        |
| 1889 | +}  | 
                                                        |
| 1890 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1781 | 1891 | <label>  | 
                                                        
| 1782 | 1892 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1783 | 1893 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1784 | - <?php if ($is_required) echo '<span>*</span>'; ?>  | 
                                                        |
| 1894 | +                    <?php if ($is_required) { | 
                                                        |
| 1895 | + echo '<span>*</span>';  | 
                                                        |
| 1896 | +}  | 
                                                        |
| 1897 | +?>  | 
                                                        |
| 1785 | 1898 | </label>  | 
                                                        
| 1786 | 1899 | |
| 1787 | 1900 |                  <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
 | 
                                                        
@@ -1798,8 +1911,9 @@ discard block  | 
                                                    ||
| 1798 | 1911 | </div>  | 
                                                        
| 1799 | 1912 |          <?php } elseif ($type == 'datepicker') {
 | 
                                                        
| 1800 | 1913 | |
| 1801 | - if ($extra_fields['date_format'] == '')  | 
                                                        |
| 1802 | - $extra_fields['date_format'] = 'yy-mm-dd';  | 
                                                        |
| 1914 | +            if ($extra_fields['date_format'] == '') { | 
                                                        |
| 1915 | + $extra_fields['date_format'] = 'yy-mm-dd';  | 
                                                        |
| 1916 | + }  | 
                                                        |
| 1803 | 1917 | |
| 1804 | 1918 | $date_format = $extra_fields['date_format'];  | 
                                                        
| 1805 | 1919 | $jquery_date_format = $date_format;  | 
                                                        
@@ -1813,7 +1927,7 @@ discard block  | 
                                                    ||
| 1813 | 1927 |                  $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        
| 1814 | 1928 | |
| 1815 | 1929 | $date_format = str_replace($search, $replace, $date_format);  | 
                                                        
| 1816 | -            }else{
 | 
                                                        |
| 1930 | +            } else{
 | 
                                                        |
| 1817 | 1931 | $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );  | 
                                                        
| 1818 | 1932 | }  | 
                                                        
| 1819 | 1933 | |
@@ -1847,12 +1961,18 @@ discard block  | 
                                                    ||
| 1847 | 1961 | |
| 1848 | 1962 | </script>  | 
                                                        
| 1849 | 1963 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1850 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1964 | +                 class="<?php if ($is_required) { | 
                                                        |
| 1965 | + echo 'required_field';  | 
                                                        |
| 1966 | +}  | 
                                                        |
| 1967 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1851 | 1968 | <label>  | 
                                                        
| 1852 | 1969 | |
| 1853 | 1970 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1854 | 1971 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1855 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 1972 | +                    <?php if ($is_required) { | 
                                                        |
| 1973 | + echo '<span>*</span>';  | 
                                                        |
| 1974 | +}  | 
                                                        |
| 1975 | +?>  | 
                                                        |
| 1856 | 1976 | </label>  | 
                                                        
| 1857 | 1977 | |
| 1858 | 1978 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"  | 
                                                        
@@ -1866,8 +1986,9 @@ discard block  | 
                                                    ||
| 1866 | 1986 | |
| 1867 | 1987 |          <?php } elseif ($type == 'time') {
 | 
                                                        
| 1868 | 1988 | |
| 1869 | - if ($value != '')  | 
                                                        |
| 1870 | -                $value = date('H:i', strtotime($value));
 | 
                                                        |
| 1989 | +            if ($value != '') { | 
                                                        |
| 1990 | +                            $value = date('H:i', strtotime($value)); | 
                                                        |
| 1991 | + }  | 
                                                        |
| 1871 | 1992 | ?>  | 
                                                        
| 1872 | 1993 | <script type="text/javascript">  | 
                                                        
| 1873 | 1994 |                  jQuery(document).ready(function () {
 | 
                                                        
@@ -1880,12 +2001,18 @@ discard block  | 
                                                    ||
| 1880 | 2001 | });  | 
                                                        
| 1881 | 2002 | </script>  | 
                                                        
| 1882 | 2003 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1883 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 2004 | +                 class="<?php if ($is_required) { | 
                                                        |
| 2005 | + echo 'required_field';  | 
                                                        |
| 2006 | +}  | 
                                                        |
| 2007 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1884 | 2008 | <label>  | 
                                                        
| 1885 | 2009 | |
| 1886 | 2010 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1887 | 2011 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1888 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 2012 | +                    <?php if ($is_required) { | 
                                                        |
| 2013 | + echo '<span>*</span>';  | 
                                                        |
| 2014 | +}  | 
                                                        |
| 2015 | +?>  | 
                                                        |
| 1889 | 2016 | </label>  | 
                                                        
| 1890 | 2017 | <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"  | 
                                                        
| 1891 | 2018 | id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>  | 
                                                        
@@ -1901,11 +2028,17 @@ discard block  | 
                                                    ||
| 1901 | 2028 | $value = '';  | 
                                                        
| 1902 | 2029 | } ?>  | 
                                                        
| 1903 | 2030 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 1904 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 2031 | +                 class="<?php if ($is_required) { | 
                                                        |
| 2032 | + echo 'required_field';  | 
                                                        |
| 2033 | +}  | 
                                                        |
| 2034 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 1905 | 2035 | <label>  | 
                                                        
| 1906 | 2036 | <?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 1907 | 2037 | echo (trim($site_title)) ? $site_title : ' '; ?>  | 
                                                        
| 1908 | - <?php if ($is_required) echo '<span>*</span>';?>  | 
                                                        |
| 2038 | +                    <?php if ($is_required) { | 
                                                        |
| 2039 | + echo '<span>*</span>';  | 
                                                        |
| 2040 | +}  | 
                                                        |
| 2041 | +?>  | 
                                                        |
| 1909 | 2042 | </label>  | 
                                                        
| 1910 | 2043 | |
| 1911 | 2044 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">  | 
                                                        
@@ -1939,8 +2072,9 @@ discard block  | 
                                                    ||
| 1939 | 2072 |                          $post_cat = implode(",", $post_cat[$name]);
 | 
                                                        
| 1940 | 2073 | |
| 1941 | 2074 |                      } else {
 | 
                                                        
| 1942 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')  | 
                                                        |
| 1943 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);  | 
                                                        |
| 2075 | +                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { | 
                                                        |
| 2076 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);  | 
                                                        |
| 2077 | + }  | 
                                                        |
| 1944 | 2078 | }  | 
                                                        
| 1945 | 2079 | |
| 1946 | 2080 | |
@@ -1978,21 +2112,24 @@ discard block  | 
                                                    ||
| 1978 | 2112 | |
| 1979 | 2113 | $cat_display == '';  | 
                                                        
| 1980 | 2114 | $multiple = '';  | 
                                                        
| 1981 | - if ($cat_display == 'multiselect')  | 
                                                        |
| 1982 | - $multiple = 'multiple="multiple"';  | 
                                                        |
| 2115 | +                            if ($cat_display == 'multiselect') { | 
                                                        |
| 2116 | + $multiple = 'multiple="multiple"';  | 
                                                        |
| 2117 | + }  | 
                                                        |
| 1983 | 2118 | |
| 1984 | 2119 |                              echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
 | 
                                                        
| 1985 | 2120 | |
| 1986 | 2121 | |
| 1987 | - if ($cat_display == 'select')  | 
                                                        |
| 1988 | -                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
 | 
                                                        |
| 2122 | +                            if ($cat_display == 'select') { | 
                                                        |
| 2123 | +                                                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; | 
                                                        |
| 2124 | + }  | 
                                                        |
| 1989 | 2125 | |
| 1990 | 2126 | }  | 
                                                        
| 1991 | 2127 | |
| 1992 | 2128 | echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);  | 
                                                        
| 1993 | 2129 | |
| 1994 | - if ($cat_display == 'select' || $cat_display == 'multiselect')  | 
                                                        |
| 1995 | - echo '</select>';  | 
                                                        |
| 2130 | +                        if ($cat_display == 'select' || $cat_display == 'multiselect') { | 
                                                        |
| 2131 | + echo '</select>';  | 
                                                        |
| 2132 | + }  | 
                                                        |
| 1996 | 2133 | |
| 1997 | 2134 |                      } else {
 | 
                                                        
| 1998 | 2135 | |
@@ -2022,18 +2159,23 @@ discard block  | 
                                                    ||
| 2022 | 2159 | |
| 2023 | 2160 | $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.  | 
                                                        
| 2024 | 2161 | |
| 2025 | - } else  | 
                                                        |
| 2026 | - $file_value = '';  | 
                                                        |
| 2162 | +            } else { | 
                                                        |
| 2163 | + $file_value = '';  | 
                                                        |
| 2164 | + }  | 
                                                        |
| 2027 | 2165 | |
| 2028 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])  | 
                                                        |
| 2029 | - $file_multiple = true; // allow multiple files upload  | 
                                                        |
| 2030 | - else  | 
                                                        |
| 2031 | - $file_multiple = false;  | 
                                                        |
| 2166 | +            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) { | 
                                                        |
| 2167 | + $file_multiple = true;  | 
                                                        |
| 2168 | + }  | 
                                                        |
| 2169 | + // allow multiple files upload  | 
                                                        |
| 2170 | +            else { | 
                                                        |
| 2171 | + $file_multiple = false;  | 
                                                        |
| 2172 | + }  | 
                                                        |
| 2032 | 2173 | |
| 2033 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])  | 
                                                        |
| 2034 | - $file_image_limit = $extra_fields['image_limit'];  | 
                                                        |
| 2035 | - else  | 
                                                        |
| 2036 | - $file_image_limit = 1;  | 
                                                        |
| 2174 | +            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) { | 
                                                        |
| 2175 | + $file_image_limit = $extra_fields['image_limit'];  | 
                                                        |
| 2176 | +            } else { | 
                                                        |
| 2177 | + $file_image_limit = 1;  | 
                                                        |
| 2178 | + }  | 
                                                        |
| 2037 | 2179 | |
| 2038 | 2180 | $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)  | 
                                                        
| 2039 | 2181 | |
@@ -2041,8 +2183,9 @@ discard block  | 
                                                    ||
| 2041 | 2183 | |
| 2042 | 2184 |              if (!empty($file_value)) {
 | 
                                                        
| 2043 | 2185 |                  $curImages = explode(',', $file_value);
 | 
                                                        
| 2044 | - if (!empty($curImages))  | 
                                                        |
| 2045 | - $file_totImg = count($curImages);  | 
                                                        |
| 2186 | +                if (!empty($curImages)) { | 
                                                        |
| 2187 | + $file_totImg = count($curImages);  | 
                                                        |
| 2188 | + }  | 
                                                        |
| 2046 | 2189 | }  | 
                                                        
| 2047 | 2190 | |
| 2048 | 2191 |              $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
 | 
                                                        
@@ -2057,12 +2200,18 @@ discard block  | 
                                                    ||
| 2057 | 2200 | ?>  | 
                                                        
| 2058 | 2201 | |
| 2059 | 2202 | <div id="<?php echo $name;?>_row"  | 
                                                        
| 2060 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 2203 | +                 class="<?php if ($is_required) { | 
                                                        |
| 2204 | + echo 'required_field';  | 
                                                        |
| 2205 | +}  | 
                                                        |
| 2206 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">  | 
                                                        |
| 2061 | 2207 | |
| 2062 | 2208 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">  | 
                                                        
| 2063 | 2209 | <label  | 
                                                        
| 2064 | 2210 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');  | 
                                                        
| 2065 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>  | 
                                                        |
| 2211 | +                        echo $site_title; ?><?php if ($is_required) { | 
                                                        |
| 2212 | + echo '<span>*</span>';  | 
                                                        |
| 2213 | + }  | 
                                                        |
| 2214 | + ?></label>  | 
                                                        |
| 2066 | 2215 | <input class="geodir-custom-file-upload" field_type="file" type="hidden"  | 
                                                        
| 2067 | 2216 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"  | 
                                                        
| 2068 | 2217 | value="<?php echo esc_attr($file_value); ?>"/>  | 
                                                        
@@ -2205,9 +2354,10 @@ discard block  | 
                                                    ||
| 2205 | 2354 | $field_set_start = 0;  | 
                                                        
| 2206 | 2355 | |
| 2207 | 2356 | |
| 2208 | - if ($fields_location == 'detail')  | 
                                                        |
| 2209 | -  | 
                                                        |
| 2210 | - $i = 1;  | 
                                                        |
| 2357 | +            if ($fields_location == 'detail') { | 
                                                        |
| 2358 | +  | 
                                                        |
| 2359 | + $i = 1;  | 
                                                        |
| 2360 | + }  | 
                                                        |
| 2211 | 2361 |              foreach ($fields_info as $type) {
 | 
                                                        
| 2212 | 2362 | $type = stripslashes_deep($type); // strip slashes  | 
                                                        
| 2213 | 2363 | $html = '';  | 
                                                        
@@ -2224,8 +2374,9 @@ discard block  | 
                                                    ||
| 2224 | 2374 | $variables_array['post_id'] = $post->ID;  | 
                                                        
| 2225 | 2375 | $variables_array['label'] = __($type['site_title'], 'geodirectory');  | 
                                                        
| 2226 | 2376 | $variables_array['value'] = '';  | 
                                                        
| 2227 | -                    if (isset($post->{$type['htmlvar_name']}))
 | 
                                                        |
| 2228 | -                        $variables_array['value'] = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2377 | +                    if (isset($post->{$type['htmlvar_name']})) { | 
                                                        |
| 2378 | +                                            $variables_array['value'] = $post->{$type['htmlvar_name']}; | 
                                                        |
| 2379 | + }  | 
                                                        |
| 2229 | 2380 | endif;  | 
                                                        
| 2230 | 2381 | |
| 2231 | 2382 | //if($type['field_icon'])  | 
                                                        
@@ -2352,8 +2503,9 @@ discard block  | 
                                                    ||
| 2352 | 2503 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2353 | 2504 | |
| 2354 | 2505 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2355 | - if ($i % 2 == 0)  | 
                                                        |
| 2356 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2506 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2507 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2508 | + }  | 
                                                        |
| 2357 | 2509 | |
| 2358 | 2510 | $i++;  | 
                                                        
| 2359 | 2511 | }  | 
                                                        
@@ -2427,8 +2579,9 @@ discard block  | 
                                                    ||
| 2427 | 2579 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2428 | 2580 | |
| 2429 | 2581 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2430 | - if ($i % 2 == 0)  | 
                                                        |
| 2431 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2582 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2583 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2584 | + }  | 
                                                        |
| 2432 | 2585 | |
| 2433 | 2586 | $i++;  | 
                                                        
| 2434 | 2587 | }  | 
                                                        
@@ -2470,8 +2623,9 @@ discard block  | 
                                                    ||
| 2470 | 2623 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2471 | 2624 | |
| 2472 | 2625 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2473 | - if ($i % 2 == 0)  | 
                                                        |
| 2474 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2626 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2627 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2628 | + }  | 
                                                        |
| 2475 | 2629 | |
| 2476 | 2630 | $i++;  | 
                                                        
| 2477 | 2631 | }  | 
                                                        
@@ -2491,9 +2645,10 @@ discard block  | 
                                                    ||
| 2491 | 2645 |                          if ($post->{$type['htmlvar_name']}):
 | 
                                                        
| 2492 | 2646 | |
| 2493 | 2647 | $value = '';  | 
                                                        
| 2494 | -                            if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2495 | -                                //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2496 | -                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2648 | +                            if ($post->{$type['htmlvar_name']} != '') { | 
                                                        |
| 2649 | +                                                            //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2650 | +                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']})); | 
                                                        |
| 2651 | + }  | 
                                                        |
| 2497 | 2652 | |
| 2498 | 2653 |                              if (strpos($field_icon, 'http') !== false) {
 | 
                                                        
| 2499 | 2654 | $field_icon_af = '';  | 
                                                        
@@ -2508,8 +2663,9 @@ discard block  | 
                                                    ||
| 2508 | 2663 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2509 | 2664 | |
| 2510 | 2665 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2511 | - if ($i % 2 == 0)  | 
                                                        |
| 2512 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2666 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2667 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2668 | + }  | 
                                                        |
| 2513 | 2669 | |
| 2514 | 2670 | $i++;  | 
                                                        
| 2515 | 2671 | }  | 
                                                        
@@ -2541,13 +2697,13 @@ discard block  | 
                                                    ||
| 2541 | 2697 | $date_format = str_replace($search, $replace, $date_format);  | 
                                                        
| 2542 | 2698 | |
| 2543 | 2699 |                                  $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        
| 2544 | -                            }else{
 | 
                                                        |
| 2700 | +                            } else{
 | 
                                                        |
| 2545 | 2701 |                                  $post_htmlvar_value = $post->{$type['htmlvar_name']};
 | 
                                                        
| 2546 | 2702 | }  | 
                                                        
| 2547 | 2703 | |
| 2548 | 2704 |                              if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
 | 
                                                        
| 2549 | 2705 | $value = date_i18n($date_format, strtotime($post_htmlvar_value));  | 
                                                        
| 2550 | -                            }else{
 | 
                                                        |
| 2706 | +                            } else{
 | 
                                                        |
| 2551 | 2707 | continue;  | 
                                                        
| 2552 | 2708 | }  | 
                                                        
| 2553 | 2709 | |
@@ -2564,8 +2720,9 @@ discard block  | 
                                                    ||
| 2564 | 2720 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2565 | 2721 | |
| 2566 | 2722 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2567 | - if ($i % 2 == 0)  | 
                                                        |
| 2568 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2723 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2724 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2725 | + }  | 
                                                        |
| 2569 | 2726 | |
| 2570 | 2727 | $i++;  | 
                                                        
| 2571 | 2728 | }  | 
                                                        
@@ -2597,8 +2754,9 @@ discard block  | 
                                                    ||
| 2597 | 2754 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2598 | 2755 | |
| 2599 | 2756 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2600 | - if ($i % 2 == 0)  | 
                                                        |
| 2601 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2757 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2758 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2759 | + }  | 
                                                        |
| 2602 | 2760 | |
| 2603 | 2761 | $i++;  | 
                                                        
| 2604 | 2762 | }  | 
                                                        
@@ -2622,8 +2780,9 @@ discard block  | 
                                                    ||
| 2622 | 2780 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2623 | 2781 | |
| 2624 | 2782 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2625 | - if ($i % 2 == 0)  | 
                                                        |
| 2626 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2783 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2784 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2785 | + }  | 
                                                        |
| 2627 | 2786 | |
| 2628 | 2787 | $i++;  | 
                                                        
| 2629 | 2788 | }  | 
                                                        
@@ -2674,8 +2833,9 @@ discard block  | 
                                                    ||
| 2674 | 2833 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2675 | 2834 | |
| 2676 | 2835 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2677 | - if ($i % 2 == 0)  | 
                                                        |
| 2678 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2836 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2837 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2838 | + }  | 
                                                        |
| 2679 | 2839 | |
| 2680 | 2840 | $i++;  | 
                                                        
| 2681 | 2841 | }  | 
                                                        
@@ -2695,8 +2855,10 @@ discard block  | 
                                                    ||
| 2695 | 2855 | |
| 2696 | 2856 |                              if ($post->{$type['htmlvar_name']} == '1'):
 | 
                                                        
| 2697 | 2857 |                                  $html_val = __('Yes', 'geodirectory');
 | 
                                                        
| 2698 | - else:  | 
                                                        |
| 2699 | -                                $html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2858 | +                            else { | 
                                                        |
| 2859 | + :  | 
                                                        |
| 2860 | +                                $html_val = __('No', 'geodirectory'); | 
                                                        |
| 2861 | + }  | 
                                                        |
| 2700 | 2862 | endif;  | 
                                                        
| 2701 | 2863 | |
| 2702 | 2864 |                              if (strpos($field_icon, 'http') !== false) {
 | 
                                                        
@@ -2712,8 +2874,9 @@ discard block  | 
                                                    ||
| 2712 | 2874 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2713 | 2875 | |
| 2714 | 2876 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2715 | - if ($i % 2 == 0)  | 
                                                        |
| 2716 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2877 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2878 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2879 | + }  | 
                                                        |
| 2717 | 2880 | |
| 2718 | 2881 | $i++;  | 
                                                        
| 2719 | 2882 | }  | 
                                                        
@@ -2757,8 +2920,9 @@ discard block  | 
                                                    ||
| 2757 | 2920 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2758 | 2921 | |
| 2759 | 2922 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2760 | - if ($i % 2 == 0)  | 
                                                        |
| 2761 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2923 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2924 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2925 | + }  | 
                                                        |
| 2762 | 2926 | |
| 2763 | 2927 | $i++;  | 
                                                        
| 2764 | 2928 | }  | 
                                                        
@@ -2809,8 +2973,9 @@ discard block  | 
                                                    ||
| 2809 | 2973 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2810 | 2974 | |
| 2811 | 2975 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2812 | - if ($i % 2 == 0)  | 
                                                        |
| 2813 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2976 | +                                if ($i % 2 == 0) { | 
                                                        |
| 2977 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 2978 | + }  | 
                                                        |
| 2814 | 2979 | |
| 2815 | 2980 | $i++;  | 
                                                        
| 2816 | 2981 | }  | 
                                                        
@@ -2865,8 +3030,9 @@ discard block  | 
                                                    ||
| 2865 | 3030 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 2866 | 3031 | |
| 2867 | 3032 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2868 | - if ($i % 2 == 0)  | 
                                                        |
| 2869 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3033 | +                                if ($i % 2 == 0) { | 
                                                        |
| 3034 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3035 | + }  | 
                                                        |
| 2870 | 3036 | |
| 2871 | 3037 | $i++;  | 
                                                        
| 2872 | 3038 | }  | 
                                                        
@@ -2911,8 +3077,9 @@ discard block  | 
                                                    ||
| 2911 | 3077 |                                  if ($fields_location == 'detail') {
 | 
                                                        
| 2912 | 3078 | |
| 2913 | 3079 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 2914 | - if ($i % 2 == 0)  | 
                                                        |
| 2915 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3080 | +                                    if ($i % 2 == 0) { | 
                                                        |
| 3081 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3082 | + }  | 
                                                        |
| 2916 | 3083 | |
| 2917 | 3084 | $i++;  | 
                                                        
| 2918 | 3085 | }  | 
                                                        
@@ -2932,7 +3099,7 @@ discard block  | 
                                                    ||
| 2932 | 3099 | */  | 
                                                        
| 2933 | 3100 |                                      $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
 | 
                                                        
| 2934 | 3101 |                                      $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
 | 
                                                        
| 2935 | -                                }else{
 | 
                                                        |
| 3102 | +                                } else{
 | 
                                                        |
| 2936 | 3103 | $html .= $email;  | 
                                                        
| 2937 | 3104 | }  | 
                                                        
| 2938 | 3105 | $html .= '</span></div>';  | 
                                                        
@@ -3010,8 +3177,9 @@ discard block  | 
                                                    ||
| 3010 | 3177 |                                  if ($fields_location == 'detail') {
 | 
                                                        
| 3011 | 3178 | |
| 3012 | 3179 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 3013 | - if ($i % 2 == 0)  | 
                                                        |
| 3014 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3180 | +                                    if ($i % 2 == 0) { | 
                                                        |
| 3181 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3182 | + }  | 
                                                        |
| 3015 | 3183 | |
| 3016 | 3184 | $i++;  | 
                                                        
| 3017 | 3185 | }  | 
                                                        
@@ -3045,8 +3213,9 @@ discard block  | 
                                                    ||
| 3045 | 3213 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 3046 | 3214 | |
| 3047 | 3215 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 3048 | - if ($i % 2 == 0)  | 
                                                        |
| 3049 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3216 | +                                if ($i % 2 == 0) { | 
                                                        |
| 3217 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3218 | + }  | 
                                                        |
| 3050 | 3219 | |
| 3051 | 3220 | $i++;  | 
                                                        
| 3052 | 3221 | }  | 
                                                        
@@ -3074,8 +3243,9 @@ discard block  | 
                                                    ||
| 3074 | 3243 |                              if ($fields_location == 'detail') {
 | 
                                                        
| 3075 | 3244 | |
| 3076 | 3245 | $geodir_odd_even = 'geodir_more_info_odd';  | 
                                                        
| 3077 | - if ($i % 2 == 0)  | 
                                                        |
| 3078 | - $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3246 | +                                if ($i % 2 == 0) { | 
                                                        |
| 3247 | + $geodir_odd_even = 'geodir_more_info_even';  | 
                                                        |
| 3248 | + }  | 
                                                        |
| 3079 | 3249 | |
| 3080 | 3250 | $i++;  | 
                                                        
| 3081 | 3251 | }  | 
                                                        
@@ -3170,7 +3340,9 @@ discard block  | 
                                                    ||
| 3170 | 3340 | * @param string $html Custom field unfiltered HTML.  | 
                                                        
| 3171 | 3341 | * @param array $variables_array Custom field variables array.  | 
                                                        
| 3172 | 3342 | */  | 
                                                        
| 3173 | -                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
 | 
                                                        |
| 3343 | +                    if ($html) { | 
                                                        |
| 3344 | +                    	echo apply_filters("geodir_show_{$html_var}", $html, $variables_array); | 
                                                        |
| 3345 | + }  | 
                                                        |
| 3174 | 3346 | |
| 3175 | 3347 | /**  | 
                                                        
| 3176 | 3348 | * Called after a custom fields is output on the frontend.  | 
                                                        
@@ -3204,10 +3376,11 @@ discard block  | 
                                                    ||
| 3204 | 3376 | */  | 
                                                        
| 3205 | 3377 | function geodir_default_date_format()  | 
                                                        
| 3206 | 3378 |      {
 | 
                                                        
| 3207 | -        if ($format = get_option('date_format'))
 | 
                                                        |
| 3208 | - return $format;  | 
                                                        |
| 3209 | - else  | 
                                                        |
| 3210 | - return 'dd-mm-yy';  | 
                                                        |
| 3379 | +        if ($format = get_option('date_format')) { | 
                                                        |
| 3380 | + return $format;  | 
                                                        |
| 3381 | +        } else { | 
                                                        |
| 3382 | + return 'dd-mm-yy';  | 
                                                        |
| 3383 | + }  | 
                                                        |
| 3211 | 3384 | }  | 
                                                        
| 3212 | 3385 | }  | 
                                                        
| 3213 | 3386 | |
@@ -3314,11 +3487,13 @@ discard block  | 
                                                    ||
| 3314 | 3487 | // Set an array containing a list of acceptable formats  | 
                                                        
| 3315 | 3488 |                      //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
 | 
                                                        
| 3316 | 3489 | |
| 3317 | -                    if (!function_exists('wp_handle_upload'))
 | 
                                                        |
| 3318 | - require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 3490 | +                    if (!function_exists('wp_handle_upload')) { | 
                                                        |
| 3491 | + require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 3492 | + }  | 
                                                        |
| 3319 | 3493 | |
| 3320 | - if (!is_dir($geodir_uploadpath))  | 
                                                        |
| 3321 | - mkdir($geodir_uploadpath);  | 
                                                        |
| 3494 | +                    if (!is_dir($geodir_uploadpath)) { | 
                                                        |
| 3495 | + mkdir($geodir_uploadpath);  | 
                                                        |
| 3496 | + }  | 
                                                        |
| 3322 | 3497 | |
| 3323 | 3498 | $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];  | 
                                                        
| 3324 | 3499 |                      $explode_sub_dir = explode("/", $sub_dir);
 | 
                                                        
@@ -3331,16 +3506,19 @@ discard block  | 
                                                    ||
| 3331 | 3506 | }  | 
                                                        
| 3332 | 3507 | |
| 3333 | 3508 | $uploaded_file = '';  | 
                                                        
| 3334 | - if (file_exists($img_path))  | 
                                                        |
| 3335 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);  | 
                                                        |
| 3509 | +                    if (file_exists($img_path)) { | 
                                                        |
| 3510 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);  | 
                                                        |
| 3511 | + }  | 
                                                        |
| 3336 | 3512 | |
| 3337 | 3513 |                      if ($curr_img_dir != $geodir_uploaddir) {
 | 
                                                        
| 3338 | - if (file_exists($img_path))  | 
                                                        |
| 3339 | - unlink($img_path);  | 
                                                        |
| 3514 | +                        if (file_exists($img_path)) { | 
                                                        |
| 3515 | + unlink($img_path);  | 
                                                        |
| 3516 | + }  | 
                                                        |
| 3340 | 3517 | }  | 
                                                        
| 3341 | 3518 | |
| 3342 | - if (!empty($uploaded_file))  | 
                                                        |
| 3343 | - $file_urls = $geodir_uploadurl . '/' . $new_name;  | 
                                                        |
| 3519 | +                    if (!empty($uploaded_file)) { | 
                                                        |
| 3520 | + $file_urls = $geodir_uploadurl . '/' . $new_name;  | 
                                                        |
| 3521 | + }  | 
                                                        |
| 3344 | 3522 | |
| 3345 | 3523 |                  } else {
 | 
                                                        
| 3346 | 3524 | $file_urls = $post_image[$m];  | 
                                                        
@@ -3361,8 +3539,9 @@ discard block  | 
                                                    ||
| 3361 | 3539 | |
| 3362 | 3540 | geodir_save_post_meta($post_id, $field_id, $file_urls);  | 
                                                        
| 3363 | 3541 | |
| 3364 | - if (!empty($invalid_files))  | 
                                                        |
| 3365 | - geodir_remove_attachments($invalid_files);  | 
                                                        |
| 3542 | +        if (!empty($invalid_files)) { | 
                                                        |
| 3543 | + geodir_remove_attachments($invalid_files);  | 
                                                        |
| 3544 | + }  | 
                                                        |
| 3366 | 3545 | |
| 3367 | 3546 | }  | 
                                                        
| 3368 | 3547 | }  | 
                                                        
@@ -3588,8 +3767,9 @@ discard block  | 
                                                    ||
| 3588 | 3767 | |
| 3589 | 3768 | $all_postypes = geodir_get_posttypes();  | 
                                                        
| 3590 | 3769 | |
| 3591 | - if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 3592 | - return false;  | 
                                                        |
| 3770 | +        if (!in_array($post_type, $all_postypes)) { | 
                                                        |
| 3771 | + return false;  | 
                                                        |
| 3772 | + }  | 
                                                        |
| 3593 | 3773 | |
| 3594 | 3774 | $fields = array();  | 
                                                        
| 3595 | 3775 | |
@@ -3677,8 +3857,10 @@ discard block  | 
                                                    ||
| 3677 | 3857 | }  | 
                                                        
| 3678 | 3858 | |
| 3679 | 3859 | return $field_ids;  | 
                                                        
| 3680 | - else:  | 
                                                        |
| 3681 | - return false;  | 
                                                        |
| 3860 | +    else { | 
                                                        |
| 3861 | + :  | 
                                                        |
| 3862 | + return false;  | 
                                                        |
| 3863 | + }  | 
                                                        |
| 3682 | 3864 | endif;  | 
                                                        
| 3683 | 3865 | }  | 
                                                        
| 3684 | 3866 | |
@@ -3851,8 +4033,9 @@ discard block  | 
                                                    ||
| 3851 | 4033 | |
| 3852 | 4034 | return $field_id;  | 
                                                        
| 3853 | 4035 | |
| 3854 | - } else  | 
                                                        |
| 3855 | - return 0;  | 
                                                        |
| 4036 | +        } else { | 
                                                        |
| 4037 | + return 0;  | 
                                                        |
| 4038 | + }  | 
                                                        |
| 3856 | 4039 | |
| 3857 | 4040 | }  | 
                                                        
| 3858 | 4041 | }  | 
                                                        
@@ -3894,8 +4077,9 @@ discard block  | 
                                                    ||
| 3894 | 4077 | $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';  | 
                                                        
| 3895 | 4078 | |
| 3896 | 4079 | $site_title = '';  | 
                                                        
| 3897 | - if ($site_title == '')  | 
                                                        |
| 3898 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : '';  | 
                                                        |
| 4080 | +        if ($site_title == '') { | 
                                                        |
| 4081 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : '';  | 
                                                        |
| 4082 | + }  | 
                                                        |
| 3899 | 4083 | |
| 3900 | 4084 |          if ($site_title == '') {
 | 
                                                        
| 3901 | 4085 | $fields = geodir_get_custom_sort_options($post_type);  | 
                                                        
@@ -3909,8 +4093,9 @@ discard block  | 
                                                    ||
| 3909 | 4093 | }  | 
                                                        
| 3910 | 4094 | }  | 
                                                        
| 3911 | 4095 | |
| 3912 | - if ($htmlvar_name == '')  | 
                                                        |
| 3913 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';  | 
                                                        |
| 4096 | +        if ($htmlvar_name == '') { | 
                                                        |
| 4097 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';  | 
                                                        |
| 4098 | + }  | 
                                                        |
| 3914 | 4099 | |
| 3915 | 4100 |          $nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        
| 3916 | 4101 | |
@@ -18,9 +18,9 @@ discard block  | 
                                                    ||
| 18 | 18 | global $post_type;  | 
                                                        
| 19 | 19 | |
| 20 | 20 |  if (!isset($field_info->post_type)) {
 | 
                                                        
| 21 | - $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 21 | + $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        |
| 22 | 22 | } else  | 
                                                        
| 23 | - $post_type = $field_info->post_type;  | 
                                                        |
| 23 | + $post_type = $field_info->post_type;  | 
                                                        |
| 24 | 24 | |
| 25 | 25 | $field_info = stripslashes_deep($field_info); // strip slashes from labels  | 
                                                        
| 26 | 26 | |
@@ -28,7 +28,7 @@ discard block  | 
                                                    ||
| 28 | 28 | |
| 29 | 29 | $field_admin_title = '';  | 
                                                        
| 30 | 30 | if (isset($field_info->admin_title))  | 
                                                        
| 31 | - $field_admin_title = $field_info->admin_title;  | 
                                                        |
| 31 | + $field_admin_title = $field_info->admin_title;  | 
                                                        |
| 32 | 32 | |
| 33 | 33 | $default = isset($field_info->is_admin) ? $field_info->is_admin : '';  | 
                                                        
| 34 | 34 | |
@@ -47,8 +47,8 @@ discard block  | 
                                                    ||
| 47 | 47 |           ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
 | 
                                                        
| 48 | 48 | <?php  | 
                                                        
| 49 | 49 | |
| 50 | -        $nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 51 | - ?>  | 
                                                        |
| 50 | +		$nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 51 | + ?>  | 
                                                        |
| 52 | 52 | |
| 53 | 53 | <?php if ($default): ?>  | 
                                                        
| 54 | 54 |              <div title="<?php _e('Drag and drop to sort', 'geodirectory'); ?>" class="handlediv move"></div>
 | 
                                                        
@@ -57,42 +57,42 @@ discard block  | 
                                                    ||
| 57 | 57 |                   onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
 | 
                                                        
| 58 | 58 | class="handlediv close"></div>  | 
                                                        
| 59 | 59 | <?php endif;  | 
                                                        
| 60 | -        if ($field_type == 'fieldset') {
 | 
                                                        |
| 61 | - ?>  | 
                                                        |
| 60 | +		if ($field_type == 'fieldset') {
 | 
                                                        |
| 61 | + ?>  | 
                                                        |
| 62 | 62 | |
| 63 | 63 | <b style="cursor:pointer;"  | 
                                                        
| 64 | 64 |                 onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
 | 
                                                        
| 65 | 65 | <?php  | 
                                                        
| 66 | -        } else {
 | 
                                                        |
| 67 | - ?>  | 
                                                        |
| 66 | +		} else {
 | 
                                                        |
| 67 | + ?>  | 
                                                        |
| 68 | 68 | <b style="cursor:pointer;"  | 
                                                        
| 69 | 69 |                 onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
 | 
                                                        
| 70 | 70 | <?php  | 
                                                        
| 71 | - }  | 
                                                        |
| 72 | - ?>  | 
                                                        |
| 71 | + }  | 
                                                        |
| 72 | + ?>  | 
                                                        |
| 73 | 73 | </div>  | 
                                                        
| 74 | 74 | |
| 75 | 75 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm"  | 
                                                        
| 76 | 76 |           style="display:<?php if ($field_ins_upd == 'submit') {
 | 
                                                        
| 77 | - echo 'block;';  | 
                                                        |
| 78 | -         } else {
 | 
                                                        |
| 79 | - echo 'none;';  | 
                                                        |
| 80 | - } ?>">  | 
                                                        |
| 77 | + echo 'block;';  | 
                                                        |
| 78 | +		 } else {
 | 
                                                        |
| 79 | + echo 'none;';  | 
                                                        |
| 80 | + } ?>">  | 
                                                        |
| 81 | 81 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>  | 
                                                        
| 82 | 82 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>  | 
                                                        
| 83 | 83 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>  | 
                                                        
| 84 | 84 | <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>  | 
                                                        
| 85 | 85 |          <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
 | 
                                                        
| 86 | - echo $field_info->data_type;  | 
                                                        |
| 87 | - } ?>"/>  | 
                                                        |
| 86 | + echo $field_info->data_type;  | 
                                                        |
| 87 | + } ?>"/>  | 
                                                        |
| 88 | 88 | <input type="hidden" name="is_active" id="is_active" value="1"/>  | 
                                                        
| 89 | 89 | |
| 90 | 90 | <table class="widefat post fixed" border="0" style="width:100%;">  | 
                                                        
| 91 | 91 |              <?php if ($field_type != 'text' || $default) { ?>
 | 
                                                        
| 92 | 92 | |
| 93 | 93 |                  <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
 | 
                                                        
| 94 | - echo esc_attr($field_info->data_type);  | 
                                                        |
| 95 | - } ?>"/>  | 
                                                        |
| 94 | + echo esc_attr($field_info->data_type);  | 
                                                        |
| 95 | + } ?>"/>  | 
                                                        |
| 96 | 96 | |
| 97 | 97 |              <?php } else { ?>
 | 
                                                        
| 98 | 98 | |
@@ -104,16 +104,16 @@ discard block  | 
                                                    ||
| 104 | 104 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');">  | 
                                                        
| 105 | 105 | <option  | 
                                                        
| 106 | 106 |                                  value="XVARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
 | 
                                                        
| 107 | - echo 'selected="selected"';  | 
                                                        |
| 108 | -                            } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
 | 
                                                        |
| 107 | + echo 'selected="selected"';  | 
                                                        |
| 108 | +							} ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
 | 
                                                        |
| 109 | 109 | <option  | 
                                                        
| 110 | 110 |                                  value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
 | 
                                                        
| 111 | - echo 'selected="selected"';  | 
                                                        |
| 112 | -                            } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
 | 
                                                        |
| 111 | + echo 'selected="selected"';  | 
                                                        |
| 112 | +							} ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
 | 
                                                        |
| 113 | 113 | <option  | 
                                                        
| 114 | 114 |                                  value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
 | 
                                                        
| 115 | - echo 'selected="selected"';  | 
                                                        |
| 116 | -                            } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
 | 
                                                        |
| 115 | + echo 'selected="selected"';  | 
                                                        |
| 116 | +							} ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
 | 
                                                        |
| 117 | 117 | </select>  | 
                                                        
| 118 | 118 |                          <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
 | 
                                                        
| 119 | 119 | |
@@ -127,8 +127,8 @@ discard block  | 
                                                    ||
| 127 | 127 | <select name="decimal_point" id="decimal_point">  | 
                                                        
| 128 | 128 |                              <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
 | 
                                                        
| 129 | 129 |                              <?php for ($i = 1; $i <= 10; $i++) {
 | 
                                                        
| 130 | - $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';  | 
                                                        |
| 131 | - $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>  | 
                                                        |
| 130 | + $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : '';  | 
                                                        |
| 131 | + $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?>  | 
                                                        |
| 132 | 132 | <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>  | 
                                                        
| 133 | 133 | <?php } ?>  | 
                                                        
| 134 | 134 | </select>  | 
                                                        
@@ -143,8 +143,8 @@ discard block  | 
                                                    ||
| 143 | 143 | <td align="left">  | 
                                                        
| 144 | 144 | <input type="text" name="admin_title" id="admin_title"  | 
                                                        
| 145 | 145 |                             value="<?php if (isset($field_info->admin_title)) {
 | 
                                                        
| 146 | - echo esc_attr($field_info->admin_title);  | 
                                                        |
| 147 | - } ?>"/>  | 
                                                        |
| 146 | + echo esc_attr($field_info->admin_title);  | 
                                                        |
| 147 | + } ?>"/>  | 
                                                        |
| 148 | 148 |                      <br/><span><?php _e('Personal comment, it would not be displayed anywhere except in custom field settings', 'geodirectory'); ?></span>
 | 
                                                        
| 149 | 149 | </td>  | 
                                                        
| 150 | 150 | </tr>  | 
                                                        
@@ -153,8 +153,8 @@ discard block  | 
                                                    ||
| 153 | 153 | <td align="left">  | 
                                                        
| 154 | 154 | <input type="text" name="site_title" id="site_title"  | 
                                                        
| 155 | 155 |                             value="<?php if (isset($field_info->site_title)) {
 | 
                                                        
| 156 | - echo esc_attr($field_info->site_title);  | 
                                                        |
| 157 | - } ?>"/>  | 
                                                        |
| 156 | + echo esc_attr($field_info->site_title);  | 
                                                        |
| 157 | + } ?>"/>  | 
                                                        |
| 158 | 158 |                      <br/><span><?php _e('Section title which you wish to display in frontend', 'geodirectory'); ?></span>
 | 
                                                        
| 159 | 159 | </td>  | 
                                                        
| 160 | 160 | </tr>  | 
                                                        
@@ -163,23 +163,23 @@ discard block  | 
                                                    ||
| 163 | 163 | <td align="left">  | 
                                                        
| 164 | 164 | <input type="text" name="admin_desc" id="admin_desc"  | 
                                                        
| 165 | 165 |                             value="<?php if (isset($field_info->admin_desc)) {
 | 
                                                        
| 166 | - echo esc_attr($field_info->admin_desc);  | 
                                                        |
| 167 | - } ?>"/>  | 
                                                        |
| 166 | + echo esc_attr($field_info->admin_desc);  | 
                                                        |
| 167 | + } ?>"/>  | 
                                                        |
| 168 | 168 |                      <br/><span><?php _e('Section description which will appear in frontend', 'geodirectory'); ?></span>
 | 
                                                        
| 169 | 169 | </td>  | 
                                                        
| 170 | 170 | </tr>  | 
                                                        
| 171 | 171 |              <?php if ($field_type != 'fieldset' && $field_type != 'taxonomy') {
 | 
                                                        
| 172 | - ?>  | 
                                                        |
| 172 | + ?>  | 
                                                        |
| 173 | 173 | |
| 174 | 174 | <tr>  | 
                                                        
| 175 | 175 |                      <td><strong><?php _e('HTML variable name :', 'geodirectory');?></strong></td>
 | 
                                                        
| 176 | 176 | <td align="left">  | 
                                                        
| 177 | 177 | <input type="text" name="htmlvar_name" id="htmlvar_name"  | 
                                                        
| 178 | 178 |                                 value="<?php if (isset($field_info->htmlvar_name)) {
 | 
                                                        
| 179 | -                                   echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1);
 | 
                                                        |
| 180 | -                               }?>" <?php if ($default) {
 | 
                                                        |
| 181 | - echo 'readonly="readonly"';  | 
                                                        |
| 182 | - }?> />  | 
                                                        |
| 179 | +								   echo preg_replace('/geodir_/', '', $field_info->htmlvar_name, 1);
 | 
                                                        |
| 180 | +							   }?>" <?php if ($default) {
 | 
                                                        |
| 181 | + echo 'readonly="readonly"';  | 
                                                        |
| 182 | + }?> />  | 
                                                        |
| 183 | 183 |                          <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory');?></span>
 | 
                                                        
| 184 | 184 |                          <br/> <span><?php _e('This should be a unique name', 'geodirectory');?></span>
 | 
                                                        
| 185 | 185 | <br/>  | 
                                                        
@@ -191,8 +191,8 @@ discard block  | 
                                                    ||
| 191 | 191 |                  <td><strong><?php _e('Admin label :', 'geodirectory'); ?></strong></td>
 | 
                                                        
| 192 | 192 | <td align="left"><input type="text" name="clabels" id="clabels"  | 
                                                        
| 193 | 193 |                                          value="<?php if (isset($field_info->clabels)) {
 | 
                                                        
| 194 | - echo esc_attr($field_info->clabels);  | 
                                                        |
| 195 | - } ?>"/>  | 
                                                        |
| 194 | + echo esc_attr($field_info->clabels);  | 
                                                        |
| 195 | + } ?>"/>  | 
                                                        |
| 196 | 196 | <br/>  | 
                                                        
| 197 | 197 |                      <span><?php _e('Section Title which will appear in backend', 'geodirectory'); ?></span>
 | 
                                                        
| 198 | 198 | </td>  | 
                                                        
@@ -223,8 +223,8 @@ discard block  | 
                                                    ||
| 223 | 223 |                  <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
 | 
                                                        
| 224 | 224 | <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"  | 
                                                        
| 225 | 225 |                                          value="<?php if (isset($field_info->sort_order)) {
 | 
                                                        
| 226 | - echo esc_attr($field_info->sort_order);  | 
                                                        |
| 227 | - } ?>"/>  | 
                                                        |
| 226 | + echo esc_attr($field_info->sort_order);  | 
                                                        |
| 227 | + } ?>"/>  | 
                                                        |
| 228 | 228 | <br/>  | 
                                                        
| 229 | 229 |                      <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
 | 
                                                        
| 230 | 230 | </td>  | 
                                                        
@@ -235,11 +235,11 @@ discard block  | 
                                                    ||
| 235 | 235 | <td align="left">  | 
                                                        
| 236 | 236 | <select name="is_default" id="is_default">  | 
                                                        
| 237 | 237 |                          <option value="0" <?php if (!isset($field_info->is_default) || $field_info->is_default == '0') {
 | 
                                                        
| 238 | - echo 'selected="selected"';  | 
                                                        |
| 239 | -                        } ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 238 | + echo 'selected="selected"';  | 
                                                        |
| 239 | +						} ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 240 | 240 |                          <option value="1" <?php if (isset($field_info->is_default) && $field_info->is_default == '1') {
 | 
                                                        
| 241 | - echo 'selected="selected"';  | 
                                                        |
| 242 | -                        } ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 241 | + echo 'selected="selected"';  | 
                                                        |
| 242 | +						} ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 243 | 243 | </select>  | 
                                                        
| 244 | 244 | <br/>  | 
                                                        
| 245 | 245 |                      <span><?php _e('Select yes or no. If no is selected then the field will be displayed as main form field or additional field', 'geodirectory'); ?></span>
 | 
                                                        
@@ -254,13 +254,13 @@ discard block  | 
                                                    ||
| 254 | 254 | <td>  | 
                                                        
| 255 | 255 | |
| 256 | 256 | <?php  | 
                                                        
| 257 | - $selected = '';  | 
                                                        |
| 258 | - if (isset($field_info->extra_fields))  | 
                                                        |
| 259 | - $advanced_editor = unserialize($field_info->extra_fields);  | 
                                                        |
| 257 | + $selected = '';  | 
                                                        |
| 258 | + if (isset($field_info->extra_fields))  | 
                                                        |
| 259 | + $advanced_editor = unserialize($field_info->extra_fields);  | 
                                                        |
| 260 | 260 | |
| 261 | -                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
 | 
                                                        |
| 262 | - $selected = 'checked="checked"';  | 
                                                        |
| 263 | - ?>  | 
                                                        |
| 261 | +					if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
 | 
                                                        |
| 262 | + $selected = 'checked="checked"';  | 
                                                        |
| 263 | + ?>  | 
                                                        |
| 264 | 264 | |
| 265 | 265 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor"  | 
                                                        
| 266 | 266 | value="1" <?php echo $selected; ?>/>  | 
                                                        
@@ -268,42 +268,42 @@ discard block  | 
                                                    ||
| 268 | 268 | </td>  | 
                                                        
| 269 | 269 | |
| 270 | 270 | </tr><?php  | 
                                                        
| 271 | - } ?>  | 
                                                        |
| 271 | + } ?>  | 
                                                        |
| 272 | 272 | |
| 273 | 273 | <?php  | 
                                                        
| 274 | 274 | |
| 275 | - $pricearr = array();  | 
                                                        |
| 276 | -            if (isset($field_info->packages) && $field_info->packages != '') {
 | 
                                                        |
| 277 | -                $pricearr = explode(',', trim($field_info->packages, ','));
 | 
                                                        |
| 278 | -            } else {
 | 
                                                        |
| 279 | - $package_info = array();  | 
                                                        |
| 275 | + $pricearr = array();  | 
                                                        |
| 276 | +			if (isset($field_info->packages) && $field_info->packages != '') {
 | 
                                                        |
| 277 | +				$pricearr = explode(',', trim($field_info->packages, ','));
 | 
                                                        |
| 278 | +			} else {
 | 
                                                        |
| 279 | + $package_info = array();  | 
                                                        |
| 280 | 280 | |
| 281 | - $package_info = geodir_post_package_info($package_info, '', $post_type);  | 
                                                        |
| 282 | - $pricearr[] = $package_info->pid;  | 
                                                        |
| 283 | - }  | 
                                                        |
| 281 | + $package_info = geodir_post_package_info($package_info, '', $post_type);  | 
                                                        |
| 282 | + $pricearr[] = $package_info->pid;  | 
                                                        |
| 283 | + }  | 
                                                        |
| 284 | 284 | |
| 285 | - ob_start()  | 
                                                        |
| 286 | - ?>  | 
                                                        |
| 285 | + ob_start()  | 
                                                        |
| 286 | + ?>  | 
                                                        |
| 287 | 287 | |
| 288 | 288 | <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">  | 
                                                        
| 289 | 289 | <?php  | 
                                                        
| 290 | -                if (!empty($pricearr)) {
 | 
                                                        |
| 291 | -                    foreach ($pricearr as $val) {
 | 
                                                        |
| 292 | - ?>  | 
                                                        |
| 290 | +				if (!empty($pricearr)) {
 | 
                                                        |
| 291 | +					foreach ($pricearr as $val) {
 | 
                                                        |
| 292 | + ?>  | 
                                                        |
| 293 | 293 | <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php  | 
                                                        
| 294 | - }  | 
                                                        |
| 295 | - }  | 
                                                        |
| 296 | - ?>  | 
                                                        |
| 294 | + }  | 
                                                        |
| 295 | + }  | 
                                                        |
| 296 | + ?>  | 
                                                        |
| 297 | 297 | </select>  | 
                                                        
| 298 | 298 | |
| 299 | 299 | <?php  | 
                                                        
| 300 | - $html = ob_get_clean();  | 
                                                        |
| 300 | + $html = ob_get_clean();  | 
                                                        |
| 301 | 301 | |
| 302 | 302 | /**  | 
                                                        
| 303 | 303 | * Filter the price packages list.  | 
                                                        
| 304 | 304 | *  | 
                                                        
| 305 | 305 | * Filter the price packages list in custom field form in admin  | 
                                                        
| 306 | - * custom fields settings.  | 
                                                        |
| 306 | + * custom fields settings.  | 
                                                        |
| 307 | 307 | *  | 
                                                        
| 308 | 308 | * @since 1.0.0  | 
                                                        
| 309 | 309 | *  | 
                                                        
@@ -312,26 +312,26 @@ discard block  | 
                                                    ||
| 312 | 312 | */  | 
                                                        
| 313 | 313 |  			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
 | 
                                                        
| 314 | 314 | |
| 315 | - ?>  | 
                                                        |
| 315 | + ?>  | 
                                                        |
| 316 | 316 | |
| 317 | 317 | <tr>  | 
                                                        
| 318 | 318 |                  <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
 | 
                                                        
| 319 | 319 | <td align="left">  | 
                                                        
| 320 | 320 | <select name="is_active" id="is_active">  | 
                                                        
| 321 | 321 |                          <option value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
 | 
                                                        
| 322 | - echo 'selected="selected"';  | 
                                                        |
| 323 | -                        } ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 322 | + echo 'selected="selected"';  | 
                                                        |
| 323 | +						} ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 324 | 324 | <option  | 
                                                        
| 325 | 325 |                              value="0" <?php if ((isset($field_info->is_active) && $field_info->is_active == '0') || !isset($field_info->is_active)) {
 | 
                                                        
| 326 | - echo 'selected="selected"';  | 
                                                        |
| 327 | -                        } ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 326 | + echo 'selected="selected"';  | 
                                                        |
| 327 | +						} ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 328 | 328 | </select>  | 
                                                        
| 329 | 329 | <br/>  | 
                                                        
| 330 | 330 |                      <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere', 'geodirectory'); ?></span>
 | 
                                                        
| 331 | 331 | </td>  | 
                                                        
| 332 | 332 | </tr>  | 
                                                        
| 333 | 333 |              <?php if (!$default) { /* field for admin use only */
 | 
                                                        
| 334 | - $for_admin_use = isset($field_info->for_admin_use) && $field_info->for_admin_use == '1' ? true : false; ?>  | 
                                                        |
| 334 | + $for_admin_use = isset($field_info->for_admin_use) && $field_info->for_admin_use == '1' ? true : false; ?>  | 
                                                        |
| 335 | 335 | <tr>  | 
                                                        
| 336 | 336 |                      <td><strong><?php _e('For admin use only? :', 'geodirectory'); ?></strong></td>
 | 
                                                        
| 337 | 337 | <td align="left">  | 
                                                        
@@ -353,12 +353,12 @@ discard block  | 
                                                    ||
| 353 | 353 | <select name="is_required" id="is_required">  | 
                                                        
| 354 | 354 | <option  | 
                                                        
| 355 | 355 |                                  value="1" <?php if (isset($field_info->is_required) && $field_info->is_required == '1') {
 | 
                                                        
| 356 | - echo 'selected="selected"';  | 
                                                        |
| 357 | -                            } ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 356 | + echo 'selected="selected"';  | 
                                                        |
| 357 | +							} ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 358 | 358 | <option  | 
                                                        
| 359 | 359 |                                  value="0" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {
 | 
                                                        
| 360 | - echo 'selected="selected"';  | 
                                                        |
| 361 | -                            } ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 360 | + echo 'selected="selected"';  | 
                                                        |
| 361 | +							} ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 362 | 362 | </select>  | 
                                                        
| 363 | 363 |                          <br/> <span><?php _e('Select yes to set field as required', 'geodirectory'); ?></span>
 | 
                                                        
| 364 | 364 | </td>  | 
                                                        
@@ -370,8 +370,8 @@ discard block  | 
                                                    ||
| 370 | 370 | <td align="left">  | 
                                                        
| 371 | 371 | <input type="text" name="required_msg" id="required_msg"  | 
                                                        
| 372 | 372 |                             value="<?php if (isset($field_info->required_msg)) {
 | 
                                                        
| 373 | - echo esc_attr($field_info->required_msg);  | 
                                                        |
| 374 | - } ?>"/>  | 
                                                        |
| 373 | + echo esc_attr($field_info->required_msg);  | 
                                                        |
| 374 | + } ?>"/>  | 
                                                        |
| 375 | 375 | <span>  | 
                                                        
| 376 | 376 |                          <?php _e('Enter text for error message if field required and have not full fill requirement.', 'geodirectory'); ?>
 | 
                                                        
| 377 | 377 | </span>  | 
                                                        
@@ -385,8 +385,8 @@ discard block  | 
                                                    ||
| 385 | 385 | <td align="left">  | 
                                                        
| 386 | 386 | <input type="text" name="validation_pattern" id="validation_pattern"  | 
                                                        
| 387 | 387 |                             value="<?php if (isset($field_info->validation_pattern)) {
 | 
                                                        
| 388 | - echo esc_attr($field_info->validation_pattern);  | 
                                                        |
| 389 | - } ?>"/>  | 
                                                        |
| 388 | + echo esc_attr($field_info->validation_pattern);  | 
                                                        |
| 389 | + } ?>"/>  | 
                                                        |
| 390 | 390 | <span>  | 
                                                        
| 391 | 391 |                          <?php _e('Enter regex expression for HTML5 pattern validation.', 'geodirectory'); ?>
 | 
                                                        
| 392 | 392 | </span>  | 
                                                        
@@ -399,8 +399,8 @@ discard block  | 
                                                    ||
| 399 | 399 | <td align="left">  | 
                                                        
| 400 | 400 | <input type="text" name="validation_msg" id="validation_msg"  | 
                                                        
| 401 | 401 |                             value="<?php if (isset($field_info->validation_msg)) {
 | 
                                                        
| 402 | - echo esc_attr($field_info->validation_msg);  | 
                                                        |
| 403 | - } ?>"/>  | 
                                                        |
| 402 | + echo esc_attr($field_info->validation_msg);  | 
                                                        |
| 403 | + } ?>"/>  | 
                                                        |
| 404 | 404 | <span>  | 
                                                        
| 405 | 405 |                          <?php _e('Enter a extra validation message to show to the user if validation fails.', 'geodirectory'); ?>
 | 
                                                        
| 406 | 406 | </span>  | 
                                                        
@@ -415,12 +415,12 @@ discard block  | 
                                                    ||
| 415 | 415 | <select name="show_on_listing" id="show_on_listing">  | 
                                                        
| 416 | 416 | <option  | 
                                                        
| 417 | 417 |                              value="1" <?php if (isset($field_info->show_on_listing) && $field_info->show_on_listing == '1') {
 | 
                                                        
| 418 | - echo 'selected="selected"';  | 
                                                        |
| 419 | -                        } ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 418 | + echo 'selected="selected"';  | 
                                                        |
| 419 | +						} ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 420 | 420 | <option  | 
                                                        
| 421 | 421 |                              value="0" <?php if ((isset($field_info->show_on_listing) && ($field_info->show_on_listing == '0' || $field_info->show_on_listing == '')) || !isset($field_info->show_on_listing)) {
 | 
                                                        
| 422 | - echo 'selected="selected"';  | 
                                                        |
| 423 | -                        } ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 422 | + echo 'selected="selected"';  | 
                                                        |
| 423 | +						} ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 424 | 424 | </select>  | 
                                                        
| 425 | 425 |                      <br/> <span><?php _e('Want to show this on listing page ?', 'geodirectory'); ?></span>
 | 
                                                        
| 426 | 426 | </td>  | 
                                                        
@@ -432,12 +432,12 @@ discard block  | 
                                                    ||
| 432 | 432 | <select name="show_on_detail" id="show_on_detail">  | 
                                                        
| 433 | 433 | <option  | 
                                                        
| 434 | 434 |                              value="1" <?php if (isset($field_info->show_on_detail) && $field_info->show_on_detail == '1') {
 | 
                                                        
| 435 | - echo 'selected="selected"';  | 
                                                        |
| 436 | -                        } ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 435 | + echo 'selected="selected"';  | 
                                                        |
| 436 | +						} ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 437 | 437 | <option  | 
                                                        
| 438 | 438 |                              value="0" <?php if ((isset($field_info->show_on_detail) && ($field_info->show_on_detail == '0' || $field_info->show_on_detail == '')) || !isset($field_info->show_on_detail)) {
 | 
                                                        
| 439 | - echo 'selected="selected"';  | 
                                                        |
| 440 | -                        } ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 439 | + echo 'selected="selected"';  | 
                                                        |
| 440 | +						} ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 441 | 441 | </select>  | 
                                                        
| 442 | 442 | <br/>  | 
                                                        
| 443 | 443 |                      <span><?php _e('Want to show this in More Info tab on detail page?', 'geodirectory'); ?></span>
 | 
                                                        
@@ -450,12 +450,12 @@ discard block  | 
                                                    ||
| 450 | 450 | <select name="show_as_tab" id="show_as_tab">  | 
                                                        
| 451 | 451 | <option  | 
                                                        
| 452 | 452 |                                  value="1" <?php if (isset($field_info->show_as_tab) && $field_info->show_as_tab == '1') {
 | 
                                                        
| 453 | - echo 'selected="selected"';  | 
                                                        |
| 454 | -                            } ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 453 | + echo 'selected="selected"';  | 
                                                        |
| 454 | +							} ?>><?php _e('Yes', 'geodirectory'); ?></option>
 | 
                                                        |
| 455 | 455 | <option  | 
                                                        
| 456 | 456 |                                  value="0" <?php if ((isset($field_info->show_as_tab) && ($field_info->show_as_tab == '0' || $field_info->show_as_tab == '')) || !isset($field_info->show_as_tab)) {
 | 
                                                        
| 457 | - echo 'selected="selected"';  | 
                                                        |
| 458 | -                            } ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 457 | + echo 'selected="selected"';  | 
                                                        |
| 458 | +							} ?>><?php _e('No', 'geodirectory'); ?></option>
 | 
                                                        |
| 459 | 459 | </select>  | 
                                                        
| 460 | 460 |                          <br/><span><?php _e('Want to display this as a tab on detail page? If "Yes" then "Show on detail page?" must be Yes.', 'geodirectory'); ?></span>
 | 
                                                        
| 461 | 461 | </td>  | 
                                                        
@@ -464,23 +464,23 @@ discard block  | 
                                                    ||
| 464 | 464 | |
| 465 | 465 | <?php  | 
                                                        
| 466 | 466 | |
| 467 | - switch ($field_type):  | 
                                                        |
| 468 | -                case 'taxonomy': {
 | 
                                                        |
| 469 | - ?>  | 
                                                        |
| 467 | + switch ($field_type):  | 
                                                        |
| 468 | +				case 'taxonomy': {
 | 
                                                        |
| 469 | + ?>  | 
                                                        |
| 470 | 470 | <tr>  | 
                                                        
| 471 | 471 |                          <td><strong><?php _e('Select taxonomy:', 'geodirectory');?></strong></td>
 | 
                                                        
| 472 | 472 | <td align="left">  | 
                                                        
| 473 | 473 | <select name="htmlvar_name" id="htmlvar_name">  | 
                                                        
| 474 | 474 | <?php  | 
                                                        
| 475 | - $gd_taxonomy = geodir_get_taxonomies($post_type);  | 
                                                        |
| 475 | + $gd_taxonomy = geodir_get_taxonomies($post_type);  | 
                                                        |
| 476 | 476 | |
| 477 | -                                foreach ($gd_taxonomy as $gd_tax) {
 | 
                                                        |
| 478 | - ?>  | 
                                                        |
| 477 | +								foreach ($gd_taxonomy as $gd_tax) {
 | 
                                                        |
| 478 | + ?>  | 
                                                        |
| 479 | 479 |                                      <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
 | 
                                                        
| 480 | - echo 'selected="selected"';  | 
                                                        |
| 481 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php  | 
                                                        |
| 482 | - }  | 
                                                        |
| 483 | - ?>  | 
                                                        |
| 480 | + echo 'selected="selected"';  | 
                                                        |
| 481 | + }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php  | 
                                                        |
| 482 | + }  | 
                                                        |
| 483 | + ?>  | 
                                                        |
| 484 | 484 | </select>  | 
                                                        
| 485 | 485 | |
| 486 | 486 | <br/>  | 
                                                        
@@ -494,20 +494,20 @@ discard block  | 
                                                    ||
| 494 | 494 | |
| 495 | 495 | <select name="cat_display_type" id="cat_display_type">  | 
                                                        
| 496 | 496 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
 | 
                                                        
| 497 | - echo 'selected="selected"';  | 
                                                        |
| 498 | -                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
 | 
                                                        |
| 497 | + echo 'selected="selected"';  | 
                                                        |
| 498 | +								}?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
 | 
                                                        |
| 499 | 499 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
 | 
                                                        
| 500 | - echo 'selected="selected"';  | 
                                                        |
| 501 | -                                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
 | 
                                                        |
| 500 | + echo 'selected="selected"';  | 
                                                        |
| 501 | +								}?> value="select"><?php _e('Select', 'geodirectory');?></option>
 | 
                                                        |
| 502 | 502 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
 | 
                                                        
| 503 | - echo 'selected="selected"';  | 
                                                        |
| 504 | -                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
 | 
                                                        |
| 503 | + echo 'selected="selected"';  | 
                                                        |
| 504 | +								}?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
 | 
                                                        |
| 505 | 505 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
 | 
                                                        
| 506 | - echo 'selected="selected"';  | 
                                                        |
| 507 | -                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
 | 
                                                        |
| 506 | + echo 'selected="selected"';  | 
                                                        |
| 507 | +								}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
 | 
                                                        |
| 508 | 508 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
 | 
                                                        
| 509 | - echo 'selected="selected"';  | 
                                                        |
| 510 | -                                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
 | 
                                                        |
| 509 | + echo 'selected="selected"';  | 
                                                        |
| 510 | +								}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
 | 
                                                        |
| 511 | 511 | </select>  | 
                                                        
| 512 | 512 | |
| 513 | 513 | <br/>  | 
                                                        
@@ -515,29 +515,29 @@ discard block  | 
                                                    ||
| 515 | 515 | </td>  | 
                                                        
| 516 | 516 | </tr>  | 
                                                        
| 517 | 517 | <?php } // end of additional field for taxonomy field type  | 
                                                        
| 518 | - break;  | 
                                                        |
| 519 | -                case 'address': {
 | 
                                                        |
| 520 | -                    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
 | 
                                                        |
| 521 | - $address = unserialize($field_info->extra_fields);  | 
                                                        |
| 522 | - }  | 
                                                        |
| 523 | - ?>  | 
                                                        |
| 518 | + break;  | 
                                                        |
| 519 | +				case 'address': {
 | 
                                                        |
| 520 | +					if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
 | 
                                                        |
| 521 | + $address = unserialize($field_info->extra_fields);  | 
                                                        |
| 522 | + }  | 
                                                        |
| 523 | + ?>  | 
                                                        |
| 524 | 524 | <?php  | 
                                                        
| 525 | - /**  | 
                                                        |
| 526 | - * Called on the add custom fields settings page before the address field is output.  | 
                                                        |
| 527 | - *  | 
                                                        |
| 528 | - * @since 1.0.0  | 
                                                        |
| 529 | - * @param array $address The address settings array.  | 
                                                        |
| 530 | - * @param object $field_info Extra fileds info.  | 
                                                        |
| 531 | - */  | 
                                                        |
| 532 | -                    do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
 | 
                                                        |
| 525 | + /**  | 
                                                        |
| 526 | + * Called on the add custom fields settings page before the address field is output.  | 
                                                        |
| 527 | + *  | 
                                                        |
| 528 | + * @since 1.0.0  | 
                                                        |
| 529 | + * @param array $address The address settings array.  | 
                                                        |
| 530 | + * @param object $field_info Extra fileds info.  | 
                                                        |
| 531 | + */  | 
                                                        |
| 532 | +					do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
 | 
                                                        |
| 533 | 533 | |
| 534 | 534 | <tr>  | 
                                                        
| 535 | 535 |                          <td><strong><?php _e('Display zip/post code :', 'geodirectory');?></strong></td>
 | 
                                                        
| 536 | 536 | <td align="left">  | 
                                                        
| 537 | 537 | <input type="checkbox" name="extra[show_zip]" id="show_zip"  | 
                                                        
| 538 | 538 |                                     value="1" <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
 | 
                                                        
| 539 | - echo 'checked="checked"';  | 
                                                        |
| 540 | - }?>/>  | 
                                                        |
| 539 | + echo 'checked="checked"';  | 
                                                        |
| 540 | + }?>/>  | 
                                                        |
| 541 | 541 |                              <span><?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?></span>
 | 
                                                        
| 542 | 542 | </td>  | 
                                                        
| 543 | 543 | </tr>  | 
                                                        
@@ -547,8 +547,8 @@ discard block  | 
                                                    ||
| 547 | 547 | <td align="left">  | 
                                                        
| 548 | 548 | <input type="text" name="extra[zip_lable]" id="zip_lable"  | 
                                                        
| 549 | 549 |                                     value="<?php if (isset($address['zip_lable'])) {
 | 
                                                        
| 550 | - echo esc_attr($address['zip_lable']);  | 
                                                        |
| 551 | - }?>"/>  | 
                                                        |
| 550 | + echo esc_attr($address['zip_lable']);  | 
                                                        |
| 551 | + }?>"/>  | 
                                                        |
| 552 | 552 |                              <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory');?></span>
 | 
                                                        
| 553 | 553 | </td>  | 
                                                        
| 554 | 554 | </tr>  | 
                                                        
@@ -558,8 +558,8 @@ discard block  | 
                                                    ||
| 558 | 558 | <td align="left">  | 
                                                        
| 559 | 559 | <input type="checkbox" name="extra[show_map]" id="show_map"  | 
                                                        
| 560 | 560 |                                     value="1" <?php if (isset($address['show_map']) && $address['show_map'] == '1') {
 | 
                                                        
| 561 | - echo 'checked="checked"';  | 
                                                        |
| 562 | - }?>/>  | 
                                                        |
| 561 | + echo 'checked="checked"';  | 
                                                        |
| 562 | + }?>/>  | 
                                                        |
| 563 | 563 |                              <span><?php _e('Select if you want to `set address on map` field in address section.', 'geodirectory');?></span>
 | 
                                                        
| 564 | 564 | </td>  | 
                                                        
| 565 | 565 | </tr>  | 
                                                        
@@ -569,8 +569,8 @@ discard block  | 
                                                    ||
| 569 | 569 | <td align="left">  | 
                                                        
| 570 | 570 | <input type="text" name="extra[map_lable]" id="map_lable"  | 
                                                        
| 571 | 571 |                                     value="<?php if (isset($address['map_lable'])) {
 | 
                                                        
| 572 | - echo esc_attr($address['map_lable']);  | 
                                                        |
| 573 | - }?>"/>  | 
                                                        |
| 572 | + echo esc_attr($address['map_lable']);  | 
                                                        |
| 573 | + }?>"/>  | 
                                                        |
| 574 | 574 |                              <span><?php _e('Enter text for  `set address on map` button in address section.', 'geodirectory');?></span>
 | 
                                                        
| 575 | 575 | </td>  | 
                                                        
| 576 | 576 | </tr>  | 
                                                        
@@ -580,8 +580,8 @@ discard block  | 
                                                    ||
| 580 | 580 | <td align="left">  | 
                                                        
| 581 | 581 | <input type="checkbox" name="extra[show_mapzoom]" id="show_mapzoom"  | 
                                                        
| 582 | 582 |                                     value="1" <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
 | 
                                                        
| 583 | - echo 'checked="checked"';  | 
                                                        |
| 584 | - }?>/>  | 
                                                        |
| 583 | + echo 'checked="checked"';  | 
                                                        |
| 584 | + }?>/>  | 
                                                        |
| 585 | 585 |                              <span><?php _e('Select if you want to use the user defined map zoom level.', 'geodirectory');?></span>
 | 
                                                        
| 586 | 586 | </td>  | 
                                                        
| 587 | 587 | </tr>  | 
                                                        
@@ -591,8 +591,8 @@ discard block  | 
                                                    ||
| 591 | 591 | <td align="left">  | 
                                                        
| 592 | 592 | <input type="checkbox" name="extra[show_mapview]" id="show_mapview"  | 
                                                        
| 593 | 593 |                                     value="1" <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
 | 
                                                        
| 594 | - echo 'checked="checked"';  | 
                                                        |
| 595 | - }?>/>  | 
                                                        |
| 594 | + echo 'checked="checked"';  | 
                                                        |
| 595 | + }?>/>  | 
                                                        |
| 596 | 596 |                              <span><?php _e('Select if you want to `set default map` options in address section.', 'geodirectory');?></span>
 | 
                                                        
| 597 | 597 | </td>  | 
                                                        
| 598 | 598 | </tr>  | 
                                                        
@@ -603,8 +603,8 @@ discard block  | 
                                                    ||
| 603 | 603 | <td align="left">  | 
                                                        
| 604 | 604 | <input type="text" name="extra[mapview_lable]" id="mapview_lable"  | 
                                                        
| 605 | 605 |                                     value="<?php if (isset($address['mapview_lable'])) {
 | 
                                                        
| 606 | - echo esc_attr($address['mapview_lable']);  | 
                                                        |
| 607 | - }?>"/>  | 
                                                        |
| 606 | + echo esc_attr($address['mapview_lable']);  | 
                                                        |
| 607 | + }?>"/>  | 
                                                        |
| 608 | 608 |                              <span><?php _e('Enter mapview field label in address section.', 'geodirectory');?></span>
 | 
                                                        
| 609 | 609 | </td>  | 
                                                        
| 610 | 610 | </tr>  | 
                                                        
@@ -615,33 +615,33 @@ discard block  | 
                                                    ||
| 615 | 615 | <td align="left">  | 
                                                        
| 616 | 616 | <input type="checkbox" name="extra[show_latlng]" id="show_latlng"  | 
                                                        
| 617 | 617 |                                     value="1" <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
 | 
                                                        
| 618 | - echo 'checked="checked"';  | 
                                                        |
| 619 | - }?>/>  | 
                                                        |
| 618 | + echo 'checked="checked"';  | 
                                                        |
| 619 | + }?>/>  | 
                                                        |
| 620 | 620 |                              <span><?php _e('Select if you want to show latitude and logatude fields in address section from front-end.', 'geodirectory');?></span>
 | 
                                                        
| 621 | 621 | </td>  | 
                                                        
| 622 | 622 | </tr>  | 
                                                        
| 623 | 623 | <?php } // end of extra fields for address field type  | 
                                                        
| 624 | - break;  | 
                                                        |
| 625 | - case 'select':  | 
                                                        |
| 626 | - case 'multiselect':  | 
                                                        |
| 627 | -                case 'radio' : {
 | 
                                                        |
| 628 | -                    if ($field_type == 'multiselect') {
 | 
                                                        |
| 624 | + break;  | 
                                                        |
| 625 | + case 'select':  | 
                                                        |
| 626 | + case 'multiselect':  | 
                                                        |
| 627 | +				case 'radio' : {
 | 
                                                        |
| 628 | +					if ($field_type == 'multiselect') {
 | 
                                                        |
| 629 | 629 | |
| 630 | - ?>  | 
                                                        |
| 630 | + ?>  | 
                                                        |
| 631 | 631 | <tr>  | 
                                                        
| 632 | 632 |                              <td><strong><?php _e('Multiselect display type :', 'geodirectory');?></strong></td>
 | 
                                                        
| 633 | 633 | <td align="left">  | 
                                                        
| 634 | 634 | |
| 635 | 635 | <select name="multi_display_type" id="multi_display_type">  | 
                                                        
| 636 | 636 |                                      <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
 | 
                                                        
| 637 | - echo 'selected="selected"';  | 
                                                        |
| 638 | -                                    }?> value="select"><?php _e('Select', 'geodirectory');?></option>
 | 
                                                        |
| 637 | + echo 'selected="selected"';  | 
                                                        |
| 638 | +									}?> value="select"><?php _e('Select', 'geodirectory');?></option>
 | 
                                                        |
| 639 | 639 |                                      <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
 | 
                                                        
| 640 | - echo 'selected="selected"';  | 
                                                        |
| 641 | -                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
 | 
                                                        |
| 640 | + echo 'selected="selected"';  | 
                                                        |
| 641 | +									}?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
 | 
                                                        |
| 642 | 642 |                                      <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
 | 
                                                        
| 643 | - echo 'selected="selected"';  | 
                                                        |
| 644 | -                                    }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
 | 
                                                        |
| 643 | + echo 'selected="selected"';  | 
                                                        |
| 644 | +									}?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
 | 
                                                        |
| 645 | 645 | </select>  | 
                                                        
| 646 | 646 | |
| 647 | 647 | <br/>  | 
                                                        
@@ -649,15 +649,15 @@ discard block  | 
                                                    ||
| 649 | 649 | </td>  | 
                                                        
| 650 | 650 | </tr>  | 
                                                        
| 651 | 651 | <?php  | 
                                                        
| 652 | - }  | 
                                                        |
| 653 | - ?>  | 
                                                        |
| 652 | + }  | 
                                                        |
| 653 | + ?>  | 
                                                        |
| 654 | 654 | <tr>  | 
                                                        
| 655 | 655 |                          <td><strong><?php _e('Option Values :', 'geodirectory');?></strong></td>
 | 
                                                        
| 656 | 656 | <td align="left">  | 
                                                        
| 657 | 657 | <input type="text" name="option_values" id="option_values"  | 
                                                        
| 658 | 658 |                                     value="<?php if (isset($field_info->option_values)) {
 | 
                                                        
| 659 | - echo esc_attr($field_info->option_values);  | 
                                                        |
| 660 | - }?>"/>  | 
                                                        |
| 659 | + echo esc_attr($field_info->option_values);  | 
                                                        |
| 660 | + }?>"/>  | 
                                                        |
| 661 | 661 | <br/>  | 
                                                        
| 662 | 662 |                              <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
 | 
                                                        
| 663 | 663 | <br/>  | 
                                                        
@@ -673,52 +673,52 @@ discard block  | 
                                                    ||
| 673 | 673 | </td>  | 
                                                        
| 674 | 674 | </tr>  | 
                                                        
| 675 | 675 | <?php  | 
                                                        
| 676 | - } // end of extra fields for select , multiselect and radio type fields  | 
                                                        |
| 677 | - break;  | 
                                                        |
| 678 | -                case 'datepicker': {
 | 
                                                        |
| 679 | -                    if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
 | 
                                                        |
| 680 | - $extra = unserialize($field_info->extra_fields);  | 
                                                        |
| 681 | - }  | 
                                                        |
| 682 | - ?>  | 
                                                        |
| 676 | + } // end of extra fields for select , multiselect and radio type fields  | 
                                                        |
| 677 | + break;  | 
                                                        |
| 678 | +				case 'datepicker': {
 | 
                                                        |
| 679 | +					if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
 | 
                                                        |
| 680 | + $extra = unserialize($field_info->extra_fields);  | 
                                                        |
| 681 | + }  | 
                                                        |
| 682 | + ?>  | 
                                                        |
| 683 | 683 | <tr>  | 
                                                        
| 684 | 684 |                          <td><strong><?php _e('Date Format :', 'geodirectory');?></strong></td>
 | 
                                                        
| 685 | 685 | <td align="left" style="overflow:inherit;">  | 
                                                        
| 686 | 686 | <?php  | 
                                                        
| 687 | - $date_formats = array(  | 
                                                        |
| 688 | - 'm/d/Y',  | 
                                                        |
| 689 | - 'd/m/Y',  | 
                                                        |
| 690 | - 'Y/m/d',  | 
                                                        |
| 691 | - 'm-d-Y',  | 
                                                        |
| 692 | - 'd-m-Y',  | 
                                                        |
| 693 | - 'Y-m-d',  | 
                                                        |
| 694 | - 'F j, Y',  | 
                                                        |
| 695 | - );  | 
                                                        |
| 696 | - /**  | 
                                                        |
| 697 | - * Filter the custom field date format options.  | 
                                                        |
| 698 | - *  | 
                                                        |
| 699 | - * @since 1.6.5  | 
                                                        |
| 700 | - * @param array $date_formats The PHP date format array.  | 
                                                        |
| 701 | - */  | 
                                                        |
| 702 | -                            $date_formats = apply_filters('geodir_date_formats',$date_formats);
 | 
                                                        |
| 703 | - ?>  | 
                                                        |
| 687 | + $date_formats = array(  | 
                                                        |
| 688 | + 'm/d/Y',  | 
                                                        |
| 689 | + 'd/m/Y',  | 
                                                        |
| 690 | + 'Y/m/d',  | 
                                                        |
| 691 | + 'm-d-Y',  | 
                                                        |
| 692 | + 'd-m-Y',  | 
                                                        |
| 693 | + 'Y-m-d',  | 
                                                        |
| 694 | + 'F j, Y',  | 
                                                        |
| 695 | + );  | 
                                                        |
| 696 | + /**  | 
                                                        |
| 697 | + * Filter the custom field date format options.  | 
                                                        |
| 698 | + *  | 
                                                        |
| 699 | + * @since 1.6.5  | 
                                                        |
| 700 | + * @param array $date_formats The PHP date format array.  | 
                                                        |
| 701 | + */  | 
                                                        |
| 702 | +							$date_formats = apply_filters('geodir_date_formats',$date_formats);
 | 
                                                        |
| 703 | + ?>  | 
                                                        |
| 704 | 704 | <select name="extra[date_format]" id="date_format">  | 
                                                        
| 705 | 705 | <?php  | 
                                                        
| 706 | -                                foreach($date_formats as $format){
 | 
                                                        |
| 707 | - $selected = '';  | 
                                                        |
| 708 | -                                    if(esc_attr($extra['date_format'])==$format){
 | 
                                                        |
| 709 | - $selected = "selected='selected'";  | 
                                                        |
| 710 | - }  | 
                                                        |
| 711 | -                                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
 | 
                                                        |
| 712 | - }  | 
                                                        |
| 713 | - ?>  | 
                                                        |
| 706 | +								foreach($date_formats as $format){
 | 
                                                        |
| 707 | + $selected = '';  | 
                                                        |
| 708 | +									if(esc_attr($extra['date_format'])==$format){
 | 
                                                        |
| 709 | + $selected = "selected='selected'";  | 
                                                        |
| 710 | + }  | 
                                                        |
| 711 | +									echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
 | 
                                                        |
| 712 | + }  | 
                                                        |
| 713 | + ?>  | 
                                                        |
| 714 | 714 | </select>  | 
                                                        
| 715 | 715 | |
| 716 | 716 |                              <span><?php _e('Select the date format.', 'geodirectory');?></span>
 | 
                                                        
| 717 | 717 | </td>  | 
                                                        
| 718 | 718 | </tr>  | 
                                                        
| 719 | 719 | <?php  | 
                                                        
| 720 | - }  | 
                                                        |
| 721 | - break;  | 
                                                        |
| 720 | + }  | 
                                                        |
| 721 | + break;  | 
                                                        |
| 722 | 722 |  				case 'file': {
 | 
                                                        
| 723 | 723 | $allowed_file_types = geodir_allowed_mime_types();  | 
                                                        
| 724 | 724 | |
@@ -746,9 +746,9 @@ discard block  | 
                                                    ||
| 746 | 746 | }  | 
                                                        
| 747 | 747 | break;  | 
                                                        
| 748 | 748 | |
| 749 | - endswitch; ?>  | 
                                                        |
| 749 | + endswitch; ?>  | 
                                                        |
| 750 | 750 |              <?php if ($field_type != 'fieldset') {
 | 
                                                        
| 751 | - ?>  | 
                                                        |
| 751 | + ?>  | 
                                                        |
| 752 | 752 | <tr>  | 
                                                        
| 753 | 753 |                      <td colspan="2" align="left"><h3><?php echo __('Custom css', 'geodirectory'); ?></h3></td>
 | 
                                                        
| 754 | 754 | </tr>  | 
                                                        
@@ -758,8 +758,8 @@ discard block  | 
                                                    ||
| 758 | 758 | <td align="left">  | 
                                                        
| 759 | 759 | <input type="text" name="field_icon" id="field_icon"  | 
                                                        
| 760 | 760 |                                 value="<?php if (isset($field_info->field_icon)) {
 | 
                                                        
| 761 | - echo $field_info->field_icon;  | 
                                                        |
| 762 | - }?>"/>  | 
                                                        |
| 761 | + echo $field_info->field_icon;  | 
                                                        |
| 762 | + }?>"/>  | 
                                                        |
| 763 | 763 | <span>  | 
                                                        
| 764 | 764 |                          <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
 | 
                                                        
| 765 | 765 | </span>  | 
                                                        
@@ -772,8 +772,8 @@ discard block  | 
                                                    ||
| 772 | 772 | <td align="left">  | 
                                                        
| 773 | 773 | <input type="text" name="css_class" id="css_class"  | 
                                                        
| 774 | 774 |                                 value="<?php if (isset($field_info->css_class)) {
 | 
                                                        
| 775 | - echo esc_attr($field_info->css_class);  | 
                                                        |
| 776 | - }?>"/>  | 
                                                        |
| 775 | + echo esc_attr($field_info->css_class);  | 
                                                        |
| 776 | + }?>"/>  | 
                                                        |
| 777 | 777 | <span>  | 
                                                        
| 778 | 778 |                          <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
 | 
                                                        
| 779 | 779 | </span>  | 
                                                        
@@ -781,19 +781,19 @@ discard block  | 
                                                    ||
| 781 | 781 | </td>  | 
                                                        
| 782 | 782 | </tr>  | 
                                                        
| 783 | 783 | <?php  | 
                                                        
| 784 | - }  | 
                                                        |
| 785 | - ?>  | 
                                                        |
| 784 | + }  | 
                                                        |
| 785 | + ?>  | 
                                                        |
| 786 | 786 | |
| 787 | 787 | <?php  | 
                                                        
| 788 | 788 | |
| 789 | - switch ($field_type):  | 
                                                        |
| 790 | - case 'html':  | 
                                                        |
| 791 | - case 'file':  | 
                                                        |
| 792 | - case 'url':  | 
                                                        |
| 793 | - case 'fieldset':  | 
                                                        |
| 794 | - break;  | 
                                                        |
| 795 | - default:  | 
                                                        |
| 796 | - ?>  | 
                                                        |
| 789 | + switch ($field_type):  | 
                                                        |
| 790 | + case 'html':  | 
                                                        |
| 791 | + case 'file':  | 
                                                        |
| 792 | + case 'url':  | 
                                                        |
| 793 | + case 'fieldset':  | 
                                                        |
| 794 | + break;  | 
                                                        |
| 795 | + default:  | 
                                                        |
| 796 | + ?>  | 
                                                        |
| 797 | 797 | |
| 798 | 798 | <tr>  | 
                                                        
| 799 | 799 | <td colspan="2" align="left">  | 
                                                        
@@ -811,7 +811,7 @@ discard block  | 
                                                    ||
| 811 | 811 | */  | 
                                                        
| 812 | 812 |  								echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
 | 
                                                        
| 813 | 813 | |
| 814 | - ?></h3>  | 
                                                        |
| 814 | + ?></h3>  | 
                                                        |
| 815 | 815 | </td>  | 
                                                        
| 816 | 816 | </tr>  | 
                                                        
| 817 | 817 | |
@@ -821,23 +821,23 @@ discard block  | 
                                                    ||
| 821 | 821 | <td>:  | 
                                                        
| 822 | 822 | <input type="checkbox" name="cat_sort[]" id="cat_sort"  | 
                                                        
| 823 | 823 |                                     value="1" <?php if (isset($field_info->cat_sort[0]) && $field_info->cat_sort[0] == '1') {
 | 
                                                        
| 824 | - echo 'checked="checked"';  | 
                                                        |
| 825 | - } ?>/>  | 
                                                        |
| 824 | + echo 'checked="checked"';  | 
                                                        |
| 825 | + } ?>/>  | 
                                                        |
| 826 | 826 |                              <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
 | 
                                                        
| 827 | 827 | </td>  | 
                                                        
| 828 | 828 | </tr>  | 
                                                        
| 829 | 829 | <?php } ?>  | 
                                                        
| 830 | 830 | |
| 831 | 831 | <?php  | 
                                                        
| 832 | - /**  | 
                                                        |
| 833 | - * Called at the end of the advanced custom fields settings page loop.  | 
                                                        |
| 834 | - *  | 
                                                        |
| 835 | - * Can be used to add or deal with different settings types.  | 
                                                        |
| 836 | - *  | 
                                                        |
| 837 | - * @since 1.0.0  | 
                                                        |
| 838 | - * @param object $field_info The current fields info.  | 
                                                        |
| 839 | - */  | 
                                                        |
| 840 | -                    do_action('geodir_advance_custom_fields', $field_info);?>
 | 
                                                        |
| 832 | + /**  | 
                                                        |
| 833 | + * Called at the end of the advanced custom fields settings page loop.  | 
                                                        |
| 834 | + *  | 
                                                        |
| 835 | + * Can be used to add or deal with different settings types.  | 
                                                        |
| 836 | + *  | 
                                                        |
| 837 | + * @since 1.0.0  | 
                                                        |
| 838 | + * @param object $field_info The current fields info.  | 
                                                        |
| 839 | + */  | 
                                                        |
| 840 | +					do_action('geodir_advance_custom_fields', $field_info);?>
 | 
                                                        |
| 841 | 841 | |
| 842 | 842 |                      <?php /*if(!in_array($field_type,array() )){?>
 | 
                                                        
| 843 | 843 | <tr>  | 
                                                        
@@ -24,7 +24,7 @@ discard block  | 
                                                    ||
| 24 | 24 | |
| 25 | 25 | $field_info = stripslashes_deep($field_info); // strip slashes from labels  | 
                                                        
| 26 | 26 | |
| 27 | -$nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 27 | +$nonce = wp_create_nonce('custom_fields_'.$result_str);
 | 
                                                        |
| 28 | 28 | |
| 29 | 29 | $field_admin_title = '';  | 
                                                        
| 30 | 30 | if (isset($field_info->admin_title))  | 
                                                        
@@ -47,7 +47,7 @@ discard block  | 
                                                    ||
| 47 | 47 |           ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
 | 
                                                        
| 48 | 48 | <?php  | 
                                                        
| 49 | 49 | |
| 50 | -        $nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        |
| 50 | +        $nonce = wp_create_nonce('custom_fields_'.$result_str);
 | 
                                                        |
| 51 | 51 | ?>  | 
                                                        
| 52 | 52 | |
| 53 | 53 | <?php if ($default): ?>  | 
                                                        
@@ -61,12 +61,12 @@ discard block  | 
                                                    ||
| 61 | 61 | ?>  | 
                                                        
| 62 | 62 | |
| 63 | 63 | <b style="cursor:pointer;"  | 
                                                        
| 64 | -               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
 | 
                                                        |
| 64 | +               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
 | 
                                                        |
| 65 | 65 | <?php  | 
                                                        
| 66 | 66 |          } else {
 | 
                                                        
| 67 | 67 | ?>  | 
                                                        
| 68 | 68 | <b style="cursor:pointer;"  | 
                                                        
| 69 | -               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
 | 
                                                        |
| 69 | +               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' '.$field_admin_title.' ('.$field_type.')'); ?></b>
 | 
                                                        |
| 70 | 70 | <?php  | 
                                                        
| 71 | 71 | }  | 
                                                        
| 72 | 72 | ?>  | 
                                                        
@@ -172,7 +172,7 @@ discard block  | 
                                                    ||
| 172 | 172 | ?>  | 
                                                        
| 173 | 173 | |
| 174 | 174 | <tr>  | 
                                                        
| 175 | -                    <td><strong><?php _e('HTML variable name :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 175 | +                    <td><strong><?php _e('HTML variable name :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 176 | 176 | <td align="left">  | 
                                                        
| 177 | 177 | <input type="text" name="htmlvar_name" id="htmlvar_name"  | 
                                                        
| 178 | 178 |                                 value="<?php if (isset($field_info->htmlvar_name)) {
 | 
                                                        
@@ -180,10 +180,10 @@ discard block  | 
                                                    ||
| 180 | 180 |                                 }?>" <?php if ($default) {
 | 
                                                        
| 181 | 181 | echo 'readonly="readonly"';  | 
                                                        
| 182 | 182 | }?> />  | 
                                                        
| 183 | -                        <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory');?></span>
 | 
                                                        |
| 184 | -                        <br/> <span><?php _e('This should be a unique name', 'geodirectory');?></span>
 | 
                                                        |
| 183 | +                        <br/> <span><?php _e('HTML variable name must not be blank', 'geodirectory'); ?></span>
 | 
                                                        |
| 184 | +                        <br/> <span><?php _e('This should be a unique name', 'geodirectory'); ?></span>
 | 
                                                        |
| 185 | 185 | <br/>  | 
                                                        
| 186 | -                        <span><?php _e('HTML variable name not use spaces, special characters', 'geodirectory');?></span>
 | 
                                                        |
| 186 | +                        <span><?php _e('HTML variable name not use spaces, special characters', 'geodirectory'); ?></span>
 | 
                                                        |
| 187 | 187 | </td>  | 
                                                        
| 188 | 188 | </tr>  | 
                                                        
| 189 | 189 | <?php } ?>  | 
                                                        
@@ -202,19 +202,19 @@ discard block  | 
                                                    ||
| 202 | 202 | $default_value = isset($field_info->default_value) ? $field_info->default_value : '';  | 
                                                        
| 203 | 203 | ?>  | 
                                                        
| 204 | 204 | <tr>  | 
                                                        
| 205 | -				<td><strong><?php _e('Default value :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 205 | +				<td><strong><?php _e('Default value :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 206 | 206 | <td align="left">  | 
                                                        
| 207 | 207 |  				<?php if ($field_type == 'checkbox') { ?>
 | 
                                                        
| 208 | 208 | <select name="default_value" id="default_value">  | 
                                                        
| 209 | 209 |  					<option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
 | 
                                                        
| 210 | -					<option value="1" <?php selected(true, (int)$default_value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
 | 
                                                        |
| 210 | +					<option value="1" <?php selected(true, (int) $default_value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
 | 
                                                        |
| 211 | 211 | </select>  | 
                                                        
| 212 | 212 |  				<?php } else if ($field_type == 'email') { ?>
 | 
                                                        
| 213 | -				<input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($default_value);?>" /><br/>
 | 
                                                        |
| 214 | -				<span><?php _e('Enter the default value. Ex: [email protected]', 'geodirectory');?></span>
 | 
                                                        |
| 213 | +				<input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($default_value); ?>" /><br/>
 | 
                                                        |
| 214 | +				<span><?php _e('Enter the default value. Ex: [email protected]', 'geodirectory'); ?></span>
 | 
                                                        |
| 215 | 215 |  				<?php } else { ?>
 | 
                                                        
| 216 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($default_value);?>" /><br/>  | 
                                                        |
| 217 | -				<span><?php _e('Enter the default value (for "link" this will be used as the link text)', 'geodirectory');?></span>
 | 
                                                        |
| 216 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($default_value); ?>" /><br/>  | 
                                                        |
| 217 | +				<span><?php _e('Enter the default value (for "link" this will be used as the link text)', 'geodirectory'); ?></span>
 | 
                                                        |
| 218 | 218 | <?php } ?>  | 
                                                        
| 219 | 219 | </td>  | 
                                                        
| 220 | 220 | </tr>  | 
                                                        
@@ -379,7 +379,7 @@ discard block  | 
                                                    ||
| 379 | 379 | </td>  | 
                                                        
| 380 | 380 | </tr>  | 
                                                        
| 381 | 381 | |
| 382 | -            <?php if ($field_type == 'text'){?>
 | 
                                                        |
| 382 | +            <?php if ($field_type == 'text') {?>
 | 
                                                        |
| 383 | 383 | <tr>  | 
                                                        
| 384 | 384 |                  <td><strong><?php _e('Validation Pattern:', 'geodirectory'); ?></strong></td>
 | 
                                                        
| 385 | 385 | <td align="left">  | 
                                                        
@@ -409,7 +409,7 @@ discard block  | 
                                                    ||
| 409 | 409 | </tr>  | 
                                                        
| 410 | 410 | <?php } ?>  | 
                                                        
| 411 | 411 | |
| 412 | - <tr <?php echo (!$display_on_listing ? 'style="display:none"' : '') ;?>>  | 
                                                        |
| 412 | + <tr <?php echo (!$display_on_listing ? 'style="display:none"' : ''); ?>>  | 
                                                        |
| 413 | 413 |                  <td><strong><?php _e('Show on listing page ? :', 'geodirectory'); ?></strong></td>
 | 
                                                        
| 414 | 414 | <td align="left">  | 
                                                        
| 415 | 415 | <select name="show_on_listing" id="show_on_listing">  | 
                                                        
@@ -468,7 +468,7 @@ discard block  | 
                                                    ||
| 468 | 468 |                  case 'taxonomy': {
 | 
                                                        
| 469 | 469 | ?>  | 
                                                        
| 470 | 470 | <tr>  | 
                                                        
| 471 | -                        <td><strong><?php _e('Select taxonomy:', 'geodirectory');?></strong></td>
 | 
                                                        |
| 471 | +                        <td><strong><?php _e('Select taxonomy:', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 472 | 472 | <td align="left">  | 
                                                        
| 473 | 473 | <select name="htmlvar_name" id="htmlvar_name">  | 
                                                        
| 474 | 474 | <?php  | 
                                                        
@@ -478,40 +478,40 @@ discard block  | 
                                                    ||
| 478 | 478 | ?>  | 
                                                        
| 479 | 479 |                                      <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
 | 
                                                        
| 480 | 480 | echo 'selected="selected"';  | 
                                                        
| 481 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php  | 
                                                        |
| 481 | + }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php  | 
                                                        |
| 482 | 482 | }  | 
                                                        
| 483 | 483 | ?>  | 
                                                        
| 484 | 484 | </select>  | 
                                                        
| 485 | 485 | |
| 486 | 486 | <br/>  | 
                                                        
| 487 | -                            <span><?php _e('Selected taxonomy name use as field name index. ex:-( post_category[gd_placecategory] )', 'geodirectory');?></span>
 | 
                                                        |
| 487 | +                            <span><?php _e('Selected taxonomy name use as field name index. ex:-( post_category[gd_placecategory] )', 'geodirectory'); ?></span>
 | 
                                                        |
| 488 | 488 | </td>  | 
                                                        
| 489 | 489 | </tr>  | 
                                                        
| 490 | 490 | |
| 491 | 491 | <tr>  | 
                                                        
| 492 | -                        <td><strong><?php _e('Category display type :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 492 | +                        <td><strong><?php _e('Category display type :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 493 | 493 | <td align="left">  | 
                                                        
| 494 | 494 | |
| 495 | 495 | <select name="cat_display_type" id="cat_display_type">  | 
                                                        
| 496 | 496 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
 | 
                                                        
| 497 | 497 | echo 'selected="selected"';  | 
                                                        
| 498 | -                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
 | 
                                                        |
| 498 | +                                }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
 | 
                                                        |
| 499 | 499 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
 | 
                                                        
| 500 | 500 | echo 'selected="selected"';  | 
                                                        
| 501 | -                                }?> value="select"><?php _e('Select', 'geodirectory');?></option>
 | 
                                                        |
| 501 | +                                }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
 | 
                                                        |
| 502 | 502 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
 | 
                                                        
| 503 | 503 | echo 'selected="selected"';  | 
                                                        
| 504 | -                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
 | 
                                                        |
| 504 | +                                }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
 | 
                                                        |
| 505 | 505 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
 | 
                                                        
| 506 | 506 | echo 'selected="selected"';  | 
                                                        
| 507 | -                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
 | 
                                                        |
| 507 | +                                }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
 | 
                                                        |
| 508 | 508 |                                  <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
 | 
                                                        
| 509 | 509 | echo 'selected="selected"';  | 
                                                        
| 510 | -                                }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
 | 
                                                        |
| 510 | +                                }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
 | 
                                                        |
| 511 | 511 | </select>  | 
                                                        
| 512 | 512 | |
| 513 | 513 | <br/>  | 
                                                        
| 514 | -                            <span><?php _e('Show categories list as select,multiselect,checkbox or radio', 'geodirectory');?></span>
 | 
                                                        |
| 514 | +                            <span><?php _e('Show categories list as select,multiselect,checkbox or radio', 'geodirectory'); ?></span>
 | 
                                                        |
| 515 | 515 | </td>  | 
                                                        
| 516 | 516 | </tr>  | 
                                                        
| 517 | 517 | <?php } // end of additional field for taxonomy field type  | 
                                                        
@@ -532,92 +532,92 @@ discard block  | 
                                                    ||
| 532 | 532 |                      do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
 | 
                                                        
| 533 | 533 | |
| 534 | 534 | <tr>  | 
                                                        
| 535 | -                        <td><strong><?php _e('Display zip/post code :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 535 | +                        <td><strong><?php _e('Display zip/post code :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 536 | 536 | <td align="left">  | 
                                                        
| 537 | 537 | <input type="checkbox" name="extra[show_zip]" id="show_zip"  | 
                                                        
| 538 | 538 |                                     value="1" <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
 | 
                                                        
| 539 | 539 | echo 'checked="checked"';  | 
                                                        
| 540 | 540 | }?>/>  | 
                                                        
| 541 | -                            <span><?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?></span>
 | 
                                                        |
| 541 | +                            <span><?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?></span>
 | 
                                                        |
| 542 | 542 | </td>  | 
                                                        
| 543 | 543 | </tr>  | 
                                                        
| 544 | 544 | |
| 545 | 545 | <tr>  | 
                                                        
| 546 | -                        <td><strong><?php _e('Zip/Post code label :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 546 | +                        <td><strong><?php _e('Zip/Post code label :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 547 | 547 | <td align="left">  | 
                                                        
| 548 | 548 | <input type="text" name="extra[zip_lable]" id="zip_lable"  | 
                                                        
| 549 | 549 |                                     value="<?php if (isset($address['zip_lable'])) {
 | 
                                                        
| 550 | 550 | echo esc_attr($address['zip_lable']);  | 
                                                        
| 551 | 551 | }?>"/>  | 
                                                        
| 552 | -                            <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory');?></span>
 | 
                                                        |
| 552 | +                            <span><?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?></span>
 | 
                                                        |
| 553 | 553 | </td>  | 
                                                        
| 554 | 554 | </tr>  | 
                                                        
| 555 | 555 | |
| 556 | 556 | <tr style="display:none;">  | 
                                                        
| 557 | -                        <td><strong><?php _e('Display map :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 557 | +                        <td><strong><?php _e('Display map :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 558 | 558 | <td align="left">  | 
                                                        
| 559 | 559 | <input type="checkbox" name="extra[show_map]" id="show_map"  | 
                                                        
| 560 | 560 |                                     value="1" <?php if (isset($address['show_map']) && $address['show_map'] == '1') {
 | 
                                                        
| 561 | 561 | echo 'checked="checked"';  | 
                                                        
| 562 | 562 | }?>/>  | 
                                                        
| 563 | -                            <span><?php _e('Select if you want to `set address on map` field in address section.', 'geodirectory');?></span>
 | 
                                                        |
| 563 | +                            <span><?php _e('Select if you want to `set address on map` field in address section.', 'geodirectory'); ?></span>
 | 
                                                        |
| 564 | 564 | </td>  | 
                                                        
| 565 | 565 | </tr>  | 
                                                        
| 566 | 566 | |
| 567 | 567 | <tr>  | 
                                                        
| 568 | -                        <td><strong><?php _e('Map button label :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 568 | +                        <td><strong><?php _e('Map button label :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 569 | 569 | <td align="left">  | 
                                                        
| 570 | 570 | <input type="text" name="extra[map_lable]" id="map_lable"  | 
                                                        
| 571 | 571 |                                     value="<?php if (isset($address['map_lable'])) {
 | 
                                                        
| 572 | 572 | echo esc_attr($address['map_lable']);  | 
                                                        
| 573 | 573 | }?>"/>  | 
                                                        
| 574 | -                            <span><?php _e('Enter text for  `set address on map` button in address section.', 'geodirectory');?></span>
 | 
                                                        |
| 574 | +                            <span><?php _e('Enter text for  `set address on map` button in address section.', 'geodirectory'); ?></span>
 | 
                                                        |
| 575 | 575 | </td>  | 
                                                        
| 576 | 576 | </tr>  | 
                                                        
| 577 | 577 | |
| 578 | 578 | <tr>  | 
                                                        
| 579 | -                        <td><strong><?php _e('Use user zoom level:', 'geodirectory');?></strong></td>
 | 
                                                        |
| 579 | +                        <td><strong><?php _e('Use user zoom level:', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 580 | 580 | <td align="left">  | 
                                                        
| 581 | 581 | <input type="checkbox" name="extra[show_mapzoom]" id="show_mapzoom"  | 
                                                        
| 582 | 582 |                                     value="1" <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
 | 
                                                        
| 583 | 583 | echo 'checked="checked"';  | 
                                                        
| 584 | 584 | }?>/>  | 
                                                        
| 585 | -                            <span><?php _e('Select if you want to use the user defined map zoom level.', 'geodirectory');?></span>
 | 
                                                        |
| 585 | +                            <span><?php _e('Select if you want to use the user defined map zoom level.', 'geodirectory'); ?></span>
 | 
                                                        |
| 586 | 586 | </td>  | 
                                                        
| 587 | 587 | </tr>  | 
                                                        
| 588 | 588 | |
| 589 | 589 | <tr>  | 
                                                        
| 590 | -                        <td><strong><?php _e('Display map view:', 'geodirectory');?></strong></td>
 | 
                                                        |
| 590 | +                        <td><strong><?php _e('Display map view:', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 591 | 591 | <td align="left">  | 
                                                        
| 592 | 592 | <input type="checkbox" name="extra[show_mapview]" id="show_mapview"  | 
                                                        
| 593 | 593 |                                     value="1" <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
 | 
                                                        
| 594 | 594 | echo 'checked="checked"';  | 
                                                        
| 595 | 595 | }?>/>  | 
                                                        
| 596 | -                            <span><?php _e('Select if you want to `set default map` options in address section.', 'geodirectory');?></span>
 | 
                                                        |
| 596 | +                            <span><?php _e('Select if you want to `set default map` options in address section.', 'geodirectory'); ?></span>
 | 
                                                        |
| 597 | 597 | </td>  | 
                                                        
| 598 | 598 | </tr>  | 
                                                        
| 599 | 599 | |
| 600 | 600 | |
| 601 | 601 | <tr>  | 
                                                        
| 602 | -                        <td><strong><?php _e('Map view label :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 602 | +                        <td><strong><?php _e('Map view label :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 603 | 603 | <td align="left">  | 
                                                        
| 604 | 604 | <input type="text" name="extra[mapview_lable]" id="mapview_lable"  | 
                                                        
| 605 | 605 |                                     value="<?php if (isset($address['mapview_lable'])) {
 | 
                                                        
| 606 | 606 | echo esc_attr($address['mapview_lable']);  | 
                                                        
| 607 | 607 | }?>"/>  | 
                                                        
| 608 | -                            <span><?php _e('Enter mapview field label in address section.', 'geodirectory');?></span>
 | 
                                                        |
| 608 | +                            <span><?php _e('Enter mapview field label in address section.', 'geodirectory'); ?></span>
 | 
                                                        |
| 609 | 609 | </td>  | 
                                                        
| 610 | 610 | </tr>  | 
                                                        
| 611 | 611 | <tr>  | 
                                                        
| 612 | 612 | <td>  | 
                                                        
| 613 | -                            <strong><?php _e('Show latitude and longitude from front-end :', 'geodirectory');?></strong>
 | 
                                                        |
| 613 | +                            <strong><?php _e('Show latitude and longitude from front-end :', 'geodirectory'); ?></strong>
 | 
                                                        |
| 614 | 614 | </td>  | 
                                                        
| 615 | 615 | <td align="left">  | 
                                                        
| 616 | 616 | <input type="checkbox" name="extra[show_latlng]" id="show_latlng"  | 
                                                        
| 617 | 617 |                                     value="1" <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
 | 
                                                        
| 618 | 618 | echo 'checked="checked"';  | 
                                                        
| 619 | 619 | }?>/>  | 
                                                        
| 620 | -                            <span><?php _e('Select if you want to show latitude and logatude fields in address section from front-end.', 'geodirectory');?></span>
 | 
                                                        |
| 620 | +                            <span><?php _e('Select if you want to show latitude and logatude fields in address section from front-end.', 'geodirectory'); ?></span>
 | 
                                                        |
| 621 | 621 | </td>  | 
                                                        
| 622 | 622 | </tr>  | 
                                                        
| 623 | 623 | <?php } // end of extra fields for address field type  | 
                                                        
@@ -629,41 +629,41 @@ discard block  | 
                                                    ||
| 629 | 629 | |
| 630 | 630 | ?>  | 
                                                        
| 631 | 631 | <tr>  | 
                                                        
| 632 | -                            <td><strong><?php _e('Multiselect display type :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 632 | +                            <td><strong><?php _e('Multiselect display type :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 633 | 633 | <td align="left">  | 
                                                        
| 634 | 634 | |
| 635 | 635 | <select name="multi_display_type" id="multi_display_type">  | 
                                                        
| 636 | 636 |                                      <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
 | 
                                                        
| 637 | 637 | echo 'selected="selected"';  | 
                                                        
| 638 | -                                    }?> value="select"><?php _e('Select', 'geodirectory');?></option>
 | 
                                                        |
| 638 | +                                    }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
 | 
                                                        |
| 639 | 639 |                                      <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
 | 
                                                        
| 640 | 640 | echo 'selected="selected"';  | 
                                                        
| 641 | -                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
 | 
                                                        |
| 641 | +                                    }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
 | 
                                                        |
| 642 | 642 |                                      <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
 | 
                                                        
| 643 | 643 | echo 'selected="selected"';  | 
                                                        
| 644 | -                                    }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
 | 
                                                        |
| 644 | +                                    }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
 | 
                                                        |
| 645 | 645 | </select>  | 
                                                        
| 646 | 646 | |
| 647 | 647 | <br/>  | 
                                                        
| 648 | -                                <span><?php _e('Show multiselect list as multiselect,checkbox or radio', 'geodirectory');?></span>
 | 
                                                        |
| 648 | +                                <span><?php _e('Show multiselect list as multiselect,checkbox or radio', 'geodirectory'); ?></span>
 | 
                                                        |
| 649 | 649 | </td>  | 
                                                        
| 650 | 650 | </tr>  | 
                                                        
| 651 | 651 | <?php  | 
                                                        
| 652 | 652 | }  | 
                                                        
| 653 | 653 | ?>  | 
                                                        
| 654 | 654 | <tr>  | 
                                                        
| 655 | -                        <td><strong><?php _e('Option Values :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 655 | +                        <td><strong><?php _e('Option Values :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 656 | 656 | <td align="left">  | 
                                                        
| 657 | 657 | <input type="text" name="option_values" id="option_values"  | 
                                                        
| 658 | 658 |                                     value="<?php if (isset($field_info->option_values)) {
 | 
                                                        
| 659 | 659 | echo esc_attr($field_info->option_values);  | 
                                                        
| 660 | 660 | }?>"/>  | 
                                                        
| 661 | 661 | <br/>  | 
                                                        
| 662 | -                            <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
 | 
                                                        |
| 662 | +                            <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
 | 
                                                        |
| 663 | 663 | <br/>  | 
                                                        
| 664 | -                            <span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
 | 
                                                        |
| 664 | +                            <span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
 | 
                                                        |
| 665 | 665 | <br/>  | 
                                                        
| 666 | -                            <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
 | 
                                                        |
| 666 | +                            <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
 | 
                                                        |
| 667 | 667 |                              <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
 | 
                                                        
| 668 | 668 | <br/>  | 
                                                        
| 669 | 669 |                                  <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
 | 
                                                        
@@ -681,7 +681,7 @@ discard block  | 
                                                    ||
| 681 | 681 | }  | 
                                                        
| 682 | 682 | ?>  | 
                                                        
| 683 | 683 | <tr>  | 
                                                        
| 684 | -                        <td><strong><?php _e('Date Format :', 'geodirectory');?></strong></td>
 | 
                                                        |
| 684 | +                        <td><strong><?php _e('Date Format :', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 685 | 685 | <td align="left" style="overflow:inherit;">  | 
                                                        
| 686 | 686 | <?php  | 
                                                        
| 687 | 687 | $date_formats = array(  | 
                                                        
@@ -699,21 +699,21 @@ discard block  | 
                                                    ||
| 699 | 699 | * @since 1.6.5  | 
                                                        
| 700 | 700 | * @param array $date_formats The PHP date format array.  | 
                                                        
| 701 | 701 | */  | 
                                                        
| 702 | -                            $date_formats = apply_filters('geodir_date_formats',$date_formats);
 | 
                                                        |
| 702 | +                            $date_formats = apply_filters('geodir_date_formats', $date_formats);
 | 
                                                        |
| 703 | 703 | ?>  | 
                                                        
| 704 | 704 | <select name="extra[date_format]" id="date_format">  | 
                                                        
| 705 | 705 | <?php  | 
                                                        
| 706 | -                                foreach($date_formats as $format){
 | 
                                                        |
| 706 | +                                foreach ($date_formats as $format) {
 | 
                                                        |
| 707 | 707 | $selected = '';  | 
                                                        
| 708 | -                                    if(esc_attr($extra['date_format'])==$format){
 | 
                                                        |
| 708 | +                                    if (esc_attr($extra['date_format']) == $format) {
 | 
                                                        |
| 709 | 709 | $selected = "selected='selected'";  | 
                                                        
| 710 | 710 | }  | 
                                                        
| 711 | -                                    echo "<option $selected value='$format'>$format       (".date_i18n( $format, time()).")</option>";
 | 
                                                        |
| 711 | +                                    echo "<option $selected value='$format'>$format       (".date_i18n($format, time()).")</option>";
 | 
                                                        |
| 712 | 712 | }  | 
                                                        
| 713 | 713 | ?>  | 
                                                        
| 714 | 714 | </select>  | 
                                                        
| 715 | 715 | |
| 716 | -                            <span><?php _e('Select the date format.', 'geodirectory');?></span>
 | 
                                                        |
| 716 | +                            <span><?php _e('Select the date format.', 'geodirectory'); ?></span>
 | 
                                                        |
| 717 | 717 | </td>  | 
                                                        
| 718 | 718 | </tr>  | 
                                                        
| 719 | 719 | <?php  | 
                                                        
@@ -726,20 +726,20 @@ discard block  | 
                                                    ||
| 726 | 726 |  					$gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
 | 
                                                        
| 727 | 727 | ?>  | 
                                                        
| 728 | 728 | <tr>  | 
                                                        
| 729 | -					  <td><strong><?php _e('Allowed file types:', 'geodirectory');?></strong></td>
 | 
                                                        |
| 729 | +					  <td><strong><?php _e('Allowed file types:', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 730 | 730 | <td align="left">  | 
                                                        
| 731 | 731 | <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;">  | 
                                                        
| 732 | -								<option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
 | 
                                                        |
| 733 | -								<?php foreach ( $allowed_file_types as $format => $types ) { ?>
 | 
                                                        |
| 734 | -								<optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
 | 
                                                        |
| 735 | -									<?php foreach ( $types as $ext => $type ) { ?>
 | 
                                                        |
| 736 | - <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option>  | 
                                                        |
| 732 | +								<option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
 | 
                                                        |
| 733 | +								<?php foreach ($allowed_file_types as $format => $types) { ?>
 | 
                                                        |
| 734 | +								<optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
 | 
                                                        |
| 735 | +									<?php foreach ($types as $ext => $type) { ?>
 | 
                                                        |
| 736 | + <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option>  | 
                                                        |
| 737 | 737 | <?php } ?>  | 
                                                        
| 738 | 738 | </optgroup>  | 
                                                        
| 739 | 739 | <?php } ?>  | 
                                                        
| 740 | 740 | </select>  | 
                                                        
| 741 | 741 | <br />  | 
                                                        
| 742 | -							<span><?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', GEODIRPAYMENT_TEXTDOMAIN);?></span>				
 | 
                                                        |
| 742 | +							<span><?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', GEODIRPAYMENT_TEXTDOMAIN); ?></span>				
 | 
                                                        |
| 743 | 743 | </td>  | 
                                                        
| 744 | 744 | </tr>  | 
                                                        
| 745 | 745 | <?php  | 
                                                        
@@ -754,28 +754,28 @@ discard block  | 
                                                    ||
| 754 | 754 | </tr>  | 
                                                        
| 755 | 755 | |
| 756 | 756 | <tr>  | 
                                                        
| 757 | -                    <td><strong><?php _e('Upload icon:', 'geodirectory');?></strong></td>
 | 
                                                        |
| 757 | +                    <td><strong><?php _e('Upload icon:', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 758 | 758 | <td align="left">  | 
                                                        
| 759 | 759 | <input type="text" name="field_icon" id="field_icon"  | 
                                                        
| 760 | 760 |                                 value="<?php if (isset($field_info->field_icon)) {
 | 
                                                        
| 761 | 761 | echo $field_info->field_icon;  | 
                                                        
| 762 | 762 | }?>"/>  | 
                                                        
| 763 | 763 | <span>  | 
                                                        
| 764 | -                        <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
 | 
                                                        |
| 764 | +                        <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
 | 
                                                        |
| 765 | 765 | </span>  | 
                                                        
| 766 | 766 | </td>  | 
                                                        
| 767 | 767 | </td>  | 
                                                        
| 768 | 768 | </tr>  | 
                                                        
| 769 | 769 | |
| 770 | 770 | <tr>  | 
                                                        
| 771 | -                    <td><strong><?php _e('Css class:', 'geodirectory');?></strong></td>
 | 
                                                        |
| 771 | +                    <td><strong><?php _e('Css class:', 'geodirectory'); ?></strong></td>
 | 
                                                        |
| 772 | 772 | <td align="left">  | 
                                                        
| 773 | 773 | <input type="text" name="css_class" id="css_class"  | 
                                                        
| 774 | 774 |                                 value="<?php if (isset($field_info->css_class)) {
 | 
                                                        
| 775 | 775 | echo esc_attr($field_info->css_class);  | 
                                                        
| 776 | 776 | }?>"/>  | 
                                                        
| 777 | 777 | <span>  | 
                                                        
| 778 | -                        <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
 | 
                                                        |
| 778 | +                        <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
 | 
                                                        |
| 779 | 779 | </span>  | 
                                                        
| 780 | 780 | </td>  | 
                                                        
| 781 | 781 | </td>  | 
                                                        
@@ -837,7 +837,7 @@ discard block  | 
                                                    ||
| 837 | 837 | * @since 1.0.0  | 
                                                        
| 838 | 838 | * @param object $field_info The current fields info.  | 
                                                        
| 839 | 839 | */  | 
                                                        
| 840 | -                    do_action('geodir_advance_custom_fields', $field_info);?>
 | 
                                                        |
| 840 | +                    do_action('geodir_advance_custom_fields', $field_info); ?>
 | 
                                                        |
| 841 | 841 | |
| 842 | 842 |                      <?php /*if(!in_array($field_type,array() )){?>
 | 
                                                        
| 843 | 843 | <tr>  | 
                                                        
@@ -856,10 +856,10 @@ discard block  | 
                                                    ||
| 856 | 856 | <td> </td>  | 
                                                        
| 857 | 857 | <td align="left">  | 
                                                        
| 858 | 858 | |
| 859 | -                    <input type="button" class="button" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
 | 
                                                        |
| 859 | +                    <input type="button" class="button" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
 | 
                                                        |
| 860 | 860 |                             onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
 | 
                                                        
| 861 | 861 | <?php if (!$default): ?>  | 
                                                        
| 862 | -                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
 | 
                                                        |
| 862 | +                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
 | 
                                                        |
| 863 | 863 |                                                              onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
 | 
                                                        
| 864 | 864 | class="button_n"/></a>  | 
                                                        
| 865 | 865 | <?php endif; ?>  | 
                                                        
@@ -19,16 +19,18 @@ discard block  | 
                                                    ||
| 19 | 19 | |
| 20 | 20 |  if (!isset($field_info->post_type)) {
 | 
                                                        
| 21 | 21 | $post_type = sanitize_text_field($_REQUEST['listing_type']);  | 
                                                        
| 22 | -} else  | 
                                                        |
| 23 | - $post_type = $field_info->post_type;  | 
                                                        |
| 22 | +} else { | 
                                                        |
| 23 | + $post_type = $field_info->post_type;  | 
                                                        |
| 24 | +}  | 
                                                        |
| 24 | 25 | |
| 25 | 26 | $field_info = stripslashes_deep($field_info); // strip slashes from labels  | 
                                                        
| 26 | 27 | |
| 27 | 28 |  $nonce = wp_create_nonce('custom_fields_' . $result_str);
 | 
                                                        
| 28 | 29 | |
| 29 | 30 | $field_admin_title = '';  | 
                                                        
| 30 | -if (isset($field_info->admin_title))  | 
                                                        |
| 31 | - $field_admin_title = $field_info->admin_title;  | 
                                                        |
| 31 | +if (isset($field_info->admin_title)) { | 
                                                        |
| 32 | + $field_admin_title = $field_info->admin_title;  | 
                                                        |
| 33 | +}  | 
                                                        |
| 32 | 34 | |
| 33 | 35 | $default = isset($field_info->is_admin) ? $field_info->is_admin : '';  | 
                                                        
| 34 | 36 | |
@@ -52,8 +54,11 @@ discard block  | 
                                                    ||
| 52 | 54 | |
| 53 | 55 | <?php if ($default): ?>  | 
                                                        
| 54 | 56 |              <div title="<?php _e('Drag and drop to sort', 'geodirectory'); ?>" class="handlediv move"></div>
 | 
                                                        
| 55 | - <?php else: ?>  | 
                                                        |
| 56 | -            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
 | 
                                                        |
| 57 | +        <?php else { | 
                                                        |
| 58 | + : ?>  | 
                                                        |
| 59 | +            <div title="<?php _e('Click to remove field', 'geodirectory'); | 
                                                        |
| 60 | +}  | 
                                                        |
| 61 | +?>"  | 
                                                        |
| 57 | 62 |                   onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
 | 
                                                        
| 58 | 63 | class="handlediv close"></div>  | 
                                                        
| 59 | 64 | <?php endif;  | 
                                                        
@@ -255,11 +260,13 @@ discard block  | 
                                                    ||
| 255 | 260 | |
| 256 | 261 | <?php  | 
                                                        
| 257 | 262 | $selected = '';  | 
                                                        
| 258 | - if (isset($field_info->extra_fields))  | 
                                                        |
| 259 | - $advanced_editor = unserialize($field_info->extra_fields);  | 
                                                        |
| 263 | +                    if (isset($field_info->extra_fields)) { | 
                                                        |
| 264 | + $advanced_editor = unserialize($field_info->extra_fields);  | 
                                                        |
| 265 | + }  | 
                                                        |
| 260 | 266 | |
| 261 | -                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
 | 
                                                        |
| 262 | - $selected = 'checked="checked"';  | 
                                                        |
| 267 | +                    if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) { | 
                                                        |
| 268 | + $selected = 'checked="checked"';  | 
                                                        |
| 269 | + }  | 
                                                        |
| 263 | 270 | ?>  | 
                                                        
| 264 | 271 | |
| 265 | 272 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor"  | 
                                                        
@@ -20,479 +20,479 @@ 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 | - * @package GeoDirectory  | 
                                                        |
| 79 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 80 | - * @global object $post The current post object.  | 
                                                        |
| 81 | - * @global object $current_user Current user object.  | 
                                                        |
| 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 | + * @package GeoDirectory  | 
                                                        |
| 79 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 80 | + * @global object $post The current post object.  | 
                                                        |
| 81 | + * @global object $current_user Current user object.  | 
                                                        |
| 82 | 82 | * @global object $gd_session GeoDirectory Session object.  | 
                                                        
| 83 | -     * @param array $request_info {
 | 
                                                        |
| 84 | - * Array of request info arguments.  | 
                                                        |
| 85 | - *  | 
                                                        |
| 86 | - * @type string $action Ajax action name.  | 
                                                        |
| 87 | - * @type string $geodir_ajax Ajax type.  | 
                                                        |
| 88 | - * @type string $ajax_action Ajax action.  | 
                                                        |
| 89 | - * @type string $listing_type Listing type.  | 
                                                        |
| 90 | - * @type string $pid Default Post ID.  | 
                                                        |
| 91 | - * @type string $preview Todo Desc needed.  | 
                                                        |
| 92 | - * @type string $add_listing_page_id Add listing page ID.  | 
                                                        |
| 93 | - * @type string $post_title Listing title.  | 
                                                        |
| 94 | - * @type string $post_desc Listing Description.  | 
                                                        |
| 95 | - * @type string $post_tags Listing tags.  | 
                                                        |
| 96 | - * @type array $cat_limit Category limit.  | 
                                                        |
| 97 | - * @type array $post_category Category IDs.  | 
                                                        |
| 98 | - * @type array $post_category_str Category string.  | 
                                                        |
| 99 | - * @type string $post_default_category Default category ID.  | 
                                                        |
| 100 | - * @type string $post_address Listing address.  | 
                                                        |
| 101 | - * @type string $geodir_location_add_listing_country_val Add listing country value.  | 
                                                        |
| 102 | - * @type string $post_country Listing country.  | 
                                                        |
| 103 | - * @type string $geodir_location_add_listing_region_val Add listing region value.  | 
                                                        |
| 104 | - * @type string $post_region Listing region.  | 
                                                        |
| 105 | - * @type string $geodir_location_add_listing_city_val Add listing city value.  | 
                                                        |
| 106 | - * @type string $post_city Listing city.  | 
                                                        |
| 107 | - * @type string $post_zip Listing zip.  | 
                                                        |
| 108 | - * @type string $post_latitude Listing latitude.  | 
                                                        |
| 109 | - * @type string $post_longitude Listing longitude.  | 
                                                        |
| 110 | - * @type string $post_mapview Listing mapview. Default "ROADMAP".  | 
                                                        |
| 111 | - * @type string $post_mapzoom Listing mapzoom Default "9".  | 
                                                        |
| 112 | - * @type string $geodir_timing Business timing info.  | 
                                                        |
| 113 | - * @type string $geodir_contact Contact number.  | 
                                                        |
| 114 | - * @type string $geodir_email Business contact email.  | 
                                                        |
| 115 | - * @type string $geodir_website Business website.  | 
                                                        |
| 116 | - * @type string $geodir_twitter Twitter link.  | 
                                                        |
| 117 | - * @type string $geodir_facebook Facebook link.  | 
                                                        |
| 118 | - * @type string $geodir_video Video link.  | 
                                                        |
| 119 | - * @type string $geodir_special_offers Speacial offers.  | 
                                                        |
| 120 | - * @type string $post_images Post image urls.  | 
                                                        |
| 121 | - * @type string $post_imagesimage_limit Post images limit.  | 
                                                        |
| 122 | - * @type string $post_imagestotImg Todo Desc needed.  | 
                                                        |
| 123 | - * @type string $geodir_accept_term_condition Has accepted terms and conditions?.  | 
                                                        |
| 124 | - * @type string $geodir_spamblocker Todo Desc needed.  | 
                                                        |
| 125 | - * @type string $geodir_filled_by_spam_bot Todo Desc needed.  | 
                                                        |
| 126 | - *  | 
                                                        |
| 127 | - * }  | 
                                                        |
| 128 | - * @param bool $dummy Optional. Is this a dummy listing? Default false.  | 
                                                        |
| 129 | - * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.  | 
                                                        |
| 130 | - * @return int|string|WP_Error Created post id or WP_Error on failure.  | 
                                                        |
| 131 | - */  | 
                                                        |
| 132 | - function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)  | 
                                                        |
| 133 | -    {
 | 
                                                        |
| 134 | - global $wpdb, $current_user, $gd_session;  | 
                                                        |
| 135 | -  | 
                                                        |
| 136 | - $last_post_id = '';  | 
                                                        |
| 137 | -  | 
                                                        |
| 138 | -        if ($gd_session->get('listing') && !$dummy) {
 | 
                                                        |
| 139 | - $request_info = array();  | 
                                                        |
| 140 | -            $request_session = $gd_session->get('listing');
 | 
                                                        |
| 141 | - $request_info = array_merge($_REQUEST, $request_session);  | 
                                                        |
| 142 | -        } else if (!$gd_session->get('listing') && !$dummy) {
 | 
                                                        |
| 143 | - global $post;  | 
                                                        |
| 144 | - $request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);  | 
                                                        |
| 145 | - $request_info['post_title'] = $request_info['post_title'];  | 
                                                        |
| 146 | - $request_info['listing_type'] = $post->post_type;  | 
                                                        |
| 147 | - $request_info['post_desc'] = $request_info['content'];  | 
                                                        |
| 148 | -        } else if (!$dummy) {
 | 
                                                        |
| 149 | - return false;  | 
                                                        |
| 150 | - }  | 
                                                        |
| 151 | -  | 
                                                        |
| 152 | - /**  | 
                                                        |
| 153 | - * Filter the request_info array.  | 
                                                        |
| 154 | - *  | 
                                                        |
| 155 | - * You can use this filter to modify request_info array.  | 
                                                        |
| 156 | - *  | 
                                                        |
| 157 | - * @since 1.0.0  | 
                                                        |
| 158 | - * @package GeoDirectory  | 
                                                        |
| 159 | -         * @param array $request_info See {@see geodir_save_listing()} for accepted args.
 | 
                                                        |
| 160 | - */  | 
                                                        |
| 161 | -        $request_info = apply_filters('geodir_action_get_request_info', $request_info);
 | 
                                                        |
| 162 | -  | 
                                                        |
| 163 | - // Check if we need to save post location as new location  | 
                                                        |
| 164 | - $location_result = geodir_get_default_location();  | 
                                                        |
| 165 | -  | 
                                                        |
| 166 | -        if ($location_result->location_id > 0) {
 | 
                                                        |
| 167 | -            if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
 | 
                                                        |
| 168 | - $request_info['post_location'] = array(  | 
                                                        |
| 169 | - 'city' => $request_info['post_city'],  | 
                                                        |
| 170 | - 'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',  | 
                                                        |
| 171 | - 'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',  | 
                                                        |
| 172 | - 'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',  | 
                                                        |
| 173 | - 'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''  | 
                                                        |
| 174 | - );  | 
                                                        |
| 175 | -  | 
                                                        |
| 176 | - $post_location_info = $request_info['post_location'];  | 
                                                        |
| 177 | -  | 
                                                        |
| 178 | -                if ($location_id = geodir_add_new_location($post_location_info)) {
 | 
                                                        |
| 179 | - $post_location_id = $location_id;  | 
                                                        |
| 180 | - }  | 
                                                        |
| 181 | -            } else {
 | 
                                                        |
| 182 | - $post_location_id = $location_result->location_id;  | 
                                                        |
| 183 | - }  | 
                                                        |
| 184 | -        } else {
 | 
                                                        |
| 185 | - $post_location_id = $location_result->location_id;  | 
                                                        |
| 186 | - }  | 
                                                        |
| 187 | -  | 
                                                        |
| 188 | -        if ($dummy) {
 | 
                                                        |
| 189 | - $post_status = 'publish';  | 
                                                        |
| 190 | -        } else {
 | 
                                                        |
| 191 | - $post_status = geodir_new_post_default_status();  | 
                                                        |
| 192 | - }  | 
                                                        |
| 193 | -  | 
                                                        |
| 194 | -        if (isset($request_info['pid']) && $request_info['pid'] != '') {
 | 
                                                        |
| 195 | - $post_status = get_post_status($request_info['pid']);  | 
                                                        |
| 196 | - }  | 
                                                        |
| 197 | -  | 
                                                        |
| 198 | - /* fix change of slug on every title edit */  | 
                                                        |
| 199 | -        if (!isset($request_info['post_name'])) {
 | 
                                                        |
| 200 | - $request_info['post_name'] = $request_info['post_title'];  | 
                                                        |
| 201 | -  | 
                                                        |
| 202 | -            if (!empty($request_info['pid'])) {
 | 
                                                        |
| 203 | - $post_info = get_post($request_info['pid']);  | 
                                                        |
| 204 | -  | 
                                                        |
| 205 | -                if (!empty($post_info) && isset($post_info->post_name)) {
 | 
                                                        |
| 206 | - $request_info['post_name'] = $post_info->post_name;  | 
                                                        |
| 207 | - }  | 
                                                        |
| 208 | - }  | 
                                                        |
| 209 | - }  | 
                                                        |
| 210 | -  | 
                                                        |
| 211 | - $post = array(  | 
                                                        |
| 212 | - 'post_content' => $request_info['post_desc'],  | 
                                                        |
| 213 | - 'post_status' => $post_status,  | 
                                                        |
| 214 | - 'post_title' => $request_info['post_title'],  | 
                                                        |
| 215 | - 'post_name' => $request_info['post_name'],  | 
                                                        |
| 216 | - 'post_type' => $request_info['listing_type']  | 
                                                        |
| 217 | - );  | 
                                                        |
| 218 | -  | 
                                                        |
| 219 | - /**  | 
                                                        |
| 220 | - * Called before a listing is saved to the database.  | 
                                                        |
| 221 | - *  | 
                                                        |
| 222 | - * @since 1.0.0  | 
                                                        |
| 223 | - * @param object $post The post object.  | 
                                                        |
| 224 | - */  | 
                                                        |
| 225 | -        do_action_ref_array('geodir_before_save_listing', $post);
 | 
                                                        |
| 83 | +	 * @param array $request_info {
 | 
                                                        |
| 84 | + * Array of request info arguments.  | 
                                                        |
| 85 | + *  | 
                                                        |
| 86 | + * @type string $action Ajax action name.  | 
                                                        |
| 87 | + * @type string $geodir_ajax Ajax type.  | 
                                                        |
| 88 | + * @type string $ajax_action Ajax action.  | 
                                                        |
| 89 | + * @type string $listing_type Listing type.  | 
                                                        |
| 90 | + * @type string $pid Default Post ID.  | 
                                                        |
| 91 | + * @type string $preview Todo Desc needed.  | 
                                                        |
| 92 | + * @type string $add_listing_page_id Add listing page ID.  | 
                                                        |
| 93 | + * @type string $post_title Listing title.  | 
                                                        |
| 94 | + * @type string $post_desc Listing Description.  | 
                                                        |
| 95 | + * @type string $post_tags Listing tags.  | 
                                                        |
| 96 | + * @type array $cat_limit Category limit.  | 
                                                        |
| 97 | + * @type array $post_category Category IDs.  | 
                                                        |
| 98 | + * @type array $post_category_str Category string.  | 
                                                        |
| 99 | + * @type string $post_default_category Default category ID.  | 
                                                        |
| 100 | + * @type string $post_address Listing address.  | 
                                                        |
| 101 | + * @type string $geodir_location_add_listing_country_val Add listing country value.  | 
                                                        |
| 102 | + * @type string $post_country Listing country.  | 
                                                        |
| 103 | + * @type string $geodir_location_add_listing_region_val Add listing region value.  | 
                                                        |
| 104 | + * @type string $post_region Listing region.  | 
                                                        |
| 105 | + * @type string $geodir_location_add_listing_city_val Add listing city value.  | 
                                                        |
| 106 | + * @type string $post_city Listing city.  | 
                                                        |
| 107 | + * @type string $post_zip Listing zip.  | 
                                                        |
| 108 | + * @type string $post_latitude Listing latitude.  | 
                                                        |
| 109 | + * @type string $post_longitude Listing longitude.  | 
                                                        |
| 110 | + * @type string $post_mapview Listing mapview. Default "ROADMAP".  | 
                                                        |
| 111 | + * @type string $post_mapzoom Listing mapzoom Default "9".  | 
                                                        |
| 112 | + * @type string $geodir_timing Business timing info.  | 
                                                        |
| 113 | + * @type string $geodir_contact Contact number.  | 
                                                        |
| 114 | + * @type string $geodir_email Business contact email.  | 
                                                        |
| 115 | + * @type string $geodir_website Business website.  | 
                                                        |
| 116 | + * @type string $geodir_twitter Twitter link.  | 
                                                        |
| 117 | + * @type string $geodir_facebook Facebook link.  | 
                                                        |
| 118 | + * @type string $geodir_video Video link.  | 
                                                        |
| 119 | + * @type string $geodir_special_offers Speacial offers.  | 
                                                        |
| 120 | + * @type string $post_images Post image urls.  | 
                                                        |
| 121 | + * @type string $post_imagesimage_limit Post images limit.  | 
                                                        |
| 122 | + * @type string $post_imagestotImg Todo Desc needed.  | 
                                                        |
| 123 | + * @type string $geodir_accept_term_condition Has accepted terms and conditions?.  | 
                                                        |
| 124 | + * @type string $geodir_spamblocker Todo Desc needed.  | 
                                                        |
| 125 | + * @type string $geodir_filled_by_spam_bot Todo Desc needed.  | 
                                                        |
| 126 | + *  | 
                                                        |
| 127 | + * }  | 
                                                        |
| 128 | + * @param bool $dummy Optional. Is this a dummy listing? Default false.  | 
                                                        |
| 129 | + * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.  | 
                                                        |
| 130 | + * @return int|string|WP_Error Created post id or WP_Error on failure.  | 
                                                        |
| 131 | + */  | 
                                                        |
| 132 | + function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)  | 
                                                        |
| 133 | +	{
 | 
                                                        |
| 134 | + global $wpdb, $current_user, $gd_session;  | 
                                                        |
| 135 | +  | 
                                                        |
| 136 | + $last_post_id = '';  | 
                                                        |
| 137 | +  | 
                                                        |
| 138 | +		if ($gd_session->get('listing') && !$dummy) {
 | 
                                                        |
| 139 | + $request_info = array();  | 
                                                        |
| 140 | +			$request_session = $gd_session->get('listing');
 | 
                                                        |
| 141 | + $request_info = array_merge($_REQUEST, $request_session);  | 
                                                        |
| 142 | +		} else if (!$gd_session->get('listing') && !$dummy) {
 | 
                                                        |
| 143 | + global $post;  | 
                                                        |
| 144 | + $request_info['pid'] = !empty($post->ID) ? $post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);  | 
                                                        |
| 145 | + $request_info['post_title'] = $request_info['post_title'];  | 
                                                        |
| 146 | + $request_info['listing_type'] = $post->post_type;  | 
                                                        |
| 147 | + $request_info['post_desc'] = $request_info['content'];  | 
                                                        |
| 148 | +		} else if (!$dummy) {
 | 
                                                        |
| 149 | + return false;  | 
                                                        |
| 150 | + }  | 
                                                        |
| 151 | +  | 
                                                        |
| 152 | + /**  | 
                                                        |
| 153 | + * Filter the request_info array.  | 
                                                        |
| 154 | + *  | 
                                                        |
| 155 | + * You can use this filter to modify request_info array.  | 
                                                        |
| 156 | + *  | 
                                                        |
| 157 | + * @since 1.0.0  | 
                                                        |
| 158 | + * @package GeoDirectory  | 
                                                        |
| 159 | +		 * @param array $request_info See {@see geodir_save_listing()} for accepted args.
 | 
                                                        |
| 160 | + */  | 
                                                        |
| 161 | +		$request_info = apply_filters('geodir_action_get_request_info', $request_info);
 | 
                                                        |
| 162 | +  | 
                                                        |
| 163 | + // Check if we need to save post location as new location  | 
                                                        |
| 164 | + $location_result = geodir_get_default_location();  | 
                                                        |
| 165 | +  | 
                                                        |
| 166 | +		if ($location_result->location_id > 0) {
 | 
                                                        |
| 167 | +			if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
 | 
                                                        |
| 168 | + $request_info['post_location'] = array(  | 
                                                        |
| 169 | + 'city' => $request_info['post_city'],  | 
                                                        |
| 170 | + 'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',  | 
                                                        |
| 171 | + 'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',  | 
                                                        |
| 172 | + 'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',  | 
                                                        |
| 173 | + 'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''  | 
                                                        |
| 174 | + );  | 
                                                        |
| 175 | +  | 
                                                        |
| 176 | + $post_location_info = $request_info['post_location'];  | 
                                                        |
| 177 | +  | 
                                                        |
| 178 | +				if ($location_id = geodir_add_new_location($post_location_info)) {
 | 
                                                        |
| 179 | + $post_location_id = $location_id;  | 
                                                        |
| 180 | + }  | 
                                                        |
| 181 | +			} else {
 | 
                                                        |
| 182 | + $post_location_id = $location_result->location_id;  | 
                                                        |
| 183 | + }  | 
                                                        |
| 184 | +		} else {
 | 
                                                        |
| 185 | + $post_location_id = $location_result->location_id;  | 
                                                        |
| 186 | + }  | 
                                                        |
| 226 | 187 | |
| 227 | - $send_post_submit_mail = false;  | 
                                                        |
| 188 | +		if ($dummy) {
 | 
                                                        |
| 189 | + $post_status = 'publish';  | 
                                                        |
| 190 | +		} else {
 | 
                                                        |
| 191 | + $post_status = geodir_new_post_default_status();  | 
                                                        |
| 192 | + }  | 
                                                        |
| 228 | 193 | |
| 229 | - // unhook this function so it doesn't loop infinitely  | 
                                                        |
| 230 | -        remove_action('save_post', 'geodir_post_information_save',10,2);
 | 
                                                        |
| 194 | +		if (isset($request_info['pid']) && $request_info['pid'] != '') {
 | 
                                                        |
| 195 | + $post_status = get_post_status($request_info['pid']);  | 
                                                        |
| 196 | + }  | 
                                                        |
| 231 | 197 | |
| 232 | -        if (isset($request_info['pid']) && $request_info['pid'] != '') {
 | 
                                                        |
| 233 | - $post['ID'] = $request_info['pid'];  | 
                                                        |
| 198 | + /* fix change of slug on every title edit */  | 
                                                        |
| 199 | +		if (!isset($request_info['post_name'])) {
 | 
                                                        |
| 200 | + $request_info['post_name'] = $request_info['post_title'];  | 
                                                        |
| 234 | 201 | |
| 235 | - $last_post_id = wp_update_post($post, $wp_error);  | 
                                                        |
| 236 | -        } else {
 | 
                                                        |
| 237 | - $last_post_id = wp_insert_post($post, $wp_error);  | 
                                                        |
| 202 | +			if (!empty($request_info['pid'])) {
 | 
                                                        |
| 203 | + $post_info = get_post($request_info['pid']);  | 
                                                        |
| 238 | 204 | |
| 239 | -            if (!$dummy && $last_post_id) {
 | 
                                                        |
| 240 | - $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)  | 
                                                        |
| 241 | -                //geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
 | 
                                                        |
| 242 | - }  | 
                                                        |
| 243 | - }  | 
                                                        |
| 205 | +				if (!empty($post_info) && isset($post_info->post_name)) {
 | 
                                                        |
| 206 | + $request_info['post_name'] = $post_info->post_name;  | 
                                                        |
| 207 | + }  | 
                                                        |
| 208 | + }  | 
                                                        |
| 209 | + }  | 
                                                        |
| 210 | +  | 
                                                        |
| 211 | + $post = array(  | 
                                                        |
| 212 | + 'post_content' => $request_info['post_desc'],  | 
                                                        |
| 213 | + 'post_status' => $post_status,  | 
                                                        |
| 214 | + 'post_title' => $request_info['post_title'],  | 
                                                        |
| 215 | + 'post_name' => $request_info['post_name'],  | 
                                                        |
| 216 | + 'post_type' => $request_info['listing_type']  | 
                                                        |
| 217 | + );  | 
                                                        |
| 218 | +  | 
                                                        |
| 219 | + /**  | 
                                                        |
| 220 | + * Called before a listing is saved to the database.  | 
                                                        |
| 221 | + *  | 
                                                        |
| 222 | + * @since 1.0.0  | 
                                                        |
| 223 | + * @param object $post The post object.  | 
                                                        |
| 224 | + */  | 
                                                        |
| 225 | +		do_action_ref_array('geodir_before_save_listing', $post);
 | 
                                                        |
| 226 | +  | 
                                                        |
| 227 | + $send_post_submit_mail = false;  | 
                                                        |
| 228 | +  | 
                                                        |
| 229 | + // unhook this function so it doesn't loop infinitely  | 
                                                        |
| 230 | +		remove_action('save_post', 'geodir_post_information_save',10,2);
 | 
                                                        |
| 231 | +  | 
                                                        |
| 232 | +		if (isset($request_info['pid']) && $request_info['pid'] != '') {
 | 
                                                        |
| 233 | + $post['ID'] = $request_info['pid'];  | 
                                                        |
| 234 | +  | 
                                                        |
| 235 | + $last_post_id = wp_update_post($post, $wp_error);  | 
                                                        |
| 236 | +		} else {
 | 
                                                        |
| 237 | + $last_post_id = wp_insert_post($post, $wp_error);  | 
                                                        |
| 238 | +  | 
                                                        |
| 239 | +			if (!$dummy && $last_post_id) {
 | 
                                                        |
| 240 | + $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)  | 
                                                        |
| 241 | +				//geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
 | 
                                                        |
| 242 | + }  | 
                                                        |
| 243 | + }  | 
                                                        |
| 244 | 244 | |
| 245 | -        if ($wp_error && is_wp_error($last_post_id)) {
 | 
                                                        |
| 246 | - return $last_post_id; // Return WP_Error on save failure.  | 
                                                        |
| 247 | - }  | 
                                                        |
| 245 | +		if ($wp_error && is_wp_error($last_post_id)) {
 | 
                                                        |
| 246 | + return $last_post_id; // Return WP_Error on save failure.  | 
                                                        |
| 247 | + }  | 
                                                        |
| 248 | 248 | |
| 249 | -        if (!$last_post_id) {
 | 
                                                        |
| 250 | - return false; // Save failure.  | 
                                                        |
| 251 | - }  | 
                                                        |
| 249 | +		if (!$last_post_id) {
 | 
                                                        |
| 250 | + return false; // Save failure.  | 
                                                        |
| 251 | + }  | 
                                                        |
| 252 | 252 | |
| 253 | - // re-hook this function  | 
                                                        |
| 254 | -        add_action('save_post', 'geodir_post_information_save',10,2);
 | 
                                                        |
| 253 | + // re-hook this function  | 
                                                        |
| 254 | +		add_action('save_post', 'geodir_post_information_save',10,2);
 | 
                                                        |
| 255 | 255 | |
| 256 | - $post_tags = '';  | 
                                                        |
| 257 | -        if (!isset($request_info['post_tags'])) {
 | 
                                                        |
| 256 | + $post_tags = '';  | 
                                                        |
| 257 | +		if (!isset($request_info['post_tags'])) {
 | 
                                                        |
| 258 | 258 | |
| 259 | - $post_type = $request_info['listing_type'];  | 
                                                        |
| 260 | -            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
 | 
                                                        |
| 259 | + $post_type = $request_info['listing_type'];  | 
                                                        |
| 260 | +			$post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
 | 
                                                        |
| 261 | 261 | |
| 262 | - }  | 
                                                        |
| 262 | + }  | 
                                                        |
| 263 | 263 | |
| 264 | - $gd_post_info = array(  | 
                                                        |
| 265 | - "post_title" => $request_info['post_title'],  | 
                                                        |
| 266 | - "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,  | 
                                                        |
| 267 | - "post_status" => $post_status,  | 
                                                        |
| 268 | - "post_location_id" => $post_location_id,  | 
                                                        |
| 269 | - "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',  | 
                                                        |
| 270 | - "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',  | 
                                                        |
| 271 | - "submit_time" => time(),  | 
                                                        |
| 272 | - "submit_ip" => $_SERVER['REMOTE_ADDR'],  | 
                                                        |
| 273 | - );  | 
                                                        |
| 264 | + $gd_post_info = array(  | 
                                                        |
| 265 | + "post_title" => $request_info['post_title'],  | 
                                                        |
| 266 | + "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,  | 
                                                        |
| 267 | + "post_status" => $post_status,  | 
                                                        |
| 268 | + "post_location_id" => $post_location_id,  | 
                                                        |
| 269 | + "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',  | 
                                                        |
| 270 | + "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',  | 
                                                        |
| 271 | + "submit_time" => time(),  | 
                                                        |
| 272 | + "submit_ip" => $_SERVER['REMOTE_ADDR'],  | 
                                                        |
| 273 | + );  | 
                                                        |
| 274 | 274 | |
| 275 | - $payment_info = array();  | 
                                                        |
| 276 | - $package_info = array();  | 
                                                        |
| 275 | + $payment_info = array();  | 
                                                        |
| 276 | + $package_info = array();  | 
                                                        |
| 277 | 277 | |
| 278 | - $package_info = (array)geodir_post_package_info($package_info, $post);  | 
                                                        |
| 278 | + $package_info = (array)geodir_post_package_info($package_info, $post);  | 
                                                        |
| 279 | 279 | |
| 280 | - $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');  | 
                                                        |
| 280 | + $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');  | 
                                                        |
| 281 | 281 | |
| 282 | -        if (!empty($package_info) && !$post_package_id) {
 | 
                                                        |
| 283 | -            if (isset($package_info['days']) && $package_info['days'] != 0) {
 | 
                                                        |
| 284 | -                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
 | 
                                                        |
| 285 | -            } else {
 | 
                                                        |
| 286 | - $payment_info['expire_date'] = 'Never';  | 
                                                        |
| 287 | - }  | 
                                                        |
| 282 | +		if (!empty($package_info) && !$post_package_id) {
 | 
                                                        |
| 283 | +			if (isset($package_info['days']) && $package_info['days'] != 0) {
 | 
                                                        |
| 284 | +				$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
 | 
                                                        |
| 285 | +			} else {
 | 
                                                        |
| 286 | + $payment_info['expire_date'] = 'Never';  | 
                                                        |
| 287 | + }  | 
                                                        |
| 288 | 288 | |
| 289 | - $payment_info['package_id'] = $package_info['pid'];  | 
                                                        |
| 290 | - $payment_info['alive_days'] = $package_info['days'];  | 
                                                        |
| 291 | - $payment_info['is_featured'] = $package_info['is_featured'];  | 
                                                        |
| 289 | + $payment_info['package_id'] = $package_info['pid'];  | 
                                                        |
| 290 | + $payment_info['alive_days'] = $package_info['days'];  | 
                                                        |
| 291 | + $payment_info['is_featured'] = $package_info['is_featured'];  | 
                                                        |
| 292 | 292 | |
| 293 | - $gd_post_info = array_merge($gd_post_info, $payment_info);  | 
                                                        |
| 294 | - }  | 
                                                        |
| 293 | + $gd_post_info = array_merge($gd_post_info, $payment_info);  | 
                                                        |
| 294 | + }  | 
                                                        |
| 295 | 295 | |
| 296 | -        $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
 | 
                                                        |
| 296 | +		$custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
 | 
                                                        |
| 297 | 297 | |
| 298 | - foreach ($custom_metaboxes as $key => $val):  | 
                                                        |
| 298 | + foreach ($custom_metaboxes as $key => $val):  | 
                                                        |
| 299 | 299 | |
| 300 | - $name = $val['name'];  | 
                                                        |
| 301 | - $type = $val['type'];  | 
                                                        |
| 302 | - $extrafields = $val['extra_fields'];  | 
                                                        |
| 300 | + $name = $val['name'];  | 
                                                        |
| 301 | + $type = $val['type'];  | 
                                                        |
| 302 | + $extrafields = $val['extra_fields'];  | 
                                                        |
| 303 | 303 | |
| 304 | -            if (trim($type) == 'address') {
 | 
                                                        |
| 305 | - $prefix = $name . '_';  | 
                                                        |
| 306 | - $address = $prefix . 'address';  | 
                                                        |
| 304 | +			if (trim($type) == 'address') {
 | 
                                                        |
| 305 | + $prefix = $name . '_';  | 
                                                        |
| 306 | + $address = $prefix . 'address';  | 
                                                        |
| 307 | 307 | |
| 308 | -                if (isset($request_info[$address]) && $request_info[$address] != '') {
 | 
                                                        |
| 309 | - $gd_post_info[$address] = wp_slash($request_info[$address]);  | 
                                                        |
| 310 | - }  | 
                                                        |
| 308 | +				if (isset($request_info[$address]) && $request_info[$address] != '') {
 | 
                                                        |
| 309 | + $gd_post_info[$address] = wp_slash($request_info[$address]);  | 
                                                        |
| 310 | + }  | 
                                                        |
| 311 | 311 | |
| 312 | -                if ($extrafields != '') {
 | 
                                                        |
| 313 | - $extrafields = unserialize($extrafields);  | 
                                                        |
| 312 | +				if ($extrafields != '') {
 | 
                                                        |
| 313 | + $extrafields = unserialize($extrafields);  | 
                                                        |
| 314 | 314 | |
| 315 | 315 | |
| 316 | -                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
 | 
                                                        |
| 316 | +					if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
 | 
                                                        |
| 317 | 317 | |
| 318 | - $location_result = geodir_get_default_location();  | 
                                                        |
| 318 | + $location_result = geodir_get_default_location();  | 
                                                        |
| 319 | 319 | |
| 320 | - $gd_post_info[$prefix . 'city'] = $location_result->city;  | 
                                                        |
| 321 | - $gd_post_info[$prefix . 'region'] = $location_result->region;  | 
                                                        |
| 322 | - $gd_post_info[$prefix . 'country'] = $location_result->country;  | 
                                                        |
| 320 | + $gd_post_info[$prefix . 'city'] = $location_result->city;  | 
                                                        |
| 321 | + $gd_post_info[$prefix . 'region'] = $location_result->region;  | 
                                                        |
| 322 | + $gd_post_info[$prefix . 'country'] = $location_result->country;  | 
                                                        |
| 323 | 323 | |
| 324 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location  | 
                                                        |
| 324 | + $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location  | 
                                                        |
| 325 | 325 | |
| 326 | -                    } else {
 | 
                                                        |
| 326 | +					} else {
 | 
                                                        |
| 327 | 327 | |
| 328 | - $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];  | 
                                                        |
| 329 | - $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];  | 
                                                        |
| 330 | - $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];  | 
                                                        |
| 328 | + $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];  | 
                                                        |
| 329 | + $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];  | 
                                                        |
| 330 | + $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];  | 
                                                        |
| 331 | 331 | |
| 332 | - //----------set post locations when import dummy data-------  | 
                                                        |
| 333 | - $location_result = geodir_get_default_location();  | 
                                                        |
| 332 | + //----------set post locations when import dummy data-------  | 
                                                        |
| 333 | + $location_result = geodir_get_default_location();  | 
                                                        |
| 334 | 334 | |
| 335 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location  | 
                                                        |
| 336 | - //-----------------------------------------------------------------  | 
                                                        |
| 335 | + $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location  | 
                                                        |
| 336 | + //-----------------------------------------------------------------  | 
                                                        |
| 337 | 337 | |
| 338 | - }  | 
                                                        |
| 338 | + }  | 
                                                        |
| 339 | 339 | |
| 340 | 340 | |
| 341 | -                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
 | 
                                                        |
| 342 | - $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];  | 
                                                        |
| 343 | - }  | 
                                                        |
| 341 | +					if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
 | 
                                                        |
| 342 | + $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];  | 
                                                        |
| 343 | + }  | 
                                                        |
| 344 | 344 | |
| 345 | 345 | |
| 346 | -                    if (isset($extrafields['show_map']) && $extrafields['show_map']) {
 | 
                                                        |
| 346 | +					if (isset($extrafields['show_map']) && $extrafields['show_map']) {
 | 
                                                        |
| 347 | 347 | |
| 348 | -                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
 | 
                                                        |
| 349 | - $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];  | 
                                                        |
| 350 | - }  | 
                                                        |
| 348 | +						if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
 | 
                                                        |
| 349 | + $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];  | 
                                                        |
| 350 | + }  | 
                                                        |
| 351 | 351 | |
| 352 | -                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
 | 
                                                        |
| 353 | - $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];  | 
                                                        |
| 354 | - }  | 
                                                        |
| 352 | +						if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
 | 
                                                        |
| 353 | + $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];  | 
                                                        |
| 354 | + }  | 
                                                        |
| 355 | 355 | |
| 356 | -                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
 | 
                                                        |
| 357 | - $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];  | 
                                                        |
| 358 | - }  | 
                                                        |
| 356 | +						if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
 | 
                                                        |
| 357 | + $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];  | 
                                                        |
| 358 | + }  | 
                                                        |
| 359 | 359 | |
| 360 | -                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
 | 
                                                        |
| 361 | - $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];  | 
                                                        |
| 362 | - }  | 
                                                        |
| 360 | +						if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
 | 
                                                        |
| 361 | + $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];  | 
                                                        |
| 362 | + }  | 
                                                        |
| 363 | 363 | |
| 364 | - }  | 
                                                        |
| 364 | + }  | 
                                                        |
| 365 | 365 | |
| 366 | - // show lat lng  | 
                                                        |
| 367 | -                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
 | 
                                                        |
| 368 | - $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];  | 
                                                        |
| 369 | - }  | 
                                                        |
| 370 | - }  | 
                                                        |
| 366 | + // show lat lng  | 
                                                        |
| 367 | +					if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
 | 
                                                        |
| 368 | + $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];  | 
                                                        |
| 369 | + }  | 
                                                        |
| 370 | + }  | 
                                                        |
| 371 | 371 | |
| 372 | -            } elseif (trim($type) == 'file') {
 | 
                                                        |
| 373 | -                if (isset($request_info[$name])) {
 | 
                                                        |
| 374 | - $request_files = array();  | 
                                                        |
| 375 | - if ($request_info[$name] != '')  | 
                                                        |
| 376 | -                        $request_files = explode(",", $request_info[$name]);
 | 
                                                        |
| 372 | +			} elseif (trim($type) == 'file') {
 | 
                                                        |
| 373 | +				if (isset($request_info[$name])) {
 | 
                                                        |
| 374 | + $request_files = array();  | 
                                                        |
| 375 | + if ($request_info[$name] != '')  | 
                                                        |
| 376 | +						$request_files = explode(",", $request_info[$name]);
 | 
                                                        |
| 377 | 377 | |
| 378 | - $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;  | 
                                                        |
| 379 | - geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);  | 
                                                        |
| 378 | + $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;  | 
                                                        |
| 379 | + geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);  | 
                                                        |
| 380 | 380 | |
| 381 | - }  | 
                                                        |
| 382 | -            } elseif (trim($type) == 'datepicker') {
 | 
                                                        |
| 383 | - $datetime = '';  | 
                                                        |
| 384 | -                if (isset($request_info[$name]) && $request_info[$name] != '') {
 | 
                                                        |
| 385 | - $date_format = geodir_default_date_format();  | 
                                                        |
| 386 | -                    if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
 | 
                                                        |
| 387 | - $extra_fields = unserialize($val['extra_fields']);  | 
                                                        |
| 388 | - $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;  | 
                                                        |
| 389 | - }  | 
                                                        |
| 381 | + }  | 
                                                        |
| 382 | +			} elseif (trim($type) == 'datepicker') {
 | 
                                                        |
| 383 | + $datetime = '';  | 
                                                        |
| 384 | +				if (isset($request_info[$name]) && $request_info[$name] != '') {
 | 
                                                        |
| 385 | + $date_format = geodir_default_date_format();  | 
                                                        |
| 386 | +					if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
 | 
                                                        |
| 387 | + $extra_fields = unserialize($val['extra_fields']);  | 
                                                        |
| 388 | + $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;  | 
                                                        |
| 389 | + }  | 
                                                        |
| 390 | 390 | |
| 391 | - // check if we need to change the format or not  | 
                                                        |
| 392 | -                    $date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        |
| 393 | -                    if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 391 | + // check if we need to change the format or not  | 
                                                        |
| 392 | +					$date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        |
| 393 | +					if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 394 | 394 | |
| 395 | -                        $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 396 | -                        $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 395 | +						$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 396 | +						$replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 397 | 397 | |
| 398 | - $date_format = str_replace($search, $replace, $date_format);  | 
                                                        |
| 398 | + $date_format = str_replace($search, $replace, $date_format);  | 
                                                        |
| 399 | 399 | |
| 400 | -                        $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
 | 
                                                        |
| 400 | +						$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
 | 
                                                        |
| 401 | 401 | |
| 402 | -                    }else{
 | 
                                                        |
| 403 | - $post_htmlvar_value = $request_info[$name];  | 
                                                        |
| 404 | - }  | 
                                                        |
| 402 | +					}else{
 | 
                                                        |
| 403 | + $post_htmlvar_value = $request_info[$name];  | 
                                                        |
| 404 | + }  | 
                                                        |
| 405 | 405 | |
| 406 | - $post_htmlvar_value = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated  | 
                                                        |
| 406 | + $post_htmlvar_value = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated  | 
                                                        |
| 407 | 407 | |
| 408 | -                    $datetime = date("Y-m-d", strtotime($post_htmlvar_value)); // save as sql format Y-m-d
 | 
                                                        |
| 408 | +					$datetime = date("Y-m-d", strtotime($post_htmlvar_value)); // save as sql format Y-m-d
 | 
                                                        |
| 409 | 409 | |
| 410 | - }  | 
                                                        |
| 411 | - $gd_post_info[$name] = $datetime;  | 
                                                        |
| 412 | -            } else if ($type == 'multiselect') {
 | 
                                                        |
| 413 | -                if (isset($request_info[$name])) {
 | 
                                                        |
| 414 | - $gd_post_info[$name] = $request_info[$name];  | 
                                                        |
| 415 | -                } else {
 | 
                                                        |
| 416 | -                    if (isset($request_info['gd_field_' . $name])) {
 | 
                                                        |
| 417 | - $gd_post_info[$name] = ''; /* fix de-select for multiselect */  | 
                                                        |
| 418 | - }  | 
                                                        |
| 419 | - }  | 
                                                        |
| 420 | -            } else if (isset($request_info[$name])) {
 | 
                                                        |
| 421 | - $gd_post_info[$name] = $request_info[$name];  | 
                                                        |
| 422 | - }  | 
                                                        |
| 410 | + }  | 
                                                        |
| 411 | + $gd_post_info[$name] = $datetime;  | 
                                                        |
| 412 | +			} else if ($type == 'multiselect') {
 | 
                                                        |
| 413 | +				if (isset($request_info[$name])) {
 | 
                                                        |
| 414 | + $gd_post_info[$name] = $request_info[$name];  | 
                                                        |
| 415 | +				} else {
 | 
                                                        |
| 416 | +					if (isset($request_info['gd_field_' . $name])) {
 | 
                                                        |
| 417 | + $gd_post_info[$name] = ''; /* fix de-select for multiselect */  | 
                                                        |
| 418 | + }  | 
                                                        |
| 419 | + }  | 
                                                        |
| 420 | +			} else if (isset($request_info[$name])) {
 | 
                                                        |
| 421 | + $gd_post_info[$name] = $request_info[$name];  | 
                                                        |
| 422 | + }  | 
                                                        |
| 423 | 423 | |
| 424 | - endforeach;  | 
                                                        |
| 424 | + endforeach;  | 
                                                        |
| 425 | 425 | |
| 426 | -        if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
 | 
                                                        |
| 427 | - $gd_post_info['post_dummy'] = $request_info['post_dummy'];  | 
                                                        |
| 428 | - }  | 
                                                        |
| 426 | +		if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
 | 
                                                        |
| 427 | + $gd_post_info['post_dummy'] = $request_info['post_dummy'];  | 
                                                        |
| 428 | + }  | 
                                                        |
| 429 | 429 | |
| 430 | - // Save post detail info in detail table  | 
                                                        |
| 431 | -        if (!empty($gd_post_info)) {
 | 
                                                        |
| 432 | - geodir_save_post_info($last_post_id, $gd_post_info);  | 
                                                        |
| 433 | - }  | 
                                                        |
| 430 | + // Save post detail info in detail table  | 
                                                        |
| 431 | +		if (!empty($gd_post_info)) {
 | 
                                                        |
| 432 | + geodir_save_post_info($last_post_id, $gd_post_info);  | 
                                                        |
| 433 | + }  | 
                                                        |
| 434 | 434 | |
| 435 | 435 | |
| 436 | - // Set categories to the listing  | 
                                                        |
| 437 | -        if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
 | 
                                                        |
| 438 | - $post_category = array();  | 
                                                        |
| 436 | + // Set categories to the listing  | 
                                                        |
| 437 | +		if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
 | 
                                                        |
| 438 | + $post_category = array();  | 
                                                        |
| 439 | 439 | |
| 440 | -            foreach ($request_info['post_category'] as $taxonomy => $cat) {
 | 
                                                        |
| 440 | +			foreach ($request_info['post_category'] as $taxonomy => $cat) {
 | 
                                                        |
| 441 | 441 | |
| 442 | - if ($dummy)  | 
                                                        |
| 443 | - $post_category = $cat;  | 
                                                        |
| 444 | -                else {
 | 
                                                        |
| 442 | + if ($dummy)  | 
                                                        |
| 443 | + $post_category = $cat;  | 
                                                        |
| 444 | +				else {
 | 
                                                        |
| 445 | 445 | |
| 446 | - if (!is_array($cat) && strstr($cat, ','))  | 
                                                        |
| 447 | -                        $cat = explode(',', $cat);
 | 
                                                        |
| 446 | + if (!is_array($cat) && strstr($cat, ','))  | 
                                                        |
| 447 | +						$cat = explode(',', $cat);
 | 
                                                        |
| 448 | 448 | |
| 449 | - if (!empty($cat) && is_array($cat))  | 
                                                        |
| 450 | -                        $post_category = array_map('intval', $cat);
 | 
                                                        |
| 451 | - }  | 
                                                        |
| 449 | + if (!empty($cat) && is_array($cat))  | 
                                                        |
| 450 | +						$post_category = array_map('intval', $cat);
 | 
                                                        |
| 451 | + }  | 
                                                        |
| 452 | 452 | |
| 453 | - wp_set_object_terms($last_post_id, $post_category, $taxonomy);  | 
                                                        |
| 454 | - }  | 
                                                        |
| 453 | + wp_set_object_terms($last_post_id, $post_category, $taxonomy);  | 
                                                        |
| 454 | + }  | 
                                                        |
| 455 | 455 | |
| 456 | - $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';  | 
                                                        |
| 456 | + $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';  | 
                                                        |
| 457 | 457 | |
| 458 | - $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';  | 
                                                        |
| 459 | - geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);  | 
                                                        |
| 458 | + $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';  | 
                                                        |
| 459 | + geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);  | 
                                                        |
| 460 | 460 | |
| 461 | - }  | 
                                                        |
| 461 | + }  | 
                                                        |
| 462 | 462 | |
| 463 | - $post_tags = '';  | 
                                                        |
| 464 | - // Set tags to the listing  | 
                                                        |
| 465 | -        if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
 | 
                                                        |
| 466 | -            $post_tags = explode(",", $request_info['post_tags']);
 | 
                                                        |
| 467 | -        } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
 | 
                                                        |
| 468 | - if ($dummy)  | 
                                                        |
| 469 | - $post_tags = $request_info['post_tags'];  | 
                                                        |
| 470 | -        } else {
 | 
                                                        |
| 471 | - if ($dummy)  | 
                                                        |
| 472 | - $post_tags = array($request_info['post_title']);  | 
                                                        |
| 473 | - }  | 
                                                        |
| 463 | + $post_tags = '';  | 
                                                        |
| 464 | + // Set tags to the listing  | 
                                                        |
| 465 | +		if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
 | 
                                                        |
| 466 | +			$post_tags = explode(",", $request_info['post_tags']);
 | 
                                                        |
| 467 | +		} elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
 | 
                                                        |
| 468 | + if ($dummy)  | 
                                                        |
| 469 | + $post_tags = $request_info['post_tags'];  | 
                                                        |
| 470 | +		} else {
 | 
                                                        |
| 471 | + if ($dummy)  | 
                                                        |
| 472 | + $post_tags = array($request_info['post_title']);  | 
                                                        |
| 473 | + }  | 
                                                        |
| 474 | 474 | |
| 475 | -        if (is_array($post_tags)) {
 | 
                                                        |
| 476 | - $taxonomy = $request_info['listing_type'] . '_tags';  | 
                                                        |
| 477 | - wp_set_object_terms($last_post_id, $post_tags, $taxonomy);  | 
                                                        |
| 478 | - }  | 
                                                        |
| 475 | +		if (is_array($post_tags)) {
 | 
                                                        |
| 476 | + $taxonomy = $request_info['listing_type'] . '_tags';  | 
                                                        |
| 477 | + wp_set_object_terms($last_post_id, $post_tags, $taxonomy);  | 
                                                        |
| 478 | + }  | 
                                                        |
| 479 | 479 | |
| 480 | 480 | |
| 481 | - // Insert attechment  | 
                                                        |
| 481 | + // Insert attechment  | 
                                                        |
| 482 | 482 | |
| 483 | -        if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
 | 
                                                        |
| 484 | -            if (!$dummy) {
 | 
                                                        |
| 485 | - $tmpimgArr = trim($request_info['post_images'], ",");  | 
                                                        |
| 486 | -                $tmpimgArr = explode(",", $tmpimgArr);
 | 
                                                        |
| 487 | - geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);  | 
                                                        |
| 488 | -            } else{
 | 
                                                        |
| 489 | - geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);  | 
                                                        |
| 490 | - }  | 
                                                        |
| 483 | +		if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
 | 
                                                        |
| 484 | +			if (!$dummy) {
 | 
                                                        |
| 485 | + $tmpimgArr = trim($request_info['post_images'], ",");  | 
                                                        |
| 486 | +				$tmpimgArr = explode(",", $tmpimgArr);
 | 
                                                        |
| 487 | + geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);  | 
                                                        |
| 488 | +			} else{
 | 
                                                        |
| 489 | + geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);  | 
                                                        |
| 490 | + }  | 
                                                        |
| 491 | 491 | |
| 492 | 492 | |
| 493 | -        } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
 | 
                                                        |
| 493 | +		} elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
 | 
                                                        |
| 494 | 494 | |
| 495 | - /* Delete Attachments  | 
                                                        |
| 495 | + /* Delete Attachments  | 
                                                        |
| 496 | 496 | $postcurr_images = geodir_get_images($last_post_id);  | 
                                                        
| 497 | 497 | |
| 498 | 498 | $wpdb->query(  | 
                                                        
@@ -508,34 +508,34 @@ discard block  | 
                                                    ||
| 508 | 508 | geodir_save_post_info($last_post_id, $gd_post_featured_img);  | 
                                                        
| 509 | 509 | */  | 
                                                        
| 510 | 510 | |
| 511 | - }  | 
                                                        |
| 511 | + }  | 
                                                        |
| 512 | 512 | |
| 513 | - geodir_remove_temp_images();  | 
                                                        |
| 514 | - geodir_set_wp_featured_image($last_post_id);  | 
                                                        |
| 513 | + geodir_remove_temp_images();  | 
                                                        |
| 514 | + geodir_set_wp_featured_image($last_post_id);  | 
                                                        |
| 515 | 515 | |
| 516 | - /**  | 
                                                        |
| 517 | - * Called after a listing is saved to the database and before any email have been sent.  | 
                                                        |
| 518 | - *  | 
                                                        |
| 519 | - * @since 1.0.0  | 
                                                        |
| 520 | - * @param int $last_post_id The saved post ID.  | 
                                                        |
| 521 | - * @param array $request_info The post details in an array.  | 
                                                        |
| 522 | - * @see 'geodir_after_save_listinginfo'  | 
                                                        |
| 523 | - */  | 
                                                        |
| 524 | -        do_action('geodir_after_save_listing', $last_post_id, $request_info);
 | 
                                                        |
| 516 | + /**  | 
                                                        |
| 517 | + * Called after a listing is saved to the database and before any email have been sent.  | 
                                                        |
| 518 | + *  | 
                                                        |
| 519 | + * @since 1.0.0  | 
                                                        |
| 520 | + * @param int $last_post_id The saved post ID.  | 
                                                        |
| 521 | + * @param array $request_info The post details in an array.  | 
                                                        |
| 522 | + * @see 'geodir_after_save_listinginfo'  | 
                                                        |
| 523 | + */  | 
                                                        |
| 524 | +		do_action('geodir_after_save_listing', $last_post_id, $request_info);
 | 
                                                        |
| 525 | 525 | |
| 526 | - //die;  | 
                                                        |
| 526 | + //die;  | 
                                                        |
| 527 | 527 | |
| 528 | -        if ($send_post_submit_mail) { // if new post send out email
 | 
                                                        |
| 529 | - $to_name = geodir_get_client_name($current_user->ID);  | 
                                                        |
| 530 | -            geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
 | 
                                                        |
| 531 | - }  | 
                                                        |
| 532 | - /*  | 
                                                        |
| 528 | +		if ($send_post_submit_mail) { // if new post send out email
 | 
                                                        |
| 529 | + $to_name = geodir_get_client_name($current_user->ID);  | 
                                                        |
| 530 | +			geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
 | 
                                                        |
| 531 | + }  | 
                                                        |
| 532 | + /*  | 
                                                        |
| 533 | 533 | * Unset the session so we don't loop.  | 
                                                        
| 534 | 534 | */  | 
                                                        
| 535 | -        $gd_session->un_set('listing');
 | 
                                                        |
| 536 | - return $last_post_id;  | 
                                                        |
| 535 | +		$gd_session->un_set('listing');
 | 
                                                        |
| 536 | + return $last_post_id;  | 
                                                        |
| 537 | 537 | |
| 538 | - }  | 
                                                        |
| 538 | + }  | 
                                                        |
| 539 | 539 | |
| 540 | 540 | }  | 
                                                        
| 541 | 541 | |
@@ -554,586 +554,586 @@ discard block  | 
                                                    ||
| 554 | 554 | function geodir_get_post_info($post_id = '')  | 
                                                        
| 555 | 555 |  {
 | 
                                                        
| 556 | 556 | |
| 557 | - global $wpdb, $plugin_prefix, $post, $post_info;  | 
                                                        |
| 557 | + global $wpdb, $plugin_prefix, $post, $post_info;  | 
                                                        |
| 558 | 558 | |
| 559 | - if ($post_id == '' && !empty($post))  | 
                                                        |
| 560 | - $post_id = $post->ID;  | 
                                                        |
| 559 | + if ($post_id == '' && !empty($post))  | 
                                                        |
| 560 | + $post_id = $post->ID;  | 
                                                        |
| 561 | 561 | |
| 562 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 562 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 563 | 563 | |
| 564 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 564 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 565 | 565 | |
| 566 | - if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 567 | - return false;  | 
                                                        |
| 566 | + if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 567 | + return false;  | 
                                                        |
| 568 | 568 | |
| 569 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 569 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 570 | 570 | |
| 571 | - /**  | 
                                                        |
| 572 | - * Apply Filter to change Post info  | 
                                                        |
| 573 | - *  | 
                                                        |
| 574 | - * You can use this filter to change Post info.  | 
                                                        |
| 575 | - *  | 
                                                        |
| 576 | - * @since 1.0.0  | 
                                                        |
| 577 | - * @package GeoDirectory  | 
                                                        |
| 578 | - */  | 
                                                        |
| 579 | -    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
 | 
                                                        |
| 571 | + /**  | 
                                                        |
| 572 | + * Apply Filter to change Post info  | 
                                                        |
| 573 | + *  | 
                                                        |
| 574 | + * You can use this filter to change Post info.  | 
                                                        |
| 575 | + *  | 
                                                        |
| 576 | + * @since 1.0.0  | 
                                                        |
| 577 | + * @package GeoDirectory  | 
                                                        |
| 578 | + */  | 
                                                        |
| 579 | +	$query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
 | 
                                                        |
| 580 | 580 | WHERE p.ID = pd.post_id  | 
                                                        
| 581 | 581 | AND post_id = " . $post_id);  | 
                                                        
| 582 | 582 | |
| 583 | - $post_detail = $wpdb->get_row($query);  | 
                                                        |
| 583 | + $post_detail = $wpdb->get_row($query);  | 
                                                        |
| 584 | 584 | |
| 585 | - return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;  | 
                                                        |
| 585 | + return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;  | 
                                                        |
| 586 | 586 | |
| 587 | 587 | }  | 
                                                        
| 588 | 588 | |
| 589 | 589 | |
| 590 | 590 |  if (!function_exists('geodir_save_post_info')) {
 | 
                                                        
| 591 | - /**  | 
                                                        |
| 592 | - * Saves post detail info in detail table.  | 
                                                        |
| 593 | - *  | 
                                                        |
| 594 | - * @since 1.0.0  | 
                                                        |
| 595 | - * @package GeoDirectory  | 
                                                        |
| 596 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 597 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 598 | - * @param int $post_id The post ID.  | 
                                                        |
| 599 | -     * @param array $postinfo_array {
 | 
                                                        |
| 600 | - * Post info that needs to be saved in detail table.  | 
                                                        |
| 601 | - *  | 
                                                        |
| 602 | - * @type string $post_title Listing title.  | 
                                                        |
| 603 | - * @type string $post_tags Listing tags.  | 
                                                        |
| 604 | - * @type string $post_status Listing post status.  | 
                                                        |
| 605 | - * @type string $post_location_id Listing location ID.  | 
                                                        |
| 606 | - * @type string $claimed Todo Desc needed.  | 
                                                        |
| 607 | - * @type string $businesses Todo Desc needed.  | 
                                                        |
| 608 | - * @type int $submit_time Submitted time in unix timestamp.  | 
                                                        |
| 609 | - * @type string $submit_ip Submitted IP.  | 
                                                        |
| 610 | - * @type string $expire_date Listing expiration date.  | 
                                                        |
| 611 | - * @type int $package_id Listing package ID.  | 
                                                        |
| 612 | - * @type int $alive_days Todo Desc needed.  | 
                                                        |
| 613 | - * @type int $is_featured Is this a featured listing?.  | 
                                                        |
| 614 | - * @type string $post_address Listing address.  | 
                                                        |
| 615 | - * @type string $post_city Listing city.  | 
                                                        |
| 616 | - * @type string $post_region Listing region.  | 
                                                        |
| 617 | - * @type string $post_country Listing country.  | 
                                                        |
| 618 | - * @type string $post_locations Listing locations.  | 
                                                        |
| 619 | - * @type string $post_zip Listing zip.  | 
                                                        |
| 620 | - * @type string $post_latitude Listing latitude.  | 
                                                        |
| 621 | - * @type string $post_longitude Listing longitude.  | 
                                                        |
| 622 | - * @type string $post_mapview Listing mapview. Default "ROADMAP".  | 
                                                        |
| 623 | - * @type string $post_mapzoom Listing mapzoom Default "9".  | 
                                                        |
| 624 | - * @type string $geodir_timing Business timing info.  | 
                                                        |
| 625 | - * @type string $geodir_contact Contact number.  | 
                                                        |
| 626 | - * @type string $geodir_email Business contact email.  | 
                                                        |
| 627 | - * @type string $geodir_website Business website.  | 
                                                        |
| 628 | - * @type string $geodir_twitter Twitter link.  | 
                                                        |
| 629 | - * @type string $geodir_facebook Facebook link.  | 
                                                        |
| 630 | - * @type string $geodir_video Video link.  | 
                                                        |
| 631 | - * @type string $geodir_special_offers Speacial offers.  | 
                                                        |
| 632 | - *  | 
                                                        |
| 633 | - * }  | 
                                                        |
| 634 | - * @return bool  | 
                                                        |
| 635 | - */  | 
                                                        |
| 636 | - function geodir_save_post_info($post_id, $postinfo_array = array())  | 
                                                        |
| 637 | -    {
 | 
                                                        |
| 638 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 639 | -  | 
                                                        |
| 640 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 641 | -  | 
                                                        |
| 642 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 643 | -  | 
                                                        |
| 644 | - /**  | 
                                                        |
| 645 | - * Filter to change Post info  | 
                                                        |
| 646 | - *  | 
                                                        |
| 647 | - * You can use this filter to change Post info.  | 
                                                        |
| 648 | - *  | 
                                                        |
| 649 | - * @since 1.0.0  | 
                                                        |
| 650 | - * @package GeoDirectory  | 
                                                        |
| 651 | -         * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
 | 
                                                        |
| 652 | - * @param int $post_id The post ID.  | 
                                                        |
| 653 | - */  | 
                                                        |
| 591 | + /**  | 
                                                        |
| 592 | + * Saves post detail info in detail table.  | 
                                                        |
| 593 | + *  | 
                                                        |
| 594 | + * @since 1.0.0  | 
                                                        |
| 595 | + * @package GeoDirectory  | 
                                                        |
| 596 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 597 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 598 | + * @param int $post_id The post ID.  | 
                                                        |
| 599 | +	 * @param array $postinfo_array {
 | 
                                                        |
| 600 | + * Post info that needs to be saved in detail table.  | 
                                                        |
| 601 | + *  | 
                                                        |
| 602 | + * @type string $post_title Listing title.  | 
                                                        |
| 603 | + * @type string $post_tags Listing tags.  | 
                                                        |
| 604 | + * @type string $post_status Listing post status.  | 
                                                        |
| 605 | + * @type string $post_location_id Listing location ID.  | 
                                                        |
| 606 | + * @type string $claimed Todo Desc needed.  | 
                                                        |
| 607 | + * @type string $businesses Todo Desc needed.  | 
                                                        |
| 608 | + * @type int $submit_time Submitted time in unix timestamp.  | 
                                                        |
| 609 | + * @type string $submit_ip Submitted IP.  | 
                                                        |
| 610 | + * @type string $expire_date Listing expiration date.  | 
                                                        |
| 611 | + * @type int $package_id Listing package ID.  | 
                                                        |
| 612 | + * @type int $alive_days Todo Desc needed.  | 
                                                        |
| 613 | + * @type int $is_featured Is this a featured listing?.  | 
                                                        |
| 614 | + * @type string $post_address Listing address.  | 
                                                        |
| 615 | + * @type string $post_city Listing city.  | 
                                                        |
| 616 | + * @type string $post_region Listing region.  | 
                                                        |
| 617 | + * @type string $post_country Listing country.  | 
                                                        |
| 618 | + * @type string $post_locations Listing locations.  | 
                                                        |
| 619 | + * @type string $post_zip Listing zip.  | 
                                                        |
| 620 | + * @type string $post_latitude Listing latitude.  | 
                                                        |
| 621 | + * @type string $post_longitude Listing longitude.  | 
                                                        |
| 622 | + * @type string $post_mapview Listing mapview. Default "ROADMAP".  | 
                                                        |
| 623 | + * @type string $post_mapzoom Listing mapzoom Default "9".  | 
                                                        |
| 624 | + * @type string $geodir_timing Business timing info.  | 
                                                        |
| 625 | + * @type string $geodir_contact Contact number.  | 
                                                        |
| 626 | + * @type string $geodir_email Business contact email.  | 
                                                        |
| 627 | + * @type string $geodir_website Business website.  | 
                                                        |
| 628 | + * @type string $geodir_twitter Twitter link.  | 
                                                        |
| 629 | + * @type string $geodir_facebook Facebook link.  | 
                                                        |
| 630 | + * @type string $geodir_video Video link.  | 
                                                        |
| 631 | + * @type string $geodir_special_offers Speacial offers.  | 
                                                        |
| 632 | + *  | 
                                                        |
| 633 | + * }  | 
                                                        |
| 634 | + * @return bool  | 
                                                        |
| 635 | + */  | 
                                                        |
| 636 | + function geodir_save_post_info($post_id, $postinfo_array = array())  | 
                                                        |
| 637 | +	{
 | 
                                                        |
| 638 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 639 | +  | 
                                                        |
| 640 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 641 | +  | 
                                                        |
| 642 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 643 | +  | 
                                                        |
| 644 | + /**  | 
                                                        |
| 645 | + * Filter to change Post info  | 
                                                        |
| 646 | + *  | 
                                                        |
| 647 | + * You can use this filter to change Post info.  | 
                                                        |
| 648 | + *  | 
                                                        |
| 649 | + * @since 1.0.0  | 
                                                        |
| 650 | + * @package GeoDirectory  | 
                                                        |
| 651 | +		 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
 | 
                                                        |
| 652 | + * @param int $post_id The post ID.  | 
                                                        |
| 653 | + */  | 
                                                        |
| 654 | +  | 
                                                        |
| 655 | +		$postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
 | 
                                                        |
| 656 | +  | 
                                                        |
| 657 | +		if (!empty($postmeta) && $post_id) {
 | 
                                                        |
| 658 | + $post_meta_set_query = '';  | 
                                                        |
| 659 | +  | 
                                                        |
| 660 | +			foreach ($postmeta as $mkey => $mval) {
 | 
                                                        |
| 661 | +				if (geodir_column_exist($table, $mkey)) {
 | 
                                                        |
| 662 | +					if (is_array($mval)) {
 | 
                                                        |
| 663 | +						$mval = implode(",", $mval);
 | 
                                                        |
| 664 | + }  | 
                                                        |
| 665 | +  | 
                                                        |
| 666 | + $post_meta_set_query .= $mkey . " = '" . $mval . "', ";  | 
                                                        |
| 667 | + }  | 
                                                        |
| 668 | + }  | 
                                                        |
| 654 | 669 | |
| 655 | -        $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
 | 
                                                        |
| 670 | + $post_meta_set_query = trim($post_meta_set_query, ", ");  | 
                                                        |
| 656 | 671 | |
| 657 | -        if (!empty($postmeta) && $post_id) {
 | 
                                                        |
| 658 | - $post_meta_set_query = '';  | 
                                                        |
| 672 | +			$post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
 | 
                                                        |
| 659 | 673 | |
| 660 | -            foreach ($postmeta as $mkey => $mval) {
 | 
                                                        |
| 661 | -                if (geodir_column_exist($table, $mkey)) {
 | 
                                                        |
| 662 | -                    if (is_array($mval)) {
 | 
                                                        |
| 663 | -                        $mval = implode(",", $mval);
 | 
                                                        |
| 664 | - }  | 
                                                        |
| 674 | + /**  | 
                                                        |
| 675 | + * Called before saving the listing info.  | 
                                                        |
| 676 | + *  | 
                                                        |
| 677 | + * @since 1.0.0  | 
                                                        |
| 678 | + * @package GeoDirectory  | 
                                                        |
| 679 | +			 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
 | 
                                                        |
| 680 | + * @param int $post_id The post ID.  | 
                                                        |
| 681 | + */  | 
                                                        |
| 682 | +			do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
 | 
                                                        |
| 665 | 683 | |
| 666 | - $post_meta_set_query .= $mkey . " = '" . $mval . "', ";  | 
                                                        |
| 667 | - }  | 
                                                        |
| 668 | - }  | 
                                                        |
| 684 | +			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 669 | 685 | |
| 670 | - $post_meta_set_query = trim($post_meta_set_query, ", ");  | 
                                                        |
| 686 | + $wpdb->query(  | 
                                                        |
| 687 | + $wpdb->prepare(  | 
                                                        |
| 688 | + "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",  | 
                                                        |
| 689 | + array($post_id)  | 
                                                        |
| 690 | + )  | 
                                                        |
| 691 | + );  | 
                                                        |
| 671 | 692 | |
| 672 | -            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
 | 
                                                        |
| 673 | 693 | |
| 674 | - /**  | 
                                                        |
| 675 | - * Called before saving the listing info.  | 
                                                        |
| 676 | - *  | 
                                                        |
| 677 | - * @since 1.0.0  | 
                                                        |
| 678 | - * @package GeoDirectory  | 
                                                        |
| 679 | -             * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
 | 
                                                        |
| 680 | - * @param int $post_id The post ID.  | 
                                                        |
| 681 | - */  | 
                                                        |
| 682 | -            do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
 | 
                                                        |
| 694 | +			} else {
 | 
                                                        |
| 683 | 695 | |
| 684 | -            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 696 | + $wpdb->query(  | 
                                                        |
| 697 | + $wpdb->prepare(  | 
                                                        |
| 698 | + "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,  | 
                                                        |
| 699 | + array($post_id)  | 
                                                        |
| 700 | + )  | 
                                                        |
| 701 | + );  | 
                                                        |
| 685 | 702 | |
| 686 | - $wpdb->query(  | 
                                                        |
| 687 | - $wpdb->prepare(  | 
                                                        |
| 688 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",  | 
                                                        |
| 689 | - array($post_id)  | 
                                                        |
| 690 | - )  | 
                                                        |
| 691 | - );  | 
                                                        |
| 703 | + }  | 
                                                        |
| 692 | 704 | |
| 705 | + /**  | 
                                                        |
| 706 | + * Called after saving the listing info.  | 
                                                        |
| 707 | + *  | 
                                                        |
| 708 | + * @since 1.0.0  | 
                                                        |
| 709 | + * @package GeoDirectory  | 
                                                        |
| 710 | + * @param array $postinfo_array Post info that needs to be saved in detail table.  | 
                                                        |
| 711 | + * @param int $post_id The post ID.  | 
                                                        |
| 712 | + * @see 'geodir_after_save_listing'  | 
                                                        |
| 713 | + */  | 
                                                        |
| 714 | +			do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
 | 
                                                        |
| 715 | +  | 
                                                        |
| 716 | + return true;  | 
                                                        |
| 717 | + } else  | 
                                                        |
| 718 | + return false;  | 
                                                        |
| 693 | 719 | |
| 694 | -            } else {
 | 
                                                        |
| 720 | + }  | 
                                                        |
| 721 | +}  | 
                                                        |
| 695 | 722 | |
| 696 | - $wpdb->query(  | 
                                                        |
| 697 | - $wpdb->prepare(  | 
                                                        |
| 698 | - "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,  | 
                                                        |
| 699 | - array($post_id)  | 
                                                        |
| 700 | - )  | 
                                                        |
| 701 | - );  | 
                                                        |
| 702 | 723 | |
| 703 | - }  | 
                                                        |
| 724 | +if (!function_exists('geodir_save_post_meta')) {
 | 
                                                        |
| 725 | + /**  | 
                                                        |
| 726 | + * Save or update post custom fields.  | 
                                                        |
| 727 | + *  | 
                                                        |
| 728 | + * @since 1.0.0  | 
                                                        |
| 729 | + * @package GeoDirectory  | 
                                                        |
| 730 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 731 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 732 | + * @param int $post_id The post ID.  | 
                                                        |
| 733 | + * @param string $postmeta Detail table column name.  | 
                                                        |
| 734 | + * @param string $meta_value Detail table column value.  | 
                                                        |
| 735 | + * @return void|bool  | 
                                                        |
| 736 | + */  | 
                                                        |
| 737 | + function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')  | 
                                                        |
| 738 | +	{
 | 
                                                        |
| 739 | +  | 
                                                        |
| 740 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 741 | +  | 
                                                        |
| 742 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 743 | +  | 
                                                        |
| 744 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 745 | +  | 
                                                        |
| 746 | +		if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
 | 
                                                        |
| 747 | +  | 
                                                        |
| 748 | +			if (is_array($meta_value)) {
 | 
                                                        |
| 749 | +				$meta_value = implode(",", $meta_value);
 | 
                                                        |
| 750 | + }  | 
                                                        |
| 704 | 751 | |
| 705 | - /**  | 
                                                        |
| 706 | - * Called after saving the listing info.  | 
                                                        |
| 707 | - *  | 
                                                        |
| 708 | - * @since 1.0.0  | 
                                                        |
| 709 | - * @package GeoDirectory  | 
                                                        |
| 710 | - * @param array $postinfo_array Post info that needs to be saved in detail table.  | 
                                                        |
| 711 | - * @param int $post_id The post ID.  | 
                                                        |
| 712 | - * @see 'geodir_after_save_listing'  | 
                                                        |
| 713 | - */  | 
                                                        |
| 714 | -            do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
 | 
                                                        |
| 752 | +			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 715 | 753 | |
| 716 | - return true;  | 
                                                        |
| 717 | - } else  | 
                                                        |
| 718 | - return false;  | 
                                                        |
| 754 | + $wpdb->query(  | 
                                                        |
| 755 | + $wpdb->prepare(  | 
                                                        |
| 756 | + "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",  | 
                                                        |
| 757 | + array($post_id)  | 
                                                        |
| 758 | + )  | 
                                                        |
| 759 | + );  | 
                                                        |
| 719 | 760 | |
| 720 | - }  | 
                                                        |
| 721 | -}  | 
                                                        |
| 761 | +			} else {
 | 
                                                        |
| 722 | 762 | |
| 763 | + $wpdb->query(  | 
                                                        |
| 764 | + $wpdb->prepare(  | 
                                                        |
| 765 | + "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",  | 
                                                        |
| 766 | + array($post_id)  | 
                                                        |
| 767 | + )  | 
                                                        |
| 768 | + );  | 
                                                        |
| 769 | + }  | 
                                                        |
| 723 | 770 | |
| 724 | -if (!function_exists('geodir_save_post_meta')) {
 | 
                                                        |
| 725 | - /**  | 
                                                        |
| 726 | - * Save or update post custom fields.  | 
                                                        |
| 727 | - *  | 
                                                        |
| 728 | - * @since 1.0.0  | 
                                                        |
| 729 | - * @package GeoDirectory  | 
                                                        |
| 730 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 731 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 732 | - * @param int $post_id The post ID.  | 
                                                        |
| 733 | - * @param string $postmeta Detail table column name.  | 
                                                        |
| 734 | - * @param string $meta_value Detail table column value.  | 
                                                        |
| 735 | - * @return void|bool  | 
                                                        |
| 736 | - */  | 
                                                        |
| 737 | - function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')  | 
                                                        |
| 738 | -    {
 | 
                                                        |
| 739 | -  | 
                                                        |
| 740 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 741 | -  | 
                                                        |
| 742 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 743 | -  | 
                                                        |
| 744 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 745 | -  | 
                                                        |
| 746 | -        if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
 | 
                                                        |
| 747 | -  | 
                                                        |
| 748 | -            if (is_array($meta_value)) {
 | 
                                                        |
| 749 | -                $meta_value = implode(",", $meta_value);
 | 
                                                        |
| 750 | - }  | 
                                                        |
| 751 | -  | 
                                                        |
| 752 | -            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 753 | -  | 
                                                        |
| 754 | - $wpdb->query(  | 
                                                        |
| 755 | - $wpdb->prepare(  | 
                                                        |
| 756 | - "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",  | 
                                                        |
| 757 | - array($post_id)  | 
                                                        |
| 758 | - )  | 
                                                        |
| 759 | - );  | 
                                                        |
| 760 | -  | 
                                                        |
| 761 | -            } else {
 | 
                                                        |
| 762 | -  | 
                                                        |
| 763 | - $wpdb->query(  | 
                                                        |
| 764 | - $wpdb->prepare(  | 
                                                        |
| 765 | - "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",  | 
                                                        |
| 766 | - array($post_id)  | 
                                                        |
| 767 | - )  | 
                                                        |
| 768 | - );  | 
                                                        |
| 769 | - }  | 
                                                        |
| 770 | -  | 
                                                        |
| 771 | -  | 
                                                        |
| 772 | - } else  | 
                                                        |
| 773 | - return false;  | 
                                                        |
| 774 | - }  | 
                                                        |
| 771 | +  | 
                                                        |
| 772 | + } else  | 
                                                        |
| 773 | + return false;  | 
                                                        |
| 774 | + }  | 
                                                        |
| 775 | 775 | }  | 
                                                        
| 776 | 776 | |
| 777 | 777 |  if (!function_exists('geodir_delete_post_meta')) {
 | 
                                                        
| 778 | - /**  | 
                                                        |
| 779 | - * Delete post custom fields.  | 
                                                        |
| 780 | - *  | 
                                                        |
| 781 | - * @since 1.0.0  | 
                                                        |
| 782 | - * @package GeoDirectory  | 
                                                        |
| 783 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 784 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 785 | - * @param int $post_id The post ID.  | 
                                                        |
| 786 | - * @param string $postmeta Detail table column name.  | 
                                                        |
| 787 | - * @todo check if this is depreciated  | 
                                                        |
| 788 | - * @todo Fix unknown variable mval  | 
                                                        |
| 789 | - * @return bool  | 
                                                        |
| 790 | - */  | 
                                                        |
| 791 | - function geodir_delete_post_meta($post_id, $postmeta)  | 
                                                        |
| 792 | -    {
 | 
                                                        |
| 793 | -  | 
                                                        |
| 794 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 795 | -  | 
                                                        |
| 796 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 797 | -  | 
                                                        |
| 798 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 799 | -  | 
                                                        |
| 800 | -        if (is_array($postmeta) && !empty($postmeta) && $post_id) {
 | 
                                                        |
| 801 | - $post_meta_set_query = '';  | 
                                                        |
| 802 | -  | 
                                                        |
| 803 | -            foreach ($postmeta as $mkey) {
 | 
                                                        |
| 804 | - if ($mval != '')  | 
                                                        |
| 805 | - $post_meta_set_query .= $mkey . " = '', ";  | 
                                                        |
| 806 | - }  | 
                                                        |
| 807 | -  | 
                                                        |
| 808 | - $post_meta_set_query = trim($post_meta_set_query, ", ");  | 
                                                        |
| 809 | -  | 
                                                        |
| 810 | -            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
 | 
                                                        |
| 811 | -  | 
                                                        |
| 812 | - $wpdb->query(  | 
                                                        |
| 813 | - $wpdb->prepare(  | 
                                                        |
| 814 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",  | 
                                                        |
| 815 | - array($post_id)  | 
                                                        |
| 816 | - )  | 
                                                        |
| 817 | - );  | 
                                                        |
| 818 | -  | 
                                                        |
| 819 | - return true;  | 
                                                        |
| 820 | - }  | 
                                                        |
| 821 | -  | 
                                                        |
| 822 | -        } elseif ($postmeta != '' && $post_id) {
 | 
                                                        |
| 823 | -            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
 | 
                                                        |
| 824 | -  | 
                                                        |
| 825 | - $wpdb->query(  | 
                                                        |
| 826 | - $wpdb->prepare(  | 
                                                        |
| 827 | - "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",  | 
                                                        |
| 828 | - array($post_id)  | 
                                                        |
| 829 | - )  | 
                                                        |
| 830 | - );  | 
                                                        |
| 831 | -  | 
                                                        |
| 832 | - return true;  | 
                                                        |
| 833 | - }  | 
                                                        |
| 834 | -  | 
                                                        |
| 835 | - } else  | 
                                                        |
| 836 | - return false;  | 
                                                        |
| 837 | - }  | 
                                                        |
| 778 | + /**  | 
                                                        |
| 779 | + * Delete post custom fields.  | 
                                                        |
| 780 | + *  | 
                                                        |
| 781 | + * @since 1.0.0  | 
                                                        |
| 782 | + * @package GeoDirectory  | 
                                                        |
| 783 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 784 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 785 | + * @param int $post_id The post ID.  | 
                                                        |
| 786 | + * @param string $postmeta Detail table column name.  | 
                                                        |
| 787 | + * @todo check if this is depreciated  | 
                                                        |
| 788 | + * @todo Fix unknown variable mval  | 
                                                        |
| 789 | + * @return bool  | 
                                                        |
| 790 | + */  | 
                                                        |
| 791 | + function geodir_delete_post_meta($post_id, $postmeta)  | 
                                                        |
| 792 | +	{
 | 
                                                        |
| 793 | +  | 
                                                        |
| 794 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 795 | +  | 
                                                        |
| 796 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 797 | +  | 
                                                        |
| 798 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 799 | +  | 
                                                        |
| 800 | +		if (is_array($postmeta) && !empty($postmeta) && $post_id) {
 | 
                                                        |
| 801 | + $post_meta_set_query = '';  | 
                                                        |
| 802 | +  | 
                                                        |
| 803 | +			foreach ($postmeta as $mkey) {
 | 
                                                        |
| 804 | + if ($mval != '')  | 
                                                        |
| 805 | + $post_meta_set_query .= $mkey . " = '', ";  | 
                                                        |
| 806 | + }  | 
                                                        |
| 807 | +  | 
                                                        |
| 808 | + $post_meta_set_query = trim($post_meta_set_query, ", ");  | 
                                                        |
| 809 | +  | 
                                                        |
| 810 | +			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
 | 
                                                        |
| 811 | +  | 
                                                        |
| 812 | + $wpdb->query(  | 
                                                        |
| 813 | + $wpdb->prepare(  | 
                                                        |
| 814 | + "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",  | 
                                                        |
| 815 | + array($post_id)  | 
                                                        |
| 816 | + )  | 
                                                        |
| 817 | + );  | 
                                                        |
| 818 | +  | 
                                                        |
| 819 | + return true;  | 
                                                        |
| 820 | + }  | 
                                                        |
| 821 | +  | 
                                                        |
| 822 | +		} elseif ($postmeta != '' && $post_id) {
 | 
                                                        |
| 823 | +			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
 | 
                                                        |
| 824 | +  | 
                                                        |
| 825 | + $wpdb->query(  | 
                                                        |
| 826 | + $wpdb->prepare(  | 
                                                        |
| 827 | + "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",  | 
                                                        |
| 828 | + array($post_id)  | 
                                                        |
| 829 | + )  | 
                                                        |
| 830 | + );  | 
                                                        |
| 831 | +  | 
                                                        |
| 832 | + return true;  | 
                                                        |
| 833 | + }  | 
                                                        |
| 834 | +  | 
                                                        |
| 835 | + } else  | 
                                                        |
| 836 | + return false;  | 
                                                        |
| 837 | + }  | 
                                                        |
| 838 | 838 | }  | 
                                                        
| 839 | 839 | |
| 840 | 840 | |
| 841 | 841 |  if (!function_exists('geodir_get_post_meta')) {
 | 
                                                        
| 842 | - /**  | 
                                                        |
| 843 | - * Get post custom meta.  | 
                                                        |
| 844 | - *  | 
                                                        |
| 845 | - * @since 1.0.0  | 
                                                        |
| 846 | - * @package GeoDirectory  | 
                                                        |
| 847 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 848 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 849 | - * @param int $post_id The post ID.  | 
                                                        |
| 850 | - * @param string $meta_key The meta key to retrieve.  | 
                                                        |
| 851 | - * @param bool $single Optional. Whether to return a single value. Default false.  | 
                                                        |
| 852 | - * @todo single variable not yet implemented.  | 
                                                        |
| 853 | - * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.  | 
                                                        |
| 854 | - */  | 
                                                        |
| 855 | - function geodir_get_post_meta($post_id, $meta_key, $single = false)  | 
                                                        |
| 856 | -    {
 | 
                                                        |
| 857 | -        if (!$post_id) {
 | 
                                                        |
| 858 | - return false;  | 
                                                        |
| 859 | - }  | 
                                                        |
| 860 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 861 | -  | 
                                                        |
| 862 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 863 | -  | 
                                                        |
| 864 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 865 | -  | 
                                                        |
| 866 | - if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 867 | - return false;  | 
                                                        |
| 868 | -  | 
                                                        |
| 869 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 870 | -  | 
                                                        |
| 871 | -        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
 | 
                                                        |
| 872 | -            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
 | 
                                                        |
| 842 | + /**  | 
                                                        |
| 843 | + * Get post custom meta.  | 
                                                        |
| 844 | + *  | 
                                                        |
| 845 | + * @since 1.0.0  | 
                                                        |
| 846 | + * @package GeoDirectory  | 
                                                        |
| 847 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 848 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 849 | + * @param int $post_id The post ID.  | 
                                                        |
| 850 | + * @param string $meta_key The meta key to retrieve.  | 
                                                        |
| 851 | + * @param bool $single Optional. Whether to return a single value. Default false.  | 
                                                        |
| 852 | + * @todo single variable not yet implemented.  | 
                                                        |
| 853 | + * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.  | 
                                                        |
| 854 | + */  | 
                                                        |
| 855 | + function geodir_get_post_meta($post_id, $meta_key, $single = false)  | 
                                                        |
| 856 | +	{
 | 
                                                        |
| 857 | +		if (!$post_id) {
 | 
                                                        |
| 858 | + return false;  | 
                                                        |
| 859 | + }  | 
                                                        |
| 860 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 861 | +  | 
                                                        |
| 862 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 863 | +  | 
                                                        |
| 864 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 865 | +  | 
                                                        |
| 866 | + if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 867 | + return false;  | 
                                                        |
| 868 | +  | 
                                                        |
| 869 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 870 | +  | 
                                                        |
| 871 | +		if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
 | 
                                                        |
| 872 | +			$meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
 | 
                                                        |
| 873 | 873 | |
| 874 | -            if ($meta_value && $meta_value !== '') {
 | 
                                                        |
| 875 | - return maybe_serialize($meta_value);  | 
                                                        |
| 876 | - } else  | 
                                                        |
| 877 | - return $meta_value;  | 
                                                        |
| 878 | -        } else {
 | 
                                                        |
| 879 | - return false;  | 
                                                        |
| 880 | - }  | 
                                                        |
| 881 | - }  | 
                                                        |
| 874 | +			if ($meta_value && $meta_value !== '') {
 | 
                                                        |
| 875 | + return maybe_serialize($meta_value);  | 
                                                        |
| 876 | + } else  | 
                                                        |
| 877 | + return $meta_value;  | 
                                                        |
| 878 | +		} else {
 | 
                                                        |
| 879 | + return false;  | 
                                                        |
| 880 | + }  | 
                                                        |
| 881 | + }  | 
                                                        |
| 882 | 882 | }  | 
                                                        
| 883 | 883 | |
| 884 | 884 | |
| 885 | 885 |  if (!function_exists('geodir_save_post_images')) {
 | 
                                                        
| 886 | - /**  | 
                                                        |
| 887 | - * Save post attachments.  | 
                                                        |
| 888 | - *  | 
                                                        |
| 889 | - * @since 1.0.0  | 
                                                        |
| 890 | - * @package GeoDirectory  | 
                                                        |
| 891 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 892 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 893 | - * @global object $current_user Current user object.  | 
                                                        |
| 894 | - * @param int $post_id The post ID.  | 
                                                        |
| 895 | - * @param array $post_image Post image urls as an array.  | 
                                                        |
| 896 | - * @param bool $dummy Optional. Is this a dummy listing? Default false.  | 
                                                        |
| 897 | - */  | 
                                                        |
| 898 | - function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)  | 
                                                        |
| 899 | -    {
 | 
                                                        |
| 886 | + /**  | 
                                                        |
| 887 | + * Save post attachments.  | 
                                                        |
| 888 | + *  | 
                                                        |
| 889 | + * @since 1.0.0  | 
                                                        |
| 890 | + * @package GeoDirectory  | 
                                                        |
| 891 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 892 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 893 | + * @global object $current_user Current user object.  | 
                                                        |
| 894 | + * @param int $post_id The post ID.  | 
                                                        |
| 895 | + * @param array $post_image Post image urls as an array.  | 
                                                        |
| 896 | + * @param bool $dummy Optional. Is this a dummy listing? Default false.  | 
                                                        |
| 897 | + */  | 
                                                        |
| 898 | + function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)  | 
                                                        |
| 899 | +	{
 | 
                                                        |
| 900 | 900 | |
| 901 | 901 | |
| 902 | - global $wpdb, $plugin_prefix, $current_user;  | 
                                                        |
| 902 | + global $wpdb, $plugin_prefix, $current_user;  | 
                                                        |
| 903 | 903 | |
| 904 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 904 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 905 | 905 | |
| 906 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 906 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 907 | 907 | |
| 908 | - $post_images = geodir_get_images($post_id);  | 
                                                        |
| 908 | + $post_images = geodir_get_images($post_id);  | 
                                                        |
| 909 | 909 | |
| 910 | - $wpdb->query(  | 
                                                        |
| 911 | - $wpdb->prepare(  | 
                                                        |
| 912 | - "UPDATE " . $table . " SET featured_image = '' where post_id =%d",  | 
                                                        |
| 913 | - array($post_id)  | 
                                                        |
| 914 | - )  | 
                                                        |
| 915 | - );  | 
                                                        |
| 910 | + $wpdb->query(  | 
                                                        |
| 911 | + $wpdb->prepare(  | 
                                                        |
| 912 | + "UPDATE " . $table . " SET featured_image = '' where post_id =%d",  | 
                                                        |
| 913 | + array($post_id)  | 
                                                        |
| 914 | + )  | 
                                                        |
| 915 | + );  | 
                                                        |
| 916 | 916 | |
| 917 | - $invalid_files = $post_images;  | 
                                                        |
| 918 | - $valid_file_ids = array();  | 
                                                        |
| 919 | - $valid_files_condition = '';  | 
                                                        |
| 920 | - $geodir_uploaddir = '';  | 
                                                        |
| 917 | + $invalid_files = $post_images;  | 
                                                        |
| 918 | + $valid_file_ids = array();  | 
                                                        |
| 919 | + $valid_files_condition = '';  | 
                                                        |
| 920 | + $geodir_uploaddir = '';  | 
                                                        |
| 921 | 921 | |
| 922 | - $remove_files = array();  | 
                                                        |
| 922 | + $remove_files = array();  | 
                                                        |
| 923 | 923 | |
| 924 | -        if (!empty($post_image)) {
 | 
                                                        |
| 924 | +		if (!empty($post_image)) {
 | 
                                                        |
| 925 | 925 | |
| 926 | - $uploads = wp_upload_dir();  | 
                                                        |
| 927 | - $uploads_dir = $uploads['path'];  | 
                                                        |
| 926 | + $uploads = wp_upload_dir();  | 
                                                        |
| 927 | + $uploads_dir = $uploads['path'];  | 
                                                        |
| 928 | 928 | |
| 929 | - $geodir_uploadpath = $uploads['path'];  | 
                                                        |
| 930 | - $geodir_uploadurl = $uploads['url'];  | 
                                                        |
| 931 | - $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';  | 
                                                        |
| 929 | + $geodir_uploadpath = $uploads['path'];  | 
                                                        |
| 930 | + $geodir_uploadurl = $uploads['url'];  | 
                                                        |
| 931 | + $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';  | 
                                                        |
| 932 | 932 | |
| 933 | - $invalid_files = array();  | 
                                                        |
| 934 | - $postcurr_images = array();  | 
                                                        |
| 933 | + $invalid_files = array();  | 
                                                        |
| 934 | + $postcurr_images = array();  | 
                                                        |
| 935 | 935 | |
| 936 | -            for ($m = 0; $m < count($post_image); $m++) {
 | 
                                                        |
| 937 | - $menu_order = $m + 1;  | 
                                                        |
| 936 | +			for ($m = 0; $m < count($post_image); $m++) {
 | 
                                                        |
| 937 | + $menu_order = $m + 1;  | 
                                                        |
| 938 | 938 | |
| 939 | - $file_path = '';  | 
                                                        |
| 940 | - /* --------- start ------- */  | 
                                                        |
| 939 | + $file_path = '';  | 
                                                        |
| 940 | + /* --------- start ------- */  | 
                                                        |
| 941 | 941 | |
| 942 | -                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
 | 
                                                        |
| 942 | +				$split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
 | 
                                                        |
| 943 | 943 | |
| 944 | - $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';  | 
                                                        |
| 944 | + $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';  | 
                                                        |
| 945 | 945 | |
| 946 | 946 | |
| 947 | -                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)))) {
 | 
                                                        |
| 947 | +				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)))) {
 | 
                                                        |
| 948 | 948 | |
| 949 | - /* --------- end ------- */  | 
                                                        |
| 950 | - $curr_img_url = $post_image[$m];  | 
                                                        |
| 949 | + /* --------- end ------- */  | 
                                                        |
| 950 | + $curr_img_url = $post_image[$m];  | 
                                                        |
| 951 | 951 | |
| 952 | -                    $image_name_arr = explode('/', $curr_img_url);
 | 
                                                        |
| 952 | +					$image_name_arr = explode('/', $curr_img_url);
 | 
                                                        |
| 953 | 953 | |
| 954 | - $count_image_name_arr = count($image_name_arr) - 2;  | 
                                                        |
| 954 | + $count_image_name_arr = count($image_name_arr) - 2;  | 
                                                        |
| 955 | 955 | |
| 956 | - $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;  | 
                                                        |
| 956 | + $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;  | 
                                                        |
| 957 | 957 | |
| 958 | - $curr_img_dir = $image_name_arr[$count_image_name_arr];  | 
                                                        |
| 958 | + $curr_img_dir = $image_name_arr[$count_image_name_arr];  | 
                                                        |
| 959 | 959 | |
| 960 | - $filename = end($image_name_arr);  | 
                                                        |
| 961 | -                    if (strpos($filename, '?') !== false) {
 | 
                                                        |
| 962 | -                        list($filename) = explode('?', $filename);
 | 
                                                        |
| 963 | - }  | 
                                                        |
| 960 | + $filename = end($image_name_arr);  | 
                                                        |
| 961 | +					if (strpos($filename, '?') !== false) {
 | 
                                                        |
| 962 | +						list($filename) = explode('?', $filename);
 | 
                                                        |
| 963 | + }  | 
                                                        |
| 964 | 964 | |
| 965 | - $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);  | 
                                                        |
| 966 | - $curr_img_dir = str_replace($filename, "", $curr_img_dir);  | 
                                                        |
| 965 | + $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);  | 
                                                        |
| 966 | + $curr_img_dir = str_replace($filename, "", $curr_img_dir);  | 
                                                        |
| 967 | 967 | |
| 968 | -                    $img_name_arr = explode('.', $filename);
 | 
                                                        |
| 968 | +					$img_name_arr = explode('.', $filename);
 | 
                                                        |
| 969 | 969 | |
| 970 | - $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;  | 
                                                        |
| 971 | -                    if (!empty($img_name_arr) && count($img_name_arr) > 2) {
 | 
                                                        |
| 972 | - $new_img_name_arr = $img_name_arr;  | 
                                                        |
| 973 | -                        if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
 | 
                                                        |
| 974 | - unset($new_img_name_arr[count($img_name_arr) - 1]);  | 
                                                        |
| 975 | -                            $file_title = implode('.', $new_img_name_arr);
 | 
                                                        |
| 976 | - }  | 
                                                        |
| 977 | - }  | 
                                                        |
| 978 | - $file_title = sanitize_file_name($file_title);  | 
                                                        |
| 979 | - $file_name = sanitize_file_name($filename);  | 
                                                        |
| 970 | + $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;  | 
                                                        |
| 971 | +					if (!empty($img_name_arr) && count($img_name_arr) > 2) {
 | 
                                                        |
| 972 | + $new_img_name_arr = $img_name_arr;  | 
                                                        |
| 973 | +						if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
 | 
                                                        |
| 974 | + unset($new_img_name_arr[count($img_name_arr) - 1]);  | 
                                                        |
| 975 | +							$file_title = implode('.', $new_img_name_arr);
 | 
                                                        |
| 976 | + }  | 
                                                        |
| 977 | + }  | 
                                                        |
| 978 | + $file_title = sanitize_file_name($file_title);  | 
                                                        |
| 979 | + $file_name = sanitize_file_name($filename);  | 
                                                        |
| 980 | 980 | |
| 981 | - $arr_file_type = wp_check_filetype($filename);  | 
                                                        |
| 981 | + $arr_file_type = wp_check_filetype($filename);  | 
                                                        |
| 982 | 982 | |
| 983 | - $uploaded_file_type = $arr_file_type['type'];  | 
                                                        |
| 983 | + $uploaded_file_type = $arr_file_type['type'];  | 
                                                        |
| 984 | 984 | |
| 985 | - // Set an array containing a list of acceptable formats  | 
                                                        |
| 986 | -                    $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
 | 
                                                        |
| 985 | + // Set an array containing a list of acceptable formats  | 
                                                        |
| 986 | +					$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
 | 
                                                        |
| 987 | 987 | |
| 988 | - // If the uploaded file is the right format  | 
                                                        |
| 989 | -                    if (in_array($uploaded_file_type, $allowed_file_types)) {
 | 
                                                        |
| 990 | -                        if (!function_exists('wp_handle_upload')) {
 | 
                                                        |
| 991 | - require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 992 | - }  | 
                                                        |
| 988 | + // If the uploaded file is the right format  | 
                                                        |
| 989 | +					if (in_array($uploaded_file_type, $allowed_file_types)) {
 | 
                                                        |
| 990 | +						if (!function_exists('wp_handle_upload')) {
 | 
                                                        |
| 991 | + require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 992 | + }  | 
                                                        |
| 993 | 993 | |
| 994 | -                        if (!is_dir($geodir_uploadpath)) {
 | 
                                                        |
| 995 | - mkdir($geodir_uploadpath);  | 
                                                        |
| 996 | - }  | 
                                                        |
| 994 | +						if (!is_dir($geodir_uploadpath)) {
 | 
                                                        |
| 995 | + mkdir($geodir_uploadpath);  | 
                                                        |
| 996 | + }  | 
                                                        |
| 997 | 997 | |
| 998 | - $external_img = false;  | 
                                                        |
| 999 | -                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
 | 
                                                        |
| 1000 | -                        } else {
 | 
                                                        |
| 1001 | - $external_img = true;  | 
                                                        |
| 1002 | - }  | 
                                                        |
| 998 | + $external_img = false;  | 
                                                        |
| 999 | +						if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
 | 
                                                        |
| 1000 | +						} else {
 | 
                                                        |
| 1001 | + $external_img = true;  | 
                                                        |
| 1002 | + }  | 
                                                        |
| 1003 | 1003 | |
| 1004 | -                        if ($dummy || $external_img) {
 | 
                                                        |
| 1005 | - $uploaded_file = array();  | 
                                                        |
| 1006 | - $uploaded = (array)fetch_remote_file($curr_img_url);  | 
                                                        |
| 1004 | +						if ($dummy || $external_img) {
 | 
                                                        |
| 1005 | + $uploaded_file = array();  | 
                                                        |
| 1006 | + $uploaded = (array)fetch_remote_file($curr_img_url);  | 
                                                        |
| 1007 | 1007 | |
| 1008 | -                            if (isset($uploaded['error']) && empty($uploaded['error'])) {
 | 
                                                        |
| 1009 | - $new_name = basename($uploaded['file']);  | 
                                                        |
| 1010 | - $uploaded_file = $uploaded;  | 
                                                        |
| 1011 | -                            }else{
 | 
                                                        |
| 1012 | - print_r($uploaded);exit;  | 
                                                        |
| 1013 | - }  | 
                                                        |
| 1014 | - $external_img = false;  | 
                                                        |
| 1015 | -                        } else {
 | 
                                                        |
| 1016 | - $new_name = $post_id . '_' . $file_name;  | 
                                                        |
| 1008 | +							if (isset($uploaded['error']) && empty($uploaded['error'])) {
 | 
                                                        |
| 1009 | + $new_name = basename($uploaded['file']);  | 
                                                        |
| 1010 | + $uploaded_file = $uploaded;  | 
                                                        |
| 1011 | +							}else{
 | 
                                                        |
| 1012 | + print_r($uploaded);exit;  | 
                                                        |
| 1013 | + }  | 
                                                        |
| 1014 | + $external_img = false;  | 
                                                        |
| 1015 | +						} else {
 | 
                                                        |
| 1016 | + $new_name = $post_id . '_' . $file_name;  | 
                                                        |
| 1017 | 1017 | |
| 1018 | -                            if ($curr_img_dir == $sub_dir) {
 | 
                                                        |
| 1019 | - $img_path = $geodir_uploadpath . '/' . $filename;  | 
                                                        |
| 1020 | - $img_url = $geodir_uploadurl . '/' . $filename;  | 
                                                        |
| 1021 | -                            } else {
 | 
                                                        |
| 1022 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 1023 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 1024 | - }  | 
                                                        |
| 1018 | +							if ($curr_img_dir == $sub_dir) {
 | 
                                                        |
| 1019 | + $img_path = $geodir_uploadpath . '/' . $filename;  | 
                                                        |
| 1020 | + $img_url = $geodir_uploadurl . '/' . $filename;  | 
                                                        |
| 1021 | +							} else {
 | 
                                                        |
| 1022 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 1023 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 1024 | + }  | 
                                                        |
| 1025 | 1025 | |
| 1026 | - $uploaded_file = '';  | 
                                                        |
| 1026 | + $uploaded_file = '';  | 
                                                        |
| 1027 | 1027 | |
| 1028 | -                            if (file_exists($img_path)) {
 | 
                                                        |
| 1029 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);  | 
                                                        |
| 1030 | - $file_path = '';  | 
                                                        |
| 1031 | -                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
 | 
                                                        |
| 1032 | - $uploaded_file = true;  | 
                                                        |
| 1033 | - $file_path = $curr_img_dir . '/' . $filename;  | 
                                                        |
| 1034 | - }  | 
                                                        |
| 1028 | +							if (file_exists($img_path)) {
 | 
                                                        |
| 1029 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);  | 
                                                        |
| 1030 | + $file_path = '';  | 
                                                        |
| 1031 | +							} else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
 | 
                                                        |
| 1032 | + $uploaded_file = true;  | 
                                                        |
| 1033 | + $file_path = $curr_img_dir . '/' . $filename;  | 
                                                        |
| 1034 | + }  | 
                                                        |
| 1035 | 1035 | |
| 1036 | - if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))  | 
                                                        |
| 1037 | - unlink($img_path);  | 
                                                        |
| 1038 | - }  | 
                                                        |
| 1036 | + if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))  | 
                                                        |
| 1037 | + unlink($img_path);  | 
                                                        |
| 1038 | + }  | 
                                                        |
| 1039 | 1039 | |
| 1040 | -                        if (!empty($uploaded_file)) {
 | 
                                                        |
| 1041 | -                            if (!isset($file_path) || !$file_path) {
 | 
                                                        |
| 1042 | - $file_path = $sub_dir . '/' . $new_name;  | 
                                                        |
| 1043 | - }  | 
                                                        |
| 1040 | +						if (!empty($uploaded_file)) {
 | 
                                                        |
| 1041 | +							if (!isset($file_path) || !$file_path) {
 | 
                                                        |
| 1042 | + $file_path = $sub_dir . '/' . $new_name;  | 
                                                        |
| 1043 | + }  | 
                                                        |
| 1044 | 1044 | |
| 1045 | -                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
 | 
                                                        |
| 1045 | +							$postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
 | 
                                                        |
| 1046 | 1046 | |
| 1047 | -                            if ($menu_order == 1) {
 | 
                                                        |
| 1047 | +							if ($menu_order == 1) {
 | 
                                                        |
| 1048 | 1048 | |
| 1049 | -                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
 | 
                                                        |
| 1049 | +								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
 | 
                                                        |
| 1050 | 1050 | |
| 1051 | - }  | 
                                                        |
| 1051 | + }  | 
                                                        |
| 1052 | 1052 | |
| 1053 | - // Set up options array to add this file as an attachment  | 
                                                        |
| 1054 | - $attachment = array();  | 
                                                        |
| 1055 | - $attachment['post_id'] = $post_id;  | 
                                                        |
| 1056 | - $attachment['title'] = $file_title;  | 
                                                        |
| 1057 | - $attachment['content'] = '';  | 
                                                        |
| 1058 | - $attachment['file'] = $file_path;  | 
                                                        |
| 1059 | - $attachment['mime_type'] = $uploaded_file_type;  | 
                                                        |
| 1060 | - $attachment['menu_order'] = $menu_order;  | 
                                                        |
| 1061 | - $attachment['is_featured'] = 0;  | 
                                                        |
| 1053 | + // Set up options array to add this file as an attachment  | 
                                                        |
| 1054 | + $attachment = array();  | 
                                                        |
| 1055 | + $attachment['post_id'] = $post_id;  | 
                                                        |
| 1056 | + $attachment['title'] = $file_title;  | 
                                                        |
| 1057 | + $attachment['content'] = '';  | 
                                                        |
| 1058 | + $attachment['file'] = $file_path;  | 
                                                        |
| 1059 | + $attachment['mime_type'] = $uploaded_file_type;  | 
                                                        |
| 1060 | + $attachment['menu_order'] = $menu_order;  | 
                                                        |
| 1061 | + $attachment['is_featured'] = 0;  | 
                                                        |
| 1062 | 1062 | |
| 1063 | - $attachment_set = '';  | 
                                                        |
| 1063 | + $attachment_set = '';  | 
                                                        |
| 1064 | 1064 | |
| 1065 | -                            foreach ($attachment as $key => $val) {
 | 
                                                        |
| 1066 | - if ($val != '')  | 
                                                        |
| 1067 | - $attachment_set .= $key . " = '" . $val . "', ";  | 
                                                        |
| 1068 | - }  | 
                                                        |
| 1065 | +							foreach ($attachment as $key => $val) {
 | 
                                                        |
| 1066 | + if ($val != '')  | 
                                                        |
| 1067 | + $attachment_set .= $key . " = '" . $val . "', ";  | 
                                                        |
| 1068 | + }  | 
                                                        |
| 1069 | 1069 | |
| 1070 | - $attachment_set = trim($attachment_set, ", ");  | 
                                                        |
| 1070 | + $attachment_set = trim($attachment_set, ", ");  | 
                                                        |
| 1071 | +  | 
                                                        |
| 1072 | +							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
 | 
                                                        |
| 1071 | 1073 | |
| 1072 | -                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
 | 
                                                        |
| 1074 | + $valid_file_ids[] = $wpdb->insert_id;  | 
                                                        |
| 1075 | + }  | 
                                                        |
| 1073 | 1076 | |
| 1074 | - $valid_file_ids[] = $wpdb->insert_id;  | 
                                                        |
| 1075 | - }  | 
                                                        |
| 1077 | + }  | 
                                                        |
| 1076 | 1078 | |
| 1077 | - }  | 
                                                        |
| 1078 | 1079 | |
| 1080 | +				} else {
 | 
                                                        |
| 1081 | + $valid_file_ids[] = $find_image;  | 
                                                        |
| 1079 | 1082 | |
| 1080 | -                } else {
 | 
                                                        |
| 1081 | - $valid_file_ids[] = $find_image;  | 
                                                        |
| 1082 | -  | 
                                                        |
| 1083 | -                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
 | 
                                                        |
| 1083 | +					$postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
 | 
                                                        |
| 1084 | 1084 | |
| 1085 | - $wpdb->query(  | 
                                                        |
| 1086 | - $wpdb->prepare(  | 
                                                        |
| 1087 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",  | 
                                                        |
| 1088 | - array($menu_order, $split_img_path[1], $post_id)  | 
                                                        |
| 1089 | - )  | 
                                                        |
| 1090 | - );  | 
                                                        |
| 1085 | + $wpdb->query(  | 
                                                        |
| 1086 | + $wpdb->prepare(  | 
                                                        |
| 1087 | + "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",  | 
                                                        |
| 1088 | + array($menu_order, $split_img_path[1], $post_id)  | 
                                                        |
| 1089 | + )  | 
                                                        |
| 1090 | + );  | 
                                                        |
| 1091 | 1091 | |
| 1092 | - if ($menu_order == 1)  | 
                                                        |
| 1093 | -                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
 | 
                                                        |
| 1092 | + if ($menu_order == 1)  | 
                                                        |
| 1093 | +						$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
 | 
                                                        |
| 1094 | 1094 | |
| 1095 | - }  | 
                                                        |
| 1095 | + }  | 
                                                        |
| 1096 | 1096 | |
| 1097 | 1097 | |
| 1098 | - }  | 
                                                        |
| 1098 | + }  | 
                                                        |
| 1099 | 1099 | |
| 1100 | -            if (!empty($valid_file_ids)) {
 | 
                                                        |
| 1100 | +			if (!empty($valid_file_ids)) {
 | 
                                                        |
| 1101 | 1101 | |
| 1102 | - $remove_files = $valid_file_ids;  | 
                                                        |
| 1102 | + $remove_files = $valid_file_ids;  | 
                                                        |
| 1103 | 1103 | |
| 1104 | - $remove_files_length = count($remove_files);  | 
                                                        |
| 1105 | - $remove_files_format = array_fill(0, $remove_files_length, '%d');  | 
                                                        |
| 1106 | -                $format = implode(',', $remove_files_format);
 | 
                                                        |
| 1107 | - $valid_files_condition = " ID NOT IN ($format) AND ";  | 
                                                        |
| 1104 | + $remove_files_length = count($remove_files);  | 
                                                        |
| 1105 | + $remove_files_format = array_fill(0, $remove_files_length, '%d');  | 
                                                        |
| 1106 | +				$format = implode(',', $remove_files_format);
 | 
                                                        |
| 1107 | + $valid_files_condition = " ID NOT IN ($format) AND ";  | 
                                                        |
| 1108 | 1108 | |
| 1109 | - }  | 
                                                        |
| 1109 | + }  | 
                                                        |
| 1110 | 1110 | |
| 1111 | - //Get and remove all old images of post from database to set by new order  | 
                                                        |
| 1111 | + //Get and remove all old images of post from database to set by new order  | 
                                                        |
| 1112 | 1112 | |
| 1113 | -            if (!empty($post_images)) {
 | 
                                                        |
| 1113 | +			if (!empty($post_images)) {
 | 
                                                        |
| 1114 | 1114 | |
| 1115 | -                foreach ($post_images as $img) {
 | 
                                                        |
| 1115 | +				foreach ($post_images as $img) {
 | 
                                                        |
| 1116 | 1116 | |
| 1117 | -                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
 | 
                                                        |
| 1117 | +					if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
 | 
                                                        |
| 1118 | 1118 | |
| 1119 | -                        $invalid_files[] = (object)array('src' => $img->src);
 | 
                                                        |
| 1119 | +						$invalid_files[] = (object)array('src' => $img->src);
 | 
                                                        |
| 1120 | 1120 | |
| 1121 | - }  | 
                                                        |
| 1121 | + }  | 
                                                        |
| 1122 | 1122 | |
| 1123 | - }  | 
                                                        |
| 1123 | + }  | 
                                                        |
| 1124 | 1124 | |
| 1125 | - }  | 
                                                        |
| 1125 | + }  | 
                                                        |
| 1126 | 1126 | |
| 1127 | - $invalid_files = (object)$invalid_files;  | 
                                                        |
| 1128 | - }  | 
                                                        |
| 1127 | + $invalid_files = (object)$invalid_files;  | 
                                                        |
| 1128 | + }  | 
                                                        |
| 1129 | 1129 | |
| 1130 | - $remove_files[] = $post_id;  | 
                                                        |
| 1130 | + $remove_files[] = $post_id;  | 
                                                        |
| 1131 | 1131 | |
| 1132 | -        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
 | 
                                                        |
| 1132 | +		$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
 | 
                                                        |
| 1133 | 1133 | |
| 1134 | - if (!empty($invalid_files))  | 
                                                        |
| 1135 | - geodir_remove_attachments($invalid_files);  | 
                                                        |
| 1136 | - }  | 
                                                        |
| 1134 | + if (!empty($invalid_files))  | 
                                                        |
| 1135 | + geodir_remove_attachments($invalid_files);  | 
                                                        |
| 1136 | + }  | 
                                                        |
| 1137 | 1137 | |
| 1138 | 1138 | }  | 
                                                        
| 1139 | 1139 | |
@@ -1147,12 +1147,12 @@ discard block  | 
                                                    ||
| 1147 | 1147 | function geodir_remove_temp_images()  | 
                                                        
| 1148 | 1148 |  {
 | 
                                                        
| 1149 | 1149 | |
| 1150 | - global $current_user;  | 
                                                        |
| 1150 | + global $current_user;  | 
                                                        |
| 1151 | 1151 | |
| 1152 | - $uploads = wp_upload_dir();  | 
                                                        |
| 1153 | - $uploads_dir = $uploads['path'];  | 
                                                        |
| 1152 | + $uploads = wp_upload_dir();  | 
                                                        |
| 1153 | + $uploads_dir = $uploads['path'];  | 
                                                        |
| 1154 | 1154 | |
| 1155 | -    /*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
 | 
                                                        |
| 1155 | +	/*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
 | 
                                                        |
| 1156 | 1156 | |
| 1157 | 1157 | $dirPath = $uploads_dir.'/temp_'.$current_user->data->ID;  | 
                                                        
| 1158 | 1158 |  			if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
 | 
                                                        
@@ -1169,8 +1169,8 @@ discard block  | 
                                                    ||
| 1169 | 1169 | rmdir($dirPath);  | 
                                                        
| 1170 | 1170 | } */  | 
                                                        
| 1171 | 1171 | |
| 1172 | - $dirname = $uploads_dir . '/temp_' . $current_user->ID;  | 
                                                        |
| 1173 | - geodir_delete_directory($dirname);  | 
                                                        |
| 1172 | + $dirname = $uploads_dir . '/temp_' . $current_user->ID;  | 
                                                        |
| 1173 | + geodir_delete_directory($dirname);  | 
                                                        |
| 1174 | 1174 | }  | 
                                                        
| 1175 | 1175 | |
| 1176 | 1176 | |
@@ -1184,116 +1184,116 @@ discard block  | 
                                                    ||
| 1184 | 1184 | */  | 
                                                        
| 1185 | 1185 | function geodir_delete_directory($dirname)  | 
                                                        
| 1186 | 1186 |  {
 | 
                                                        
| 1187 | - $dir_handle = '';  | 
                                                        |
| 1188 | - if (is_dir($dirname))  | 
                                                        |
| 1189 | - $dir_handle = opendir($dirname);  | 
                                                        |
| 1190 | - if (!$dir_handle)  | 
                                                        |
| 1191 | - return false;  | 
                                                        |
| 1192 | -    while ($file = readdir($dir_handle)) {
 | 
                                                        |
| 1193 | -        if ($file != "." && $file != "..") {
 | 
                                                        |
| 1194 | - if (!is_dir($dirname . "/" . $file))  | 
                                                        |
| 1195 | - unlink($dirname . "/" . $file);  | 
                                                        |
| 1196 | - else  | 
                                                        |
| 1197 | - geodir_delete_directory($dirname . '/' . $file);  | 
                                                        |
| 1198 | - }  | 
                                                        |
| 1199 | - }  | 
                                                        |
| 1200 | - closedir($dir_handle);  | 
                                                        |
| 1201 | - rmdir($dirname);  | 
                                                        |
| 1202 | - return true;  | 
                                                        |
| 1187 | + $dir_handle = '';  | 
                                                        |
| 1188 | + if (is_dir($dirname))  | 
                                                        |
| 1189 | + $dir_handle = opendir($dirname);  | 
                                                        |
| 1190 | + if (!$dir_handle)  | 
                                                        |
| 1191 | + return false;  | 
                                                        |
| 1192 | +	while ($file = readdir($dir_handle)) {
 | 
                                                        |
| 1193 | +		if ($file != "." && $file != "..") {
 | 
                                                        |
| 1194 | + if (!is_dir($dirname . "/" . $file))  | 
                                                        |
| 1195 | + unlink($dirname . "/" . $file);  | 
                                                        |
| 1196 | + else  | 
                                                        |
| 1197 | + geodir_delete_directory($dirname . '/' . $file);  | 
                                                        |
| 1198 | + }  | 
                                                        |
| 1199 | + }  | 
                                                        |
| 1200 | + closedir($dir_handle);  | 
                                                        |
| 1201 | + rmdir($dirname);  | 
                                                        |
| 1202 | + return true;  | 
                                                        |
| 1203 | 1203 | |
| 1204 | 1204 | }  | 
                                                        
| 1205 | 1205 | |
| 1206 | 1206 | |
| 1207 | 1207 |  if (!function_exists('geodir_remove_attachments')) {
 | 
                                                        
| 1208 | - /**  | 
                                                        |
| 1209 | - * Remove post attachments.  | 
                                                        |
| 1210 | - *  | 
                                                        |
| 1211 | - * @since 1.0.0  | 
                                                        |
| 1212 | - * @package GeoDirectory  | 
                                                        |
| 1213 | - * @param array $postcurr_images Array of image objects.  | 
                                                        |
| 1214 | - */  | 
                                                        |
| 1215 | - function geodir_remove_attachments($postcurr_images = array())  | 
                                                        |
| 1216 | -    {
 | 
                                                        |
| 1217 | - // Unlink all past images of post  | 
                                                        |
| 1218 | -        if (!empty($postcurr_images)) {
 | 
                                                        |
| 1219 | -  | 
                                                        |
| 1220 | - $uploads = wp_upload_dir();  | 
                                                        |
| 1221 | - $uploads_dir = $uploads['path'];  | 
                                                        |
| 1222 | -  | 
                                                        |
| 1223 | -            foreach ($postcurr_images as $postimg) {
 | 
                                                        |
| 1224 | -                $image_name_arr = explode('/', $postimg->src);
 | 
                                                        |
| 1225 | - $filename = end($image_name_arr);  | 
                                                        |
| 1226 | - if (file_exists($uploads_dir . '/' . $filename))  | 
                                                        |
| 1227 | - unlink($uploads_dir . '/' . $filename);  | 
                                                        |
| 1228 | - }  | 
                                                        |
| 1229 | -  | 
                                                        |
| 1230 | - } // endif  | 
                                                        |
| 1231 | - // Unlink all past images of post end  | 
                                                        |
| 1232 | - }  | 
                                                        |
| 1208 | + /**  | 
                                                        |
| 1209 | + * Remove post attachments.  | 
                                                        |
| 1210 | + *  | 
                                                        |
| 1211 | + * @since 1.0.0  | 
                                                        |
| 1212 | + * @package GeoDirectory  | 
                                                        |
| 1213 | + * @param array $postcurr_images Array of image objects.  | 
                                                        |
| 1214 | + */  | 
                                                        |
| 1215 | + function geodir_remove_attachments($postcurr_images = array())  | 
                                                        |
| 1216 | +	{
 | 
                                                        |
| 1217 | + // Unlink all past images of post  | 
                                                        |
| 1218 | +		if (!empty($postcurr_images)) {
 | 
                                                        |
| 1219 | +  | 
                                                        |
| 1220 | + $uploads = wp_upload_dir();  | 
                                                        |
| 1221 | + $uploads_dir = $uploads['path'];  | 
                                                        |
| 1222 | +  | 
                                                        |
| 1223 | +			foreach ($postcurr_images as $postimg) {
 | 
                                                        |
| 1224 | +				$image_name_arr = explode('/', $postimg->src);
 | 
                                                        |
| 1225 | + $filename = end($image_name_arr);  | 
                                                        |
| 1226 | + if (file_exists($uploads_dir . '/' . $filename))  | 
                                                        |
| 1227 | + unlink($uploads_dir . '/' . $filename);  | 
                                                        |
| 1228 | + }  | 
                                                        |
| 1229 | +  | 
                                                        |
| 1230 | + } // endif  | 
                                                        |
| 1231 | + // Unlink all past images of post end  | 
                                                        |
| 1232 | + }  | 
                                                        |
| 1233 | 1233 | }  | 
                                                        
| 1234 | 1234 | |
| 1235 | 1235 |  if (!function_exists('geodir_get_featured_image')) {
 | 
                                                        
| 1236 | - /**  | 
                                                        |
| 1237 | - * Gets the post featured image.  | 
                                                        |
| 1238 | - *  | 
                                                        |
| 1239 | - * @since 1.0.0  | 
                                                        |
| 1240 | - * @package GeoDirectory  | 
                                                        |
| 1241 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 1242 | - * @global object $post The current post object.  | 
                                                        |
| 1243 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 1244 | - * @param int|string $post_id The post ID.  | 
                                                        |
| 1245 | - * @param string $size Optional. Thumbnail size. Default: thumbnail.  | 
                                                        |
| 1246 | - * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.  | 
                                                        |
| 1247 | - * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.  | 
                                                        |
| 1248 | - * @return bool|object Image details as an object.  | 
                                                        |
| 1249 | - */  | 
                                                        |
| 1250 | - function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)  | 
                                                        |
| 1251 | -    {
 | 
                                                        |
| 1252 | -  | 
                                                        |
| 1253 | - /*$img_arr['src'] = get_the_post_thumbnail_url( $post_id, 'medium');//medium/thumbnail  | 
                                                        |
| 1236 | + /**  | 
                                                        |
| 1237 | + * Gets the post featured image.  | 
                                                        |
| 1238 | + *  | 
                                                        |
| 1239 | + * @since 1.0.0  | 
                                                        |
| 1240 | + * @package GeoDirectory  | 
                                                        |
| 1241 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 1242 | + * @global object $post The current post object.  | 
                                                        |
| 1243 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 1244 | + * @param int|string $post_id The post ID.  | 
                                                        |
| 1245 | + * @param string $size Optional. Thumbnail size. Default: thumbnail.  | 
                                                        |
| 1246 | + * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.  | 
                                                        |
| 1247 | + * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.  | 
                                                        |
| 1248 | + * @return bool|object Image details as an object.  | 
                                                        |
| 1249 | + */  | 
                                                        |
| 1250 | + function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)  | 
                                                        |
| 1251 | +	{
 | 
                                                        |
| 1252 | +  | 
                                                        |
| 1253 | + /*$img_arr['src'] = get_the_post_thumbnail_url( $post_id, 'medium');//medium/thumbnail  | 
                                                        |
| 1254 | 1254 | $img_arr['path'] = '';  | 
                                                        
| 1255 | 1255 | $img_arr['width'] = '';  | 
                                                        
| 1256 | 1256 | $img_arr['height'] = '';  | 
                                                        
| 1257 | 1257 | $img_arr['title'] = '';  | 
                                                        
| 1258 | 1258 | return (object)$img_arr;*/  | 
                                                        
| 1259 | - global $wpdb, $plugin_prefix, $post;  | 
                                                        |
| 1259 | + global $wpdb, $plugin_prefix, $post;  | 
                                                        |
| 1260 | 1260 | |
| 1261 | -        if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
 | 
                                                        |
| 1262 | - $post_type = $post->post_type;  | 
                                                        |
| 1263 | -        } else {
 | 
                                                        |
| 1264 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 1265 | - }  | 
                                                        |
| 1261 | +		if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
 | 
                                                        |
| 1262 | + $post_type = $post->post_type;  | 
                                                        |
| 1263 | +		} else {
 | 
                                                        |
| 1264 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 1265 | + }  | 
                                                        |
| 1266 | 1266 | |
| 1267 | -        if (!in_array($post_type, geodir_get_posttypes())) {
 | 
                                                        |
| 1268 | - return false;// if not a GD CPT return;  | 
                                                        |
| 1269 | - }  | 
                                                        |
| 1267 | +		if (!in_array($post_type, geodir_get_posttypes())) {
 | 
                                                        |
| 1268 | + return false;// if not a GD CPT return;  | 
                                                        |
| 1269 | + }  | 
                                                        |
| 1270 | 1270 | |
| 1271 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 1271 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 1272 | 1272 | |
| 1273 | -        if (!$file) {
 | 
                                                        |
| 1274 | -            if (isset($post->featured_image)) {
 | 
                                                        |
| 1275 | - $file = $post->featured_image;  | 
                                                        |
| 1276 | -            } else {
 | 
                                                        |
| 1277 | -                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
 | 
                                                        |
| 1278 | - }  | 
                                                        |
| 1279 | - }  | 
                                                        |
| 1273 | +		if (!$file) {
 | 
                                                        |
| 1274 | +			if (isset($post->featured_image)) {
 | 
                                                        |
| 1275 | + $file = $post->featured_image;  | 
                                                        |
| 1276 | +			} else {
 | 
                                                        |
| 1277 | +				$file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
 | 
                                                        |
| 1278 | + }  | 
                                                        |
| 1279 | + }  | 
                                                        |
| 1280 | 1280 | |
| 1281 | -        if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
 | 
                                                        |
| 1282 | - $img_arr = array();  | 
                                                        |
| 1281 | +		if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
 | 
                                                        |
| 1282 | + $img_arr = array();  | 
                                                        |
| 1283 | 1283 | |
| 1284 | - $file_info = pathinfo($file);  | 
                                                        |
| 1285 | - $sub_dir = '';  | 
                                                        |
| 1286 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 1287 | - $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 1284 | + $file_info = pathinfo($file);  | 
                                                        |
| 1285 | + $sub_dir = '';  | 
                                                        |
| 1286 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 1287 | + $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 1288 | 1288 | |
| 1289 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        |
| 1290 | - $uploads_baseurl = $uploads['baseurl'];  | 
                                                        |
| 1291 | - $uploads_path = $uploads['path'];  | 
                                                        |
| 1289 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        |
| 1290 | + $uploads_baseurl = $uploads['baseurl'];  | 
                                                        |
| 1291 | + $uploads_path = $uploads['path'];  | 
                                                        |
| 1292 | 1292 | |
| 1293 | - $file_name = $file_info['basename'];  | 
                                                        |
| 1293 | + $file_name = $file_info['basename'];  | 
                                                        |
| 1294 | 1294 | |
| 1295 | - $uploads_url = $uploads_baseurl . $sub_dir;  | 
                                                        |
| 1296 | - /*  | 
                                                        |
| 1295 | + $uploads_url = $uploads_baseurl . $sub_dir;  | 
                                                        |
| 1296 | + /*  | 
                                                        |
| 1297 | 1297 | * Allows the filter of image src for such things as CDN change.  | 
                                                        
| 1298 | 1298 | *  | 
                                                        
| 1299 | 1299 | * @since 1.5.7  | 
                                                        
@@ -1302,158 +1302,158 @@ discard block  | 
                                                    ||
| 1302 | 1302 | * @param string $uploads_url The server upload directory url.  | 
                                                        
| 1303 | 1303 | * @param string $uploads_baseurl The uploads dir base url.  | 
                                                        
| 1304 | 1304 | */  | 
                                                        
| 1305 | -            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
 | 
                                                        |
| 1306 | - $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1307 | - $width = 0;  | 
                                                        |
| 1308 | - $height = 0;  | 
                                                        |
| 1309 | -            if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
 | 
                                                        |
| 1310 | - $imagesize = getimagesize($img_arr['path']);  | 
                                                        |
| 1311 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1312 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1313 | - }  | 
                                                        |
| 1314 | - $img_arr['width'] = $width;  | 
                                                        |
| 1315 | - $img_arr['height'] = $height;  | 
                                                        |
| 1316 | - $img_arr['title'] = '';  | 
                                                        |
| 1317 | -        } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
 | 
                                                        |
| 1318 | -            foreach ($post_images as $image) {
 | 
                                                        |
| 1319 | - return $image;  | 
                                                        |
| 1320 | - }  | 
                                                        |
| 1321 | -        } else if ($no_image) {
 | 
                                                        |
| 1322 | - $img_arr = array();  | 
                                                        |
| 1323 | -  | 
                                                        |
| 1324 | - $default_img = '';  | 
                                                        |
| 1325 | -            if (isset($post->default_category) && $post->default_category) {
 | 
                                                        |
| 1326 | - $default_cat = $post->default_category;  | 
                                                        |
| 1327 | -            } else {
 | 
                                                        |
| 1328 | - $default_cat = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        |
| 1329 | - }  | 
                                                        |
| 1330 | -  | 
                                                        |
| 1331 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))  | 
                                                        |
| 1332 | - $default_img = $default_catimg['src'];  | 
                                                        |
| 1333 | -            elseif ($no_image) {
 | 
                                                        |
| 1334 | -                $default_img = get_option('geodir_listing_no_img');
 | 
                                                        |
| 1335 | - }  | 
                                                        |
| 1336 | -  | 
                                                        |
| 1337 | -            if (!empty($default_img)) {
 | 
                                                        |
| 1338 | - $uploads = wp_upload_dir(); // Array of key => value pairs  | 
                                                        |
| 1339 | - $uploads_baseurl = $uploads['baseurl'];  | 
                                                        |
| 1340 | - $uploads_path = $uploads['path'];  | 
                                                        |
| 1341 | -  | 
                                                        |
| 1342 | - $img_arr = array();  | 
                                                        |
| 1343 | -  | 
                                                        |
| 1344 | - $file_info = pathinfo($default_img);  | 
                                                        |
| 1345 | -  | 
                                                        |
| 1346 | - $file_name = $file_info['basename'];  | 
                                                        |
| 1347 | -  | 
                                                        |
| 1348 | - $img_arr['src'] = $default_img;  | 
                                                        |
| 1349 | - $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1350 | -  | 
                                                        |
| 1351 | - $width = 0;  | 
                                                        |
| 1352 | - $height = 0;  | 
                                                        |
| 1353 | -                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
 | 
                                                        |
| 1354 | - $imagesize = getimagesize($img_arr['path']);  | 
                                                        |
| 1355 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1356 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1357 | - }  | 
                                                        |
| 1358 | - $img_arr['width'] = $width;  | 
                                                        |
| 1359 | - $img_arr['height'] = $height;  | 
                                                        |
| 1360 | -  | 
                                                        |
| 1361 | - $img_arr['title'] = ''; // add the title to the array  | 
                                                        |
| 1362 | - }  | 
                                                        |
| 1363 | - }  | 
                                                        |
| 1364 | -  | 
                                                        |
| 1365 | - if (!empty($img_arr))  | 
                                                        |
| 1366 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );  | 
                                                        |
| 1367 | - else  | 
                                                        |
| 1368 | - return false;  | 
                                                        |
| 1369 | - }  | 
                                                        |
| 1305 | +			$img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
 | 
                                                        |
| 1306 | + $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1307 | + $width = 0;  | 
                                                        |
| 1308 | + $height = 0;  | 
                                                        |
| 1309 | +			if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
 | 
                                                        |
| 1310 | + $imagesize = getimagesize($img_arr['path']);  | 
                                                        |
| 1311 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1312 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1313 | + }  | 
                                                        |
| 1314 | + $img_arr['width'] = $width;  | 
                                                        |
| 1315 | + $img_arr['height'] = $height;  | 
                                                        |
| 1316 | + $img_arr['title'] = '';  | 
                                                        |
| 1317 | +		} elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
 | 
                                                        |
| 1318 | +			foreach ($post_images as $image) {
 | 
                                                        |
| 1319 | + return $image;  | 
                                                        |
| 1320 | + }  | 
                                                        |
| 1321 | +		} else if ($no_image) {
 | 
                                                        |
| 1322 | + $img_arr = array();  | 
                                                        |
| 1323 | +  | 
                                                        |
| 1324 | + $default_img = '';  | 
                                                        |
| 1325 | +			if (isset($post->default_category) && $post->default_category) {
 | 
                                                        |
| 1326 | + $default_cat = $post->default_category;  | 
                                                        |
| 1327 | +			} else {
 | 
                                                        |
| 1328 | + $default_cat = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        |
| 1329 | + }  | 
                                                        |
| 1330 | +  | 
                                                        |
| 1331 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))  | 
                                                        |
| 1332 | + $default_img = $default_catimg['src'];  | 
                                                        |
| 1333 | +			elseif ($no_image) {
 | 
                                                        |
| 1334 | +				$default_img = get_option('geodir_listing_no_img');
 | 
                                                        |
| 1335 | + }  | 
                                                        |
| 1336 | +  | 
                                                        |
| 1337 | +			if (!empty($default_img)) {
 | 
                                                        |
| 1338 | + $uploads = wp_upload_dir(); // Array of key => value pairs  | 
                                                        |
| 1339 | + $uploads_baseurl = $uploads['baseurl'];  | 
                                                        |
| 1340 | + $uploads_path = $uploads['path'];  | 
                                                        |
| 1341 | +  | 
                                                        |
| 1342 | + $img_arr = array();  | 
                                                        |
| 1343 | +  | 
                                                        |
| 1344 | + $file_info = pathinfo($default_img);  | 
                                                        |
| 1345 | +  | 
                                                        |
| 1346 | + $file_name = $file_info['basename'];  | 
                                                        |
| 1347 | +  | 
                                                        |
| 1348 | + $img_arr['src'] = $default_img;  | 
                                                        |
| 1349 | + $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1350 | +  | 
                                                        |
| 1351 | + $width = 0;  | 
                                                        |
| 1352 | + $height = 0;  | 
                                                        |
| 1353 | +				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
 | 
                                                        |
| 1354 | + $imagesize = getimagesize($img_arr['path']);  | 
                                                        |
| 1355 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1356 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1357 | + }  | 
                                                        |
| 1358 | + $img_arr['width'] = $width;  | 
                                                        |
| 1359 | + $img_arr['height'] = $height;  | 
                                                        |
| 1360 | +  | 
                                                        |
| 1361 | + $img_arr['title'] = ''; // add the title to the array  | 
                                                        |
| 1362 | + }  | 
                                                        |
| 1363 | + }  | 
                                                        |
| 1364 | +  | 
                                                        |
| 1365 | + if (!empty($img_arr))  | 
                                                        |
| 1366 | + return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );  | 
                                                        |
| 1367 | + else  | 
                                                        |
| 1368 | + return false;  | 
                                                        |
| 1369 | + }  | 
                                                        |
| 1370 | 1370 | }  | 
                                                        
| 1371 | 1371 | |
| 1372 | 1372 |  if (!function_exists('geodir_show_featured_image')) {
 | 
                                                        
| 1373 | - /**  | 
                                                        |
| 1374 | - * Gets the post featured image.  | 
                                                        |
| 1375 | - *  | 
                                                        |
| 1376 | - * @since 1.0.0  | 
                                                        |
| 1377 | - * @package GeoDirectory  | 
                                                        |
| 1378 | - * @param int|string $post_id The post ID.  | 
                                                        |
| 1379 | - * @param string $size Optional. Thumbnail size. Default: thumbnail.  | 
                                                        |
| 1380 | - * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.  | 
                                                        |
| 1381 | - * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.  | 
                                                        |
| 1382 | - * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.  | 
                                                        |
| 1383 | - * @return bool|string Returns image html.  | 
                                                        |
| 1384 | - */  | 
                                                        |
| 1385 | - function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)  | 
                                                        |
| 1386 | -    {
 | 
                                                        |
| 1387 | - $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);  | 
                                                        |
| 1388 | -  | 
                                                        |
| 1389 | - $html = geodir_show_image($image, $size, $no_image, false);  | 
                                                        |
| 1390 | -  | 
                                                        |
| 1391 | -        if (!empty($html) && $echo) {
 | 
                                                        |
| 1392 | - echo $html;  | 
                                                        |
| 1393 | -        } elseif (!empty($html)) {
 | 
                                                        |
| 1394 | - return $html;  | 
                                                        |
| 1395 | - } else  | 
                                                        |
| 1396 | - return false;  | 
                                                        |
| 1397 | - }  | 
                                                        |
| 1373 | + /**  | 
                                                        |
| 1374 | + * Gets the post featured image.  | 
                                                        |
| 1375 | + *  | 
                                                        |
| 1376 | + * @since 1.0.0  | 
                                                        |
| 1377 | + * @package GeoDirectory  | 
                                                        |
| 1378 | + * @param int|string $post_id The post ID.  | 
                                                        |
| 1379 | + * @param string $size Optional. Thumbnail size. Default: thumbnail.  | 
                                                        |
| 1380 | + * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.  | 
                                                        |
| 1381 | + * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.  | 
                                                        |
| 1382 | + * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.  | 
                                                        |
| 1383 | + * @return bool|string Returns image html.  | 
                                                        |
| 1384 | + */  | 
                                                        |
| 1385 | + function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)  | 
                                                        |
| 1386 | +	{
 | 
                                                        |
| 1387 | + $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);  | 
                                                        |
| 1388 | +  | 
                                                        |
| 1389 | + $html = geodir_show_image($image, $size, $no_image, false);  | 
                                                        |
| 1390 | +  | 
                                                        |
| 1391 | +		if (!empty($html) && $echo) {
 | 
                                                        |
| 1392 | + echo $html;  | 
                                                        |
| 1393 | +		} elseif (!empty($html)) {
 | 
                                                        |
| 1394 | + return $html;  | 
                                                        |
| 1395 | + } else  | 
                                                        |
| 1396 | + return false;  | 
                                                        |
| 1397 | + }  | 
                                                        |
| 1398 | 1398 | }  | 
                                                        
| 1399 | 1399 | |
| 1400 | 1400 |  if (!function_exists('geodir_get_images')) {
 | 
                                                        
| 1401 | - /**  | 
                                                        |
| 1402 | - * Gets the post images.  | 
                                                        |
| 1403 | - *  | 
                                                        |
| 1404 | - * @since 1.0.0  | 
                                                        |
| 1405 | - * @package GeoDirectory  | 
                                                        |
| 1406 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 1407 | - * @param int $post_id The post ID.  | 
                                                        |
| 1408 | - * @param string $img_size Optional. Thumbnail size.  | 
                                                        |
| 1409 | - * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.  | 
                                                        |
| 1410 | - * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.  | 
                                                        |
| 1411 | - * @param int|string $limit Optional. Number of images.  | 
                                                        |
| 1412 | - * @return array|bool Returns images as an array. Each item is an object.  | 
                                                        |
| 1413 | - */  | 
                                                        |
| 1414 | - function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')  | 
                                                        |
| 1415 | -    {
 | 
                                                        |
| 1416 | - global $wpdb;  | 
                                                        |
| 1417 | -        if ($limit) {
 | 
                                                        |
| 1418 | - $limit_q = " LIMIT $limit ";  | 
                                                        |
| 1419 | -        } else {
 | 
                                                        |
| 1420 | - $limit_q = '';  | 
                                                        |
| 1421 | - }  | 
                                                        |
| 1422 | - $not_featured = '';  | 
                                                        |
| 1423 | - $sub_dir = '';  | 
                                                        |
| 1424 | - if (!$add_featured)  | 
                                                        |
| 1425 | - $not_featured = " AND is_featured = 0 ";  | 
                                                        |
| 1426 | -  | 
                                                        |
| 1427 | - $arrImages = $wpdb->get_results(  | 
                                                        |
| 1428 | - $wpdb->prepare(  | 
                                                        |
| 1429 | - "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 ",  | 
                                                        |
| 1430 | -                array('%image%', $post_id)
 | 
                                                        |
| 1431 | - )  | 
                                                        |
| 1432 | - );  | 
                                                        |
| 1433 | -  | 
                                                        |
| 1434 | - $counter = 0;  | 
                                                        |
| 1435 | - $return_arr = array();  | 
                                                        |
| 1436 | -  | 
                                                        |
| 1437 | -        if (!empty($arrImages)) {
 | 
                                                        |
| 1438 | -            foreach ($arrImages as $attechment) {
 | 
                                                        |
| 1439 | -  | 
                                                        |
| 1440 | - $img_arr = array();  | 
                                                        |
| 1441 | - $img_arr['id'] = $attechment->ID;  | 
                                                        |
| 1442 | - $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;  | 
                                                        |
| 1443 | -  | 
                                                        |
| 1444 | - $file_info = pathinfo($attechment->file);  | 
                                                        |
| 1445 | -  | 
                                                        |
| 1446 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 1447 | - $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 1448 | -  | 
                                                        |
| 1449 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        |
| 1450 | - $uploads_baseurl = $uploads['baseurl'];  | 
                                                        |
| 1451 | - $uploads_path = $uploads['path'];  | 
                                                        |
| 1452 | -  | 
                                                        |
| 1453 | - $file_name = $file_info['basename'];  | 
                                                        |
| 1454 | -  | 
                                                        |
| 1455 | - $uploads_url = $uploads_baseurl . $sub_dir;  | 
                                                        |
| 1456 | - /*  | 
                                                        |
| 1401 | + /**  | 
                                                        |
| 1402 | + * Gets the post images.  | 
                                                        |
| 1403 | + *  | 
                                                        |
| 1404 | + * @since 1.0.0  | 
                                                        |
| 1405 | + * @package GeoDirectory  | 
                                                        |
| 1406 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 1407 | + * @param int $post_id The post ID.  | 
                                                        |
| 1408 | + * @param string $img_size Optional. Thumbnail size.  | 
                                                        |
| 1409 | + * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.  | 
                                                        |
| 1410 | + * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.  | 
                                                        |
| 1411 | + * @param int|string $limit Optional. Number of images.  | 
                                                        |
| 1412 | + * @return array|bool Returns images as an array. Each item is an object.  | 
                                                        |
| 1413 | + */  | 
                                                        |
| 1414 | + function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')  | 
                                                        |
| 1415 | +	{
 | 
                                                        |
| 1416 | + global $wpdb;  | 
                                                        |
| 1417 | +		if ($limit) {
 | 
                                                        |
| 1418 | + $limit_q = " LIMIT $limit ";  | 
                                                        |
| 1419 | +		} else {
 | 
                                                        |
| 1420 | + $limit_q = '';  | 
                                                        |
| 1421 | + }  | 
                                                        |
| 1422 | + $not_featured = '';  | 
                                                        |
| 1423 | + $sub_dir = '';  | 
                                                        |
| 1424 | + if (!$add_featured)  | 
                                                        |
| 1425 | + $not_featured = " AND is_featured = 0 ";  | 
                                                        |
| 1426 | +  | 
                                                        |
| 1427 | + $arrImages = $wpdb->get_results(  | 
                                                        |
| 1428 | + $wpdb->prepare(  | 
                                                        |
| 1429 | + "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 ",  | 
                                                        |
| 1430 | +				array('%image%', $post_id)
 | 
                                                        |
| 1431 | + )  | 
                                                        |
| 1432 | + );  | 
                                                        |
| 1433 | +  | 
                                                        |
| 1434 | + $counter = 0;  | 
                                                        |
| 1435 | + $return_arr = array();  | 
                                                        |
| 1436 | +  | 
                                                        |
| 1437 | +		if (!empty($arrImages)) {
 | 
                                                        |
| 1438 | +			foreach ($arrImages as $attechment) {
 | 
                                                        |
| 1439 | +  | 
                                                        |
| 1440 | + $img_arr = array();  | 
                                                        |
| 1441 | + $img_arr['id'] = $attechment->ID;  | 
                                                        |
| 1442 | + $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;  | 
                                                        |
| 1443 | +  | 
                                                        |
| 1444 | + $file_info = pathinfo($attechment->file);  | 
                                                        |
| 1445 | +  | 
                                                        |
| 1446 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 1447 | + $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 1448 | +  | 
                                                        |
| 1449 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        |
| 1450 | + $uploads_baseurl = $uploads['baseurl'];  | 
                                                        |
| 1451 | + $uploads_path = $uploads['path'];  | 
                                                        |
| 1452 | +  | 
                                                        |
| 1453 | + $file_name = $file_info['basename'];  | 
                                                        |
| 1454 | +  | 
                                                        |
| 1455 | + $uploads_url = $uploads_baseurl . $sub_dir;  | 
                                                        |
| 1456 | + /*  | 
                                                        |
| 1457 | 1457 | * Allows the filter of image src for such things as CDN change.  | 
                                                        
| 1458 | 1458 | *  | 
                                                        
| 1459 | 1459 | * @since 1.5.7  | 
                                                        
@@ -1462,534 +1462,534 @@ discard block  | 
                                                    ||
| 1462 | 1462 | * @param string $uploads_url The server upload directory url.  | 
                                                        
| 1463 | 1463 | * @param string $uploads_baseurl The uploads dir base url.  | 
                                                        
| 1464 | 1464 | */  | 
                                                        
| 1465 | -                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
 | 
                                                        |
| 1466 | - $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1467 | - $width = 0;  | 
                                                        |
| 1468 | - $height = 0;  | 
                                                        |
| 1469 | -                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
 | 
                                                        |
| 1470 | - $imagesize = getimagesize($img_arr['path']);  | 
                                                        |
| 1471 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1472 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1473 | - }  | 
                                                        |
| 1474 | - $img_arr['width'] = $width;  | 
                                                        |
| 1475 | - $img_arr['height'] = $height;  | 
                                                        |
| 1476 | -  | 
                                                        |
| 1477 | - $img_arr['file'] = $file_name; // add the title to the array  | 
                                                        |
| 1478 | - $img_arr['title'] = $attechment->title; // add the title to the array  | 
                                                        |
| 1479 | - $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array  | 
                                                        |
| 1480 | - $img_arr['content'] = $attechment->content; // add the description to the array  | 
                                                        |
| 1481 | - $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.  | 
                                                        |
| 1482 | -  | 
                                                        |
| 1483 | - $return_arr[] = (object)$img_arr;  | 
                                                        |
| 1484 | -  | 
                                                        |
| 1485 | - $counter++;  | 
                                                        |
| 1486 | - }  | 
                                                        |
| 1487 | - return (object)$return_arr;  | 
                                                        |
| 1488 | -        } else if ($no_images) {
 | 
                                                        |
| 1489 | - $default_img = '';  | 
                                                        |
| 1490 | - $default_cat = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        |
| 1491 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 1492 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))  | 
                                                        |
| 1493 | - $default_img = $default_catimg['src'];  | 
                                                        |
| 1494 | -            elseif ($no_images) {
 | 
                                                        |
| 1495 | -                $default_img = get_option('geodir_listing_no_img');
 | 
                                                        |
| 1496 | - }  | 
                                                        |
| 1497 | -  | 
                                                        |
| 1498 | -            if (!empty($default_img)) {
 | 
                                                        |
| 1499 | - $uploads = wp_upload_dir(); // Array of key => value pairs  | 
                                                        |
| 1465 | +				$img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
 | 
                                                        |
| 1466 | + $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1467 | + $width = 0;  | 
                                                        |
| 1468 | + $height = 0;  | 
                                                        |
| 1469 | +				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
 | 
                                                        |
| 1470 | + $imagesize = getimagesize($img_arr['path']);  | 
                                                        |
| 1471 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1472 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1473 | + }  | 
                                                        |
| 1474 | + $img_arr['width'] = $width;  | 
                                                        |
| 1475 | + $img_arr['height'] = $height;  | 
                                                        |
| 1476 | +  | 
                                                        |
| 1477 | + $img_arr['file'] = $file_name; // add the title to the array  | 
                                                        |
| 1478 | + $img_arr['title'] = $attechment->title; // add the title to the array  | 
                                                        |
| 1479 | + $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array  | 
                                                        |
| 1480 | + $img_arr['content'] = $attechment->content; // add the description to the array  | 
                                                        |
| 1481 | + $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.  | 
                                                        |
| 1482 | +  | 
                                                        |
| 1483 | + $return_arr[] = (object)$img_arr;  | 
                                                        |
| 1484 | +  | 
                                                        |
| 1485 | + $counter++;  | 
                                                        |
| 1486 | + }  | 
                                                        |
| 1487 | + return (object)$return_arr;  | 
                                                        |
| 1488 | +		} else if ($no_images) {
 | 
                                                        |
| 1489 | + $default_img = '';  | 
                                                        |
| 1490 | + $default_cat = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        |
| 1491 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 1492 | + if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))  | 
                                                        |
| 1493 | + $default_img = $default_catimg['src'];  | 
                                                        |
| 1494 | +			elseif ($no_images) {
 | 
                                                        |
| 1495 | +				$default_img = get_option('geodir_listing_no_img');
 | 
                                                        |
| 1496 | + }  | 
                                                        |
| 1497 | +  | 
                                                        |
| 1498 | +			if (!empty($default_img)) {
 | 
                                                        |
| 1499 | + $uploads = wp_upload_dir(); // Array of key => value pairs  | 
                                                        |
| 1500 | 1500 | |
| 1501 | - $image_path = $default_img;  | 
                                                        |
| 1502 | -                if (!path_is_absolute($image_path)) {
 | 
                                                        |
| 1503 | - $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);  | 
                                                        |
| 1504 | - }  | 
                                                        |
| 1505 | -  | 
                                                        |
| 1506 | - $file_info = pathinfo($default_img);  | 
                                                        |
| 1507 | - $file_name = $file_info['basename'];  | 
                                                        |
| 1508 | -  | 
                                                        |
| 1509 | - $width = '';  | 
                                                        |
| 1510 | - $height = '';  | 
                                                        |
| 1511 | -                if (is_file($image_path) && file_exists($image_path)) {
 | 
                                                        |
| 1512 | - $imagesize = getimagesize($image_path);  | 
                                                        |
| 1513 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1514 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1515 | - }  | 
                                                        |
| 1501 | + $image_path = $default_img;  | 
                                                        |
| 1502 | +				if (!path_is_absolute($image_path)) {
 | 
                                                        |
| 1503 | + $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);  | 
                                                        |
| 1504 | + }  | 
                                                        |
| 1505 | +  | 
                                                        |
| 1506 | + $file_info = pathinfo($default_img);  | 
                                                        |
| 1507 | + $file_name = $file_info['basename'];  | 
                                                        |
| 1508 | +  | 
                                                        |
| 1509 | + $width = '';  | 
                                                        |
| 1510 | + $height = '';  | 
                                                        |
| 1511 | +				if (is_file($image_path) && file_exists($image_path)) {
 | 
                                                        |
| 1512 | + $imagesize = getimagesize($image_path);  | 
                                                        |
| 1513 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1514 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1515 | + }  | 
                                                        |
| 1516 | 1516 | |
| 1517 | - $img_arr = array();  | 
                                                        |
| 1518 | - $img_arr['src'] = $default_img;  | 
                                                        |
| 1519 | - $img_arr['path'] = $image_path;  | 
                                                        |
| 1520 | - $img_arr['width'] = $width;  | 
                                                        |
| 1521 | - $img_arr['height'] = $height;  | 
                                                        |
| 1522 | - $img_arr['file'] = $file_name; // add the title to the array  | 
                                                        |
| 1523 | - $img_arr['title'] = $file_info['filename']; // add the title to the array  | 
                                                        |
| 1524 | - $img_arr['content'] = $file_info['filename']; // add the description to the array  | 
                                                        |
| 1525 | -  | 
                                                        |
| 1526 | - $return_arr[] = (object)$img_arr;  | 
                                                        |
| 1527 | -  | 
                                                        |
| 1528 | - return $return_arr;  | 
                                                        |
| 1529 | - } else  | 
                                                        |
| 1530 | - return false;  | 
                                                        |
| 1531 | - }  | 
                                                        |
| 1532 | - }  | 
                                                        |
| 1517 | + $img_arr = array();  | 
                                                        |
| 1518 | + $img_arr['src'] = $default_img;  | 
                                                        |
| 1519 | + $img_arr['path'] = $image_path;  | 
                                                        |
| 1520 | + $img_arr['width'] = $width;  | 
                                                        |
| 1521 | + $img_arr['height'] = $height;  | 
                                                        |
| 1522 | + $img_arr['file'] = $file_name; // add the title to the array  | 
                                                        |
| 1523 | + $img_arr['title'] = $file_info['filename']; // add the title to the array  | 
                                                        |
| 1524 | + $img_arr['content'] = $file_info['filename']; // add the description to the array  | 
                                                        |
| 1525 | +  | 
                                                        |
| 1526 | + $return_arr[] = (object)$img_arr;  | 
                                                        |
| 1527 | +  | 
                                                        |
| 1528 | + return $return_arr;  | 
                                                        |
| 1529 | + } else  | 
                                                        |
| 1530 | + return false;  | 
                                                        |
| 1531 | + }  | 
                                                        |
| 1532 | + }  | 
                                                        |
| 1533 | 1533 | }  | 
                                                        
| 1534 | 1534 | |
| 1535 | 1535 |  if (!function_exists('geodir_show_image')) {
 | 
                                                        
| 1536 | - /**  | 
                                                        |
| 1537 | - * Show image using image details.  | 
                                                        |
| 1538 | - *  | 
                                                        |
| 1539 | - * @since 1.0.0  | 
                                                        |
| 1540 | - * @package GeoDirectory  | 
                                                        |
| 1541 | - * @param array|object $request Image info either as an array or object.  | 
                                                        |
| 1542 | - * @param string $size Optional. Thumbnail size. Default: thumbnail.  | 
                                                        |
| 1543 | - * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.  | 
                                                        |
| 1544 | - * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.  | 
                                                        |
| 1545 | - * @return bool|string Returns image html.  | 
                                                        |
| 1546 | - */  | 
                                                        |
| 1547 | - function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)  | 
                                                        |
| 1548 | -    {
 | 
                                                        |
| 1549 | - $image = new stdClass();  | 
                                                        |
| 1550 | -  | 
                                                        |
| 1551 | - $html = '';  | 
                                                        |
| 1552 | -        if (!empty($request)) {
 | 
                                                        |
| 1553 | -            if (!is_object($request)){
 | 
                                                        |
| 1554 | - $request = (object)$request;  | 
                                                        |
| 1555 | - }  | 
                                                        |
| 1556 | -  | 
                                                        |
| 1557 | -            if (isset($request->src) && !isset($request->path)) {
 | 
                                                        |
| 1558 | - $request->path = $request->src;  | 
                                                        |
| 1559 | - }  | 
                                                        |
| 1560 | -  | 
                                                        |
| 1561 | - /*  | 
                                                        |
| 1536 | + /**  | 
                                                        |
| 1537 | + * Show image using image details.  | 
                                                        |
| 1538 | + *  | 
                                                        |
| 1539 | + * @since 1.0.0  | 
                                                        |
| 1540 | + * @package GeoDirectory  | 
                                                        |
| 1541 | + * @param array|object $request Image info either as an array or object.  | 
                                                        |
| 1542 | + * @param string $size Optional. Thumbnail size. Default: thumbnail.  | 
                                                        |
| 1543 | + * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.  | 
                                                        |
| 1544 | + * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.  | 
                                                        |
| 1545 | + * @return bool|string Returns image html.  | 
                                                        |
| 1546 | + */  | 
                                                        |
| 1547 | + function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)  | 
                                                        |
| 1548 | +	{
 | 
                                                        |
| 1549 | + $image = new stdClass();  | 
                                                        |
| 1550 | +  | 
                                                        |
| 1551 | + $html = '';  | 
                                                        |
| 1552 | +		if (!empty($request)) {
 | 
                                                        |
| 1553 | +			if (!is_object($request)){
 | 
                                                        |
| 1554 | + $request = (object)$request;  | 
                                                        |
| 1555 | + }  | 
                                                        |
| 1556 | +  | 
                                                        |
| 1557 | +			if (isset($request->src) && !isset($request->path)) {
 | 
                                                        |
| 1558 | + $request->path = $request->src;  | 
                                                        |
| 1559 | + }  | 
                                                        |
| 1560 | +  | 
                                                        |
| 1561 | + /*  | 
                                                        |
| 1562 | 1562 | * getimagesize() works faster from path than url so we try and get path if we can.  | 
                                                        
| 1563 | 1563 | */  | 
                                                        
| 1564 | - $upload_dir = wp_upload_dir();  | 
                                                        |
| 1565 | -            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
 | 
                                                        |
| 1566 | -            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
 | 
                                                        |
| 1567 | -            if (strpos($img_no_http, $upload_no_http) !== false) {
 | 
                                                        |
| 1568 | - $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);  | 
                                                        |
| 1569 | - }  | 
                                                        |
| 1564 | + $upload_dir = wp_upload_dir();  | 
                                                        |
| 1565 | +			$img_no_http = str_replace(array("http://", "https://"), "", $request->path);
 | 
                                                        |
| 1566 | +			$upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
 | 
                                                        |
| 1567 | +			if (strpos($img_no_http, $upload_no_http) !== false) {
 | 
                                                        |
| 1568 | + $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);  | 
                                                        |
| 1569 | + }  | 
                                                        |
| 1570 | 1570 | |
| 1571 | - $width = 0;  | 
                                                        |
| 1572 | - $height = 0;  | 
                                                        |
| 1573 | -            if (is_file($request->path) && file_exists($request->path)) {
 | 
                                                        |
| 1574 | - $imagesize = getimagesize($request->path);  | 
                                                        |
| 1575 | - $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1576 | - $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1577 | - }  | 
                                                        |
| 1578 | -  | 
                                                        |
| 1579 | - $image->src = $request->src;  | 
                                                        |
| 1580 | - $image->width = $width;  | 
                                                        |
| 1581 | - $image->height = $height;  | 
                                                        |
| 1582 | -  | 
                                                        |
| 1583 | - $max_size = (object)geodir_get_imagesize($size);  | 
                                                        |
| 1584 | -  | 
                                                        |
| 1585 | -            if (!is_wp_error($max_size)) {
 | 
                                                        |
| 1586 | -                if ($image->width) {
 | 
                                                        |
| 1587 | -                    if ($image->height >= $image->width) {
 | 
                                                        |
| 1588 | - $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);  | 
                                                        |
| 1589 | -                    } else if ($image->width < ($max_size->h)) {
 | 
                                                        |
| 1590 | - $width_per = round((($image->width / $max_size->w) * 100), 2);  | 
                                                        |
| 1591 | - } else  | 
                                                        |
| 1592 | - $width_per = 100;  | 
                                                        |
| 1593 | - }  | 
                                                        |
| 1594 | -  | 
                                                        |
| 1595 | -                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
 | 
                                                        |
| 1596 | - $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>';  | 
                                                        |
| 1597 | -                } else {
 | 
                                                        |
| 1598 | -                    if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
 | 
                                                        |
| 1599 | - $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';  | 
                                                        |
| 1600 | -                    }else{
 | 
                                                        |
| 1601 | - //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';  | 
                                                        |
| 1602 | - //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';  | 
                                                        |
| 1603 | - $html = '<div data-src="'.$image->src.'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';  | 
                                                        |
| 1604 | -  | 
                                                        |
| 1605 | - }  | 
                                                        |
| 1606 | -  | 
                                                        |
| 1607 | - }  | 
                                                        |
| 1608 | - }  | 
                                                        |
| 1609 | - }  | 
                                                        |
| 1610 | -  | 
                                                        |
| 1611 | -        if (!empty($html) && $echo) {
 | 
                                                        |
| 1612 | - echo $html;  | 
                                                        |
| 1613 | -        } elseif (!empty($html)) {
 | 
                                                        |
| 1614 | - return $html;  | 
                                                        |
| 1615 | - } else  | 
                                                        |
| 1616 | - return false;  | 
                                                        |
| 1617 | - }  | 
                                                        |
| 1618 | -}  | 
                                                        |
| 1571 | + $width = 0;  | 
                                                        |
| 1572 | + $height = 0;  | 
                                                        |
| 1573 | +			if (is_file($request->path) && file_exists($request->path)) {
 | 
                                                        |
| 1574 | + $imagesize = getimagesize($request->path);  | 
                                                        |
| 1575 | + $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';  | 
                                                        |
| 1576 | + $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';  | 
                                                        |
| 1577 | + }  | 
                                                        |
| 1619 | 1578 | |
| 1620 | -if (!function_exists('geodir_set_post_terms')) {
 | 
                                                        |
| 1621 | - /**  | 
                                                        |
| 1622 | - * Set post Categories.  | 
                                                        |
| 1623 | - *  | 
                                                        |
| 1624 | - * @since 1.0.0  | 
                                                        |
| 1625 | - * @package GeoDirectory  | 
                                                        |
| 1626 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 1627 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 1628 | - * @param int $post_id The post ID.  | 
                                                        |
| 1629 | - * @param array $terms An array of term objects.  | 
                                                        |
| 1630 | - * @param array $tt_ids An array of term taxonomy IDs.  | 
                                                        |
| 1631 | - * @param string $taxonomy Taxonomy slug.  | 
                                                        |
| 1632 | - */  | 
                                                        |
| 1633 | - function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)  | 
                                                        |
| 1634 | -    {
 | 
                                                        |
| 1635 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 1579 | + $image->src = $request->src;  | 
                                                        |
| 1580 | + $image->width = $width;  | 
                                                        |
| 1581 | + $image->height = $height;  | 
                                                        |
| 1636 | 1582 | |
| 1637 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 1583 | + $max_size = (object)geodir_get_imagesize($size);  | 
                                                        |
| 1638 | 1584 | |
| 1639 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 1585 | +			if (!is_wp_error($max_size)) {
 | 
                                                        |
| 1586 | +				if ($image->width) {
 | 
                                                        |
| 1587 | +					if ($image->height >= $image->width) {
 | 
                                                        |
| 1588 | + $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);  | 
                                                        |
| 1589 | +					} else if ($image->width < ($max_size->h)) {
 | 
                                                        |
| 1590 | + $width_per = round((($image->width / $max_size->w) * 100), 2);  | 
                                                        |
| 1591 | + } else  | 
                                                        |
| 1592 | + $width_per = 100;  | 
                                                        |
| 1593 | + }  | 
                                                        |
| 1594 | +  | 
                                                        |
| 1595 | +				if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
 | 
                                                        |
| 1596 | + $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>';  | 
                                                        |
| 1597 | +				} else {
 | 
                                                        |
| 1598 | +					if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
 | 
                                                        |
| 1599 | + $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';  | 
                                                        |
| 1600 | +					}else{
 | 
                                                        |
| 1601 | + //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';  | 
                                                        |
| 1602 | + //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';  | 
                                                        |
| 1603 | + $html = '<div data-src="'.$image->src.'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';  | 
                                                        |
| 1604 | +  | 
                                                        |
| 1605 | + }  | 
                                                        |
| 1640 | 1606 | |
| 1641 | -        if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
 | 
                                                        |
| 1607 | + }  | 
                                                        |
| 1608 | + }  | 
                                                        |
| 1609 | + }  | 
                                                        |
| 1610 | +  | 
                                                        |
| 1611 | +		if (!empty($html) && $echo) {
 | 
                                                        |
| 1612 | + echo $html;  | 
                                                        |
| 1613 | +		} elseif (!empty($html)) {
 | 
                                                        |
| 1614 | + return $html;  | 
                                                        |
| 1615 | + } else  | 
                                                        |
| 1616 | + return false;  | 
                                                        |
| 1617 | + }  | 
                                                        |
| 1618 | +}  | 
                                                        |
| 1642 | 1619 | |
| 1643 | -            if ($taxonomy == $post_type . '_tags') {
 | 
                                                        |
| 1644 | -                if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
 | 
                                                        |
| 1645 | - geodir_save_post_meta($post_id, 'post_tags', $terms);  | 
                                                        |
| 1646 | - }  | 
                                                        |
| 1647 | -            } elseif ($taxonomy == $post_type . 'category') {
 | 
                                                        |
| 1648 | -                $srcharr = array('"', '\\');
 | 
                                                        |
| 1649 | -                $replarr = array(""", '');
 | 
                                                        |
| 1620 | +if (!function_exists('geodir_set_post_terms')) {
 | 
                                                        |
| 1621 | + /**  | 
                                                        |
| 1622 | + * Set post Categories.  | 
                                                        |
| 1623 | + *  | 
                                                        |
| 1624 | + * @since 1.0.0  | 
                                                        |
| 1625 | + * @package GeoDirectory  | 
                                                        |
| 1626 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 1627 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 1628 | + * @param int $post_id The post ID.  | 
                                                        |
| 1629 | + * @param array $terms An array of term objects.  | 
                                                        |
| 1630 | + * @param array $tt_ids An array of term taxonomy IDs.  | 
                                                        |
| 1631 | + * @param string $taxonomy Taxonomy slug.  | 
                                                        |
| 1632 | + */  | 
                                                        |
| 1633 | + function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)  | 
                                                        |
| 1634 | +	{
 | 
                                                        |
| 1635 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 1636 | +  | 
                                                        |
| 1637 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 1638 | +  | 
                                                        |
| 1639 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 1640 | +  | 
                                                        |
| 1641 | +		if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
 | 
                                                        |
| 1642 | +  | 
                                                        |
| 1643 | +			if ($taxonomy == $post_type . '_tags') {
 | 
                                                        |
| 1644 | +				if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
 | 
                                                        |
| 1645 | + geodir_save_post_meta($post_id, 'post_tags', $terms);  | 
                                                        |
| 1646 | + }  | 
                                                        |
| 1647 | +			} elseif ($taxonomy == $post_type . 'category') {
 | 
                                                        |
| 1648 | +				$srcharr = array('"', '\\');
 | 
                                                        |
| 1649 | +				$replarr = array(""", '');
 | 
                                                        |
| 1650 | 1650 | |
| 1651 | - $post_obj = get_post($post_id);  | 
                                                        |
| 1651 | + $post_obj = get_post($post_id);  | 
                                                        |
| 1652 | 1652 | |
| 1653 | -                $cat_ids = array('0');
 | 
                                                        |
| 1654 | - if (is_array($tt_ids))  | 
                                                        |
| 1655 | - $cat_ids = $tt_ids;  | 
                                                        |
| 1653 | +				$cat_ids = array('0');
 | 
                                                        |
| 1654 | + if (is_array($tt_ids))  | 
                                                        |
| 1655 | + $cat_ids = $tt_ids;  | 
                                                        |
| 1656 | 1656 | |
| 1657 | 1657 | |
| 1658 | -                if (!empty($cat_ids)) {
 | 
                                                        |
| 1659 | - $cat_ids_array = $cat_ids;  | 
                                                        |
| 1660 | - $cat_ids_length = count($cat_ids_array);  | 
                                                        |
| 1661 | - $cat_ids_format = array_fill(0, $cat_ids_length, '%d');  | 
                                                        |
| 1662 | -                    $format = implode(',', $cat_ids_format);
 | 
                                                        |
| 1658 | +				if (!empty($cat_ids)) {
 | 
                                                        |
| 1659 | + $cat_ids_array = $cat_ids;  | 
                                                        |
| 1660 | + $cat_ids_length = count($cat_ids_array);  | 
                                                        |
| 1661 | + $cat_ids_format = array_fill(0, $cat_ids_length, '%d');  | 
                                                        |
| 1662 | +					$format = implode(',', $cat_ids_format);
 | 
                                                        |
| 1663 | 1663 | |
| 1664 | - $cat_ids_array_del = $cat_ids_array;  | 
                                                        |
| 1665 | - $cat_ids_array_del[] = $post_id;  | 
                                                        |
| 1664 | + $cat_ids_array_del = $cat_ids_array;  | 
                                                        |
| 1665 | + $cat_ids_array_del[] = $post_id;  | 
                                                        |
| 1666 | 1666 | |
| 1667 | - $wpdb->get_var(  | 
                                                        |
| 1668 | - $wpdb->prepare(  | 
                                                        |
| 1669 | - "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",  | 
                                                        |
| 1670 | - $cat_ids_array_del  | 
                                                        |
| 1671 | - )  | 
                                                        |
| 1672 | - );  | 
                                                        |
| 1667 | + $wpdb->get_var(  | 
                                                        |
| 1668 | + $wpdb->prepare(  | 
                                                        |
| 1669 | + "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",  | 
                                                        |
| 1670 | + $cat_ids_array_del  | 
                                                        |
| 1671 | + )  | 
                                                        |
| 1672 | + );  | 
                                                        |
| 1673 | 1673 | |
| 1674 | 1674 | |
| 1675 | - $post_term = $wpdb->get_col(  | 
                                                        |
| 1676 | - $wpdb->prepare(  | 
                                                        |
| 1677 | - "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",  | 
                                                        |
| 1678 | - $cat_ids_array  | 
                                                        |
| 1679 | - )  | 
                                                        |
| 1680 | - );  | 
                                                        |
| 1675 | + $post_term = $wpdb->get_col(  | 
                                                        |
| 1676 | + $wpdb->prepare(  | 
                                                        |
| 1677 | + "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",  | 
                                                        |
| 1678 | + $cat_ids_array  | 
                                                        |
| 1679 | + )  | 
                                                        |
| 1680 | + );  | 
                                                        |
| 1681 | 1681 | |
| 1682 | - }  | 
                                                        |
| 1682 | + }  | 
                                                        |
| 1683 | 1683 | |
| 1684 | - $post_marker_json = '';  | 
                                                        |
| 1684 | + $post_marker_json = '';  | 
                                                        |
| 1685 | 1685 | |
| 1686 | - if (!empty($post_term)):  | 
                                                        |
| 1686 | + if (!empty($post_term)):  | 
                                                        |
| 1687 | 1687 | |
| 1688 | - foreach ($post_term as $cat_id):  | 
                                                        |
| 1688 | + foreach ($post_term as $cat_id):  | 
                                                        |
| 1689 | 1689 | |
| 1690 | - $term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);  | 
                                                        |
| 1691 | - $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';  | 
                                                        |
| 1690 | + $term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);  | 
                                                        |
| 1691 | + $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';  | 
                                                        |
| 1692 | 1692 | |
| 1693 | - $post_title = $post_obj->title;  | 
                                                        |
| 1694 | - $title = str_replace($srcharr, $replarr, $post_title);  | 
                                                        |
| 1693 | + $post_title = $post_obj->title;  | 
                                                        |
| 1694 | + $title = str_replace($srcharr, $replarr, $post_title);  | 
                                                        |
| 1695 | 1695 | |
| 1696 | - $lat = geodir_get_post_meta($post_id, 'post_latitude', true);  | 
                                                        |
| 1697 | - $lng = geodir_get_post_meta($post_id, 'post_longitude', true);  | 
                                                        |
| 1696 | + $lat = geodir_get_post_meta($post_id, 'post_latitude', true);  | 
                                                        |
| 1697 | + $lng = geodir_get_post_meta($post_id, 'post_longitude', true);  | 
                                                        |
| 1698 | 1698 | |
| 1699 | -                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
 | 
                                                        |
| 1700 | - $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);  | 
                                                        |
| 1699 | +						$timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
 | 
                                                        |
| 1700 | + $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);  | 
                                                        |
| 1701 | 1701 | |
| 1702 | -                        $json = '{';
 | 
                                                        |
| 1703 | - $json .= '"id":"' . $post_id . '",';  | 
                                                        |
| 1704 | - $json .= '"lat_pos": "' . $lat . '",';  | 
                                                        |
| 1705 | - $json .= '"long_pos": "' . $lng . '",';  | 
                                                        |
| 1706 | - $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';  | 
                                                        |
| 1707 | - $json .= '"icon":"' . $term_icon . '",';  | 
                                                        |
| 1708 | - $json .= '"group":"catgroup' . $cat_id . '"';  | 
                                                        |
| 1709 | - $json .= '}';  | 
                                                        |
| 1702 | +						$json = '{';
 | 
                                                        |
| 1703 | + $json .= '"id":"' . $post_id . '",';  | 
                                                        |
| 1704 | + $json .= '"lat_pos": "' . $lat . '",';  | 
                                                        |
| 1705 | + $json .= '"long_pos": "' . $lng . '",';  | 
                                                        |
| 1706 | + $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';  | 
                                                        |
| 1707 | + $json .= '"icon":"' . $term_icon . '",';  | 
                                                        |
| 1708 | + $json .= '"group":"catgroup' . $cat_id . '"';  | 
                                                        |
| 1709 | + $json .= '}';  | 
                                                        |
| 1710 | 1710 | |
| 1711 | 1711 | |
| 1712 | - if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))  | 
                                                        |
| 1713 | - $post_marker_json = $json;  | 
                                                        |
| 1712 | + if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))  | 
                                                        |
| 1713 | + $post_marker_json = $json;  | 
                                                        |
| 1714 | 1714 | |
| 1715 | 1715 | |
| 1716 | -                        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)))) {
 | 
                                                        |
| 1716 | +						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)))) {
 | 
                                                        |
| 1717 | 1717 | |
| 1718 | -                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
 | 
                                                        |
| 1718 | +							$json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
 | 
                                                        |
| 1719 | 1719 | post_title = %s,  | 
                                                        
| 1720 | 1720 | json = %s  | 
                                                        
| 1721 | 1721 | WHERE post_id = %d AND cat_id = %d ",  | 
                                                        
| 1722 | - array($post_title, $json, $post_id, $cat_id));  | 
                                                        |
| 1722 | + array($post_title, $json, $post_id, $cat_id));  | 
                                                        |
| 1723 | 1723 | |
| 1724 | -                        } else {
 | 
                                                        |
| 1724 | +						} else {
 | 
                                                        |
| 1725 | 1725 | |
| 1726 | -                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
 | 
                                                        |
| 1726 | +							$json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
 | 
                                                        |
| 1727 | 1727 | post_id = %d,  | 
                                                        
| 1728 | 1728 | post_title = %s,  | 
                                                        
| 1729 | 1729 | cat_id = %d,  | 
                                                        
| 1730 | 1730 | json = %s",  | 
                                                        
| 1731 | - array($post_id, $post_title, $cat_id, $json));  | 
                                                        |
| 1731 | + array($post_id, $post_title, $cat_id, $json));  | 
                                                        |
| 1732 | 1732 | |
| 1733 | - }  | 
                                                        |
| 1733 | + }  | 
                                                        |
| 1734 | 1734 | |
| 1735 | - $wpdb->query($json_query);  | 
                                                        |
| 1735 | + $wpdb->query($json_query);  | 
                                                        |
| 1736 | 1736 | |
| 1737 | - endforeach;  | 
                                                        |
| 1737 | + endforeach;  | 
                                                        |
| 1738 | 1738 | |
| 1739 | - endif;  | 
                                                        |
| 1739 | + endif;  | 
                                                        |
| 1740 | 1740 | |
| 1741 | -                if (!empty($post_term) && is_array($post_term)) {
 | 
                                                        |
| 1742 | -                    $categories = implode(',', $post_term);
 | 
                                                        |
| 1741 | +				if (!empty($post_term) && is_array($post_term)) {
 | 
                                                        |
| 1742 | +					$categories = implode(',', $post_term);
 | 
                                                        |
| 1743 | 1743 | |
| 1744 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';  | 
                                                        |
| 1744 | + if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';  | 
                                                        |
| 1745 | 1745 | |
| 1746 | - if (empty($post_marker_json))  | 
                                                        |
| 1747 | - $post_marker_json = isset($json) ? $json : '';  | 
                                                        |
| 1746 | + if (empty($post_marker_json))  | 
                                                        |
| 1747 | + $post_marker_json = isset($json) ? $json : '';  | 
                                                        |
| 1748 | 1748 | |
| 1749 | -                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 1749 | +					if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 1750 | 1750 | |
| 1751 | - $wpdb->query(  | 
                                                        |
| 1752 | - $wpdb->prepare(  | 
                                                        |
| 1753 | - "UPDATE " . $table . " SET  | 
                                                        |
| 1751 | + $wpdb->query(  | 
                                                        |
| 1752 | + $wpdb->prepare(  | 
                                                        |
| 1753 | + "UPDATE " . $table . " SET  | 
                                                        |
| 1754 | 1754 | " . $taxonomy . " = %s,  | 
                                                        
| 1755 | 1755 | marker_json = %s  | 
                                                        
| 1756 | 1756 | where post_id = %d",  | 
                                                        
| 1757 | - array($categories, $post_marker_json, $post_id)  | 
                                                        |
| 1758 | - )  | 
                                                        |
| 1759 | - );  | 
                                                        |
| 1757 | + array($categories, $post_marker_json, $post_id)  | 
                                                        |
| 1758 | + )  | 
                                                        |
| 1759 | + );  | 
                                                        |
| 1760 | 1760 | |
| 1761 | -                        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
 | 
                                                        |
| 1761 | +						if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
 | 
                                                        |
| 1762 | 1762 | |
| 1763 | - $categories = trim($categories, ',');  | 
                                                        |
| 1763 | + $categories = trim($categories, ',');  | 
                                                        |
| 1764 | 1764 | |
| 1765 | -                            if ($categories) {
 | 
                                                        |
| 1765 | +							if ($categories) {
 | 
                                                        |
| 1766 | 1766 | |
| 1767 | -                                $categories = explode(',', $categories);
 | 
                                                        |
| 1767 | +								$categories = explode(',', $categories);
 | 
                                                        |
| 1768 | 1768 | |
| 1769 | - $default_category = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        |
| 1769 | + $default_category = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        |
| 1770 | 1770 | |
| 1771 | -                                if (!in_array($default_category, $categories)) {
 | 
                                                        |
| 1771 | +								if (!in_array($default_category, $categories)) {
 | 
                                                        |
| 1772 | 1772 | |
| 1773 | - $wpdb->query(  | 
                                                        |
| 1774 | - $wpdb->prepare(  | 
                                                        |
| 1775 | - "UPDATE " . $table . " SET  | 
                                                        |
| 1773 | + $wpdb->query(  | 
                                                        |
| 1774 | + $wpdb->prepare(  | 
                                                        |
| 1775 | + "UPDATE " . $table . " SET  | 
                                                        |
| 1776 | 1776 | default_category = %s  | 
                                                        
| 1777 | 1777 | where post_id = %d",  | 
                                                        
| 1778 | - array($categories[0], $post_id)  | 
                                                        |
| 1779 | - )  | 
                                                        |
| 1780 | - );  | 
                                                        |
| 1778 | + array($categories[0], $post_id)  | 
                                                        |
| 1779 | + )  | 
                                                        |
| 1780 | + );  | 
                                                        |
| 1781 | 1781 | |
| 1782 | - $default_category = $categories[0];  | 
                                                        |
| 1782 | + $default_category = $categories[0];  | 
                                                        |
| 1783 | 1783 | |
| 1784 | - }  | 
                                                        |
| 1784 | + }  | 
                                                        |
| 1785 | 1785 | |
| 1786 | - if ($default_category == '')  | 
                                                        |
| 1787 | - $default_category = $categories[0];  | 
                                                        |
| 1786 | + if ($default_category == '')  | 
                                                        |
| 1787 | + $default_category = $categories[0];  | 
                                                        |
| 1788 | 1788 | |
| 1789 | - geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');  | 
                                                        |
| 1789 | + geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');  | 
                                                        |
| 1790 | 1790 | |
| 1791 | - }  | 
                                                        |
| 1791 | + }  | 
                                                        |
| 1792 | 1792 | |
| 1793 | - }  | 
                                                        |
| 1793 | + }  | 
                                                        |
| 1794 | 1794 | |
| 1795 | 1795 | |
| 1796 | -                    } else {
 | 
                                                        |
| 1796 | +					} else {
 | 
                                                        |
| 1797 | 1797 | |
| 1798 | - $wpdb->query(  | 
                                                        |
| 1799 | - $wpdb->prepare(  | 
                                                        |
| 1800 | - "INSERT INTO " . $table . " SET  | 
                                                        |
| 1798 | + $wpdb->query(  | 
                                                        |
| 1799 | + $wpdb->prepare(  | 
                                                        |
| 1800 | + "INSERT INTO " . $table . " SET  | 
                                                        |
| 1801 | 1801 | post_id = %d,  | 
                                                        
| 1802 | 1802 | " . $taxonomy . " = %s,  | 
                                                        
| 1803 | 1803 | marker_json = %s ",  | 
                                                        
| 1804 | 1804 | |
| 1805 | - array($post_id, $categories, $post_marker_json)  | 
                                                        |
| 1806 | - )  | 
                                                        |
| 1807 | - );  | 
                                                        |
| 1808 | - }  | 
                                                        |
| 1809 | - }  | 
                                                        |
| 1810 | - }  | 
                                                        |
| 1811 | - }  | 
                                                        |
| 1812 | - }  | 
                                                        |
| 1805 | + array($post_id, $categories, $post_marker_json)  | 
                                                        |
| 1806 | + )  | 
                                                        |
| 1807 | + );  | 
                                                        |
| 1808 | + }  | 
                                                        |
| 1809 | + }  | 
                                                        |
| 1810 | + }  | 
                                                        |
| 1811 | + }  | 
                                                        |
| 1812 | + }  | 
                                                        |
| 1813 | 1813 | }  | 
                                                        
| 1814 | 1814 | |
| 1815 | 1815 |  if (!function_exists('geodir_get_infowindow_html')) {
 | 
                                                        
| 1816 | - /**  | 
                                                        |
| 1817 | - * Set post Map Marker info html.  | 
                                                        |
| 1818 | - *  | 
                                                        |
| 1819 | - * @since 1.0.0  | 
                                                        |
| 1820 | - * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".  | 
                                                        |
| 1821 | - * @package GeoDirectory  | 
                                                        |
| 1822 | - * @global array $geodir_addon_list List of active GeoDirectory extensions.  | 
                                                        |
| 1823 | - * @global object $gd_session GeoDirectory Session object.  | 
                                                        |
| 1824 | - * @param object $postinfo_obj The post details object.  | 
                                                        |
| 1825 | - * @param string $post_preview Is this a post preview?.  | 
                                                        |
| 1826 | - * @return mixed|string|void  | 
                                                        |
| 1827 | - */  | 
                                                        |
| 1828 | - function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')  | 
                                                        |
| 1829 | -    {
 | 
                                                        |
| 1830 | - global $preview, $gd_session;  | 
                                                        |
| 1831 | -        $srcharr = array("'", "/", "-", '"', '\\');
 | 
                                                        |
| 1832 | -        $replarr = array("′", "⁄", "–", "“", '');
 | 
                                                        |
| 1833 | -  | 
                                                        |
| 1834 | -        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
 | 
                                                        |
| 1835 | - $ID = '';  | 
                                                        |
| 1836 | - $plink = '';  | 
                                                        |
| 1837 | -  | 
                                                        |
| 1838 | -            if (isset($postinfo_obj->pid)) {
 | 
                                                        |
| 1839 | - $ID = $postinfo_obj->pid;  | 
                                                        |
| 1840 | - $plink = get_permalink($ID);  | 
                                                        |
| 1841 | - }  | 
                                                        |
| 1842 | -  | 
                                                        |
| 1843 | - $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));  | 
                                                        |
| 1844 | - $lat = $postinfo_obj->post_latitude;  | 
                                                        |
| 1845 | - $lng = $postinfo_obj->post_longitude;  | 
                                                        |
| 1846 | - $address = str_replace($srcharr, $replarr, ($postinfo_obj->post_address));  | 
                                                        |
| 1847 | - $contact = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_contact));  | 
                                                        |
| 1848 | - $timing = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_timing));  | 
                                                        |
| 1849 | -        } else {
 | 
                                                        |
| 1850 | - $ID = $postinfo_obj->post_id;  | 
                                                        |
| 1851 | - $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan  | 
                                                        |
| 1852 | - $plink = get_permalink($ID);  | 
                                                        |
| 1853 | - $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));  | 
                                                        |
| 1854 | - $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));  | 
                                                        |
| 1855 | - $address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8')); // fix by Stiofan  | 
                                                        |
| 1856 | - $contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));  | 
                                                        |
| 1857 | - $timing = str_replace($srcharr, $replarr, (geodir_get_post_meta($ID, 'geodir_timing', true)));  | 
                                                        |
| 1858 | - }  | 
                                                        |
| 1859 | -  | 
                                                        |
| 1860 | - // filter field as per price package  | 
                                                        |
| 1861 | - global $geodir_addon_list;  | 
                                                        |
| 1862 | -        if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
 | 
                                                        |
| 1863 | - $post_type = get_post_type($ID);  | 
                                                        |
| 1864 | - $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;  | 
                                                        |
| 1865 | - $field_name = 'geodir_contact';  | 
                                                        |
| 1866 | -            if (!check_field_visibility($package_id, $field_name, $post_type)) {
 | 
                                                        |
| 1867 | - $contact = '';  | 
                                                        |
| 1868 | - }  | 
                                                        |
| 1869 | -  | 
                                                        |
| 1870 | - $field_name = 'geodir_timing';  | 
                                                        |
| 1871 | -            if (!check_field_visibility($package_id, $field_name, $post_type)) {
 | 
                                                        |
| 1872 | - $timing = '';  | 
                                                        |
| 1873 | - }  | 
                                                        |
| 1874 | - }  | 
                                                        |
| 1875 | -  | 
                                                        |
| 1876 | -        if ($lat && $lng) {
 | 
                                                        |
| 1877 | - ob_start(); ?>  | 
                                                        |
| 1816 | + /**  | 
                                                        |
| 1817 | + * Set post Map Marker info html.  | 
                                                        |
| 1818 | + *  | 
                                                        |
| 1819 | + * @since 1.0.0  | 
                                                        |
| 1820 | + * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".  | 
                                                        |
| 1821 | + * @package GeoDirectory  | 
                                                        |
| 1822 | + * @global array $geodir_addon_list List of active GeoDirectory extensions.  | 
                                                        |
| 1823 | + * @global object $gd_session GeoDirectory Session object.  | 
                                                        |
| 1824 | + * @param object $postinfo_obj The post details object.  | 
                                                        |
| 1825 | + * @param string $post_preview Is this a post preview?.  | 
                                                        |
| 1826 | + * @return mixed|string|void  | 
                                                        |
| 1827 | + */  | 
                                                        |
| 1828 | + function geodir_get_infowindow_html($postinfo_obj, $post_preview = '')  | 
                                                        |
| 1829 | +	{
 | 
                                                        |
| 1830 | + global $preview, $gd_session;  | 
                                                        |
| 1831 | +		$srcharr = array("'", "/", "-", '"', '\\');
 | 
                                                        |
| 1832 | +		$replarr = array("′", "⁄", "–", "“", '');
 | 
                                                        |
| 1833 | +  | 
                                                        |
| 1834 | +		if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
 | 
                                                        |
| 1835 | + $ID = '';  | 
                                                        |
| 1836 | + $plink = '';  | 
                                                        |
| 1837 | +  | 
                                                        |
| 1838 | +			if (isset($postinfo_obj->pid)) {
 | 
                                                        |
| 1839 | + $ID = $postinfo_obj->pid;  | 
                                                        |
| 1840 | + $plink = get_permalink($ID);  | 
                                                        |
| 1841 | + }  | 
                                                        |
| 1842 | +  | 
                                                        |
| 1843 | + $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));  | 
                                                        |
| 1844 | + $lat = $postinfo_obj->post_latitude;  | 
                                                        |
| 1845 | + $lng = $postinfo_obj->post_longitude;  | 
                                                        |
| 1846 | + $address = str_replace($srcharr, $replarr, ($postinfo_obj->post_address));  | 
                                                        |
| 1847 | + $contact = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_contact));  | 
                                                        |
| 1848 | + $timing = str_replace($srcharr, $replarr, ($postinfo_obj->geodir_timing));  | 
                                                        |
| 1849 | +		} else {
 | 
                                                        |
| 1850 | + $ID = $postinfo_obj->post_id;  | 
                                                        |
| 1851 | + $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan  | 
                                                        |
| 1852 | + $plink = get_permalink($ID);  | 
                                                        |
| 1853 | + $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));  | 
                                                        |
| 1854 | + $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));  | 
                                                        |
| 1855 | + $address = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'post_address', true), ENT_COMPAT, 'UTF-8')); // fix by Stiofan  | 
                                                        |
| 1856 | + $contact = str_replace($srcharr, $replarr, htmlentities(geodir_get_post_meta($ID, 'geodir_contact', true), ENT_COMPAT, 'UTF-8'));  | 
                                                        |
| 1857 | + $timing = str_replace($srcharr, $replarr, (geodir_get_post_meta($ID, 'geodir_timing', true)));  | 
                                                        |
| 1858 | + }  | 
                                                        |
| 1859 | +  | 
                                                        |
| 1860 | + // filter field as per price package  | 
                                                        |
| 1861 | + global $geodir_addon_list;  | 
                                                        |
| 1862 | +		if (isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
 | 
                                                        |
| 1863 | + $post_type = get_post_type($ID);  | 
                                                        |
| 1864 | + $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;  | 
                                                        |
| 1865 | + $field_name = 'geodir_contact';  | 
                                                        |
| 1866 | +			if (!check_field_visibility($package_id, $field_name, $post_type)) {
 | 
                                                        |
| 1867 | + $contact = '';  | 
                                                        |
| 1868 | + }  | 
                                                        |
| 1869 | +  | 
                                                        |
| 1870 | + $field_name = 'geodir_timing';  | 
                                                        |
| 1871 | +			if (!check_field_visibility($package_id, $field_name, $post_type)) {
 | 
                                                        |
| 1872 | + $timing = '';  | 
                                                        |
| 1873 | + }  | 
                                                        |
| 1874 | + }  | 
                                                        |
| 1875 | +  | 
                                                        |
| 1876 | +		if ($lat && $lng) {
 | 
                                                        |
| 1877 | + ob_start(); ?>  | 
                                                        |
| 1878 | 1878 | <div class="gd-bubble" style="">  | 
                                                        
| 1879 | 1879 | <div class="gd-bubble-inside">  | 
                                                        
| 1880 | 1880 | <?php  | 
                                                        
| 1881 | - $comment_count = '';  | 
                                                        |
| 1882 | - $rating_star = '';  | 
                                                        |
| 1883 | -                    if ($ID != '') {
 | 
                                                        |
| 1884 | - $rating_star = '';  | 
                                                        |
| 1885 | - $comment_count = geodir_get_review_count_total($ID);  | 
                                                        |
| 1886 | -  | 
                                                        |
| 1887 | -                        if (!$preview) {
 | 
                                                        |
| 1888 | - $post_avgratings = geodir_get_post_rating($ID);  | 
                                                        |
| 1889 | -  | 
                                                        |
| 1890 | - $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);  | 
                                                        |
| 1891 | -  | 
                                                        |
| 1892 | - /**  | 
                                                        |
| 1893 | - * Filter to change rating stars  | 
                                                        |
| 1894 | - *  | 
                                                        |
| 1895 | - * You can use this filter to change Rating stars.  | 
                                                        |
| 1896 | - *  | 
                                                        |
| 1897 | - * @since 1.0.0  | 
                                                        |
| 1898 | - * @package GeoDirectory  | 
                                                        |
| 1899 | - * @param string $rating_star Rating stars.  | 
                                                        |
| 1900 | - * @param float $post_avgratings Average ratings of the post.  | 
                                                        |
| 1901 | - * @param int $ID The post ID.  | 
                                                        |
| 1902 | - */  | 
                                                        |
| 1903 | -                            $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
 | 
                                                        |
| 1904 | - }  | 
                                                        |
| 1905 | - }  | 
                                                        |
| 1906 | - ?>  | 
                                                        |
| 1881 | + $comment_count = '';  | 
                                                        |
| 1882 | + $rating_star = '';  | 
                                                        |
| 1883 | +					if ($ID != '') {
 | 
                                                        |
| 1884 | + $rating_star = '';  | 
                                                        |
| 1885 | + $comment_count = geodir_get_review_count_total($ID);  | 
                                                        |
| 1886 | +  | 
                                                        |
| 1887 | +						if (!$preview) {
 | 
                                                        |
| 1888 | + $post_avgratings = geodir_get_post_rating($ID);  | 
                                                        |
| 1889 | +  | 
                                                        |
| 1890 | + $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);  | 
                                                        |
| 1891 | +  | 
                                                        |
| 1892 | + /**  | 
                                                        |
| 1893 | + * Filter to change rating stars  | 
                                                        |
| 1894 | + *  | 
                                                        |
| 1895 | + * You can use this filter to change Rating stars.  | 
                                                        |
| 1896 | + *  | 
                                                        |
| 1897 | + * @since 1.0.0  | 
                                                        |
| 1898 | + * @package GeoDirectory  | 
                                                        |
| 1899 | + * @param string $rating_star Rating stars.  | 
                                                        |
| 1900 | + * @param float $post_avgratings Average ratings of the post.  | 
                                                        |
| 1901 | + * @param int $ID The post ID.  | 
                                                        |
| 1902 | + */  | 
                                                        |
| 1903 | +							$rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
 | 
                                                        |
| 1904 | + }  | 
                                                        |
| 1905 | + }  | 
                                                        |
| 1906 | + ?>  | 
                                                        |
| 1907 | 1907 | <div class="geodir-bubble_desc">  | 
                                                        
| 1908 | 1908 | <h4>  | 
                                                        
| 1909 | 1909 |                              <a href="<?php if ($plink != '') {
 | 
                                                        
| 1910 | - echo $plink;  | 
                                                        |
| 1911 | -                            } else {
 | 
                                                        |
| 1912 | - echo 'javascript:void(0);';  | 
                                                        |
| 1913 | - } ?>"><?php echo $title; ?></a>  | 
                                                        |
| 1910 | + echo $plink;  | 
                                                        |
| 1911 | +							} else {
 | 
                                                        |
| 1912 | + echo 'javascript:void(0);';  | 
                                                        |
| 1913 | + } ?>"><?php echo $title; ?></a>  | 
                                                        |
| 1914 | 1914 | </h4>  | 
                                                        
| 1915 | 1915 | <?php  | 
                                                        
| 1916 | -                        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
 | 
                                                        |
| 1917 | - $post_images = array();  | 
                                                        |
| 1918 | -                            if (!empty($postinfo_obj->post_images)) {
 | 
                                                        |
| 1919 | -                                $post_images = explode(",", $postinfo_obj->post_images);
 | 
                                                        |
| 1920 | - }  | 
                                                        |
| 1921 | -  | 
                                                        |
| 1922 | -                            if (!empty($post_images)) {
 | 
                                                        |
| 1923 | - ?>  | 
                                                        |
| 1916 | +						if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
 | 
                                                        |
| 1917 | + $post_images = array();  | 
                                                        |
| 1918 | +							if (!empty($postinfo_obj->post_images)) {
 | 
                                                        |
| 1919 | +								$post_images = explode(",", $postinfo_obj->post_images);
 | 
                                                        |
| 1920 | + }  | 
                                                        |
| 1921 | +  | 
                                                        |
| 1922 | +							if (!empty($post_images)) {
 | 
                                                        |
| 1923 | + ?>  | 
                                                        |
| 1924 | 1924 |                                  <div class="geodir-bubble_image"><a href="<?php if ($plink != '') {
 | 
                                                        
| 1925 | - echo $plink;  | 
                                                        |
| 1926 | -                                    } else {
 | 
                                                        |
| 1927 | - echo 'javascript:void(0);';  | 
                                                        |
| 1928 | - } ?>"><img alt="bubble image" style="max-height:50px;"  | 
                                                        |
| 1925 | + echo $plink;  | 
                                                        |
| 1926 | +									} else {
 | 
                                                        |
| 1927 | + echo 'javascript:void(0);';  | 
                                                        |
| 1928 | + } ?>"><img alt="bubble image" style="max-height:50px;"  | 
                                                        |
| 1929 | 1929 | src="<?php echo $post_images[0]; ?>"/></a></div>  | 
                                                        
| 1930 | 1930 | <?php  | 
                                                        
| 1931 | -                            }else{
 | 
                                                        |
| 1932 | - echo '<div class="geodir-bubble_image"></div>';  | 
                                                        |
| 1933 | - }  | 
                                                        |
| 1934 | -                        } else {
 | 
                                                        |
| 1935 | -                            if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
 | 
                                                        |
| 1936 | - ?>  | 
                                                        |
| 1931 | +							}else{
 | 
                                                        |
| 1932 | + echo '<div class="geodir-bubble_image"></div>';  | 
                                                        |
| 1933 | + }  | 
                                                        |
| 1934 | +						} else {
 | 
                                                        |
| 1935 | +							if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
 | 
                                                        |
| 1936 | + ?>  | 
                                                        |
| 1937 | 1937 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>  | 
                                                        
| 1938 | 1938 | <?php  | 
                                                        
| 1939 | -                            }else{
 | 
                                                        |
| 1940 | - echo '<div class="geodir-bubble_image"></div>';  | 
                                                        |
| 1941 | - }  | 
                                                        |
| 1942 | - }  | 
                                                        |
| 1943 | - ?>  | 
                                                        |
| 1939 | +							}else{
 | 
                                                        |
| 1940 | + echo '<div class="geodir-bubble_image"></div>';  | 
                                                        |
| 1941 | + }  | 
                                                        |
| 1942 | + }  | 
                                                        |
| 1943 | + ?>  | 
                                                        |
| 1944 | 1944 | <div class="geodir-bubble-meta-side">  | 
                                                        
| 1945 | 1945 | <?php  | 
                                                        
| 1946 | - /**  | 
                                                        |
| 1947 | - * Fires before the meta info in the map info window.  | 
                                                        |
| 1948 | - *  | 
                                                        |
| 1949 | - * This can be used to add more info to the map info window before the normal meta info.  | 
                                                        |
| 1950 | - *  | 
                                                        |
| 1951 | - * @since 1.5.4  | 
                                                        |
| 1952 | - * @param int $ID The post id.  | 
                                                        |
| 1953 | - * @param object $postinfo_obj The posts info as an object.  | 
                                                        |
| 1954 | - * @param bool|string $post_preview True if currently in post preview page. Empty string if not. *  | 
                                                        |
| 1955 | - */  | 
                                                        |
| 1956 | -                            do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
 | 
                                                        |
| 1957 | - ?>  | 
                                                        |
| 1946 | + /**  | 
                                                        |
| 1947 | + * Fires before the meta info in the map info window.  | 
                                                        |
| 1948 | + *  | 
                                                        |
| 1949 | + * This can be used to add more info to the map info window before the normal meta info.  | 
                                                        |
| 1950 | + *  | 
                                                        |
| 1951 | + * @since 1.5.4  | 
                                                        |
| 1952 | + * @param int $ID The post id.  | 
                                                        |
| 1953 | + * @param object $postinfo_obj The posts info as an object.  | 
                                                        |
| 1954 | + * @param bool|string $post_preview True if currently in post preview page. Empty string if not. *  | 
                                                        |
| 1955 | + */  | 
                                                        |
| 1956 | +							do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
 | 
                                                        |
| 1957 | + ?>  | 
                                                        |
| 1958 | 1958 | <span class="geodir_address"><i class="fa fa-home"></i> <?php echo $address; ?></span>  | 
                                                        
| 1959 | 1959 |                              <?php if ($contact) { ?><span class="geodir_contact"><i
 | 
                                                        
| 1960 | 1960 | class="fa fa-phone"></i>  | 
                                                        
| 1961 | 1961 | <?php  | 
                                                        
| 1962 | -                                $tel_link = apply_filters('geodir_map_bubble_tel_linkable', false);
 | 
                                                        |
| 1963 | -                                if ($tel_link) {
 | 
                                                        |
| 1964 | - ?>  | 
                                                        |
| 1962 | +								$tel_link = apply_filters('geodir_map_bubble_tel_linkable', false);
 | 
                                                        |
| 1963 | +								if ($tel_link) {
 | 
                                                        |
| 1964 | + ?>  | 
                                                        |
| 1965 | 1965 |                                      <a href="tel:<?php echo preg_replace('/[^0-9+]/', '', $contact); ?>"><?php echo stripslashes($contact); ?></a>
 | 
                                                        
| 1966 | 1966 | <?php  | 
                                                        
| 1967 | -                                } else {
 | 
                                                        |
| 1968 | - echo $contact;  | 
                                                        |
| 1969 | - }  | 
                                                        |
| 1970 | - ?>  | 
                                                        |
| 1967 | +								} else {
 | 
                                                        |
| 1968 | + echo $contact;  | 
                                                        |
| 1969 | + }  | 
                                                        |
| 1970 | + ?>  | 
                                                        |
| 1971 | 1971 | </span><?php } ?>  | 
                                                        
| 1972 | 1972 |                              <?php if ($timing) { ?><span class="geodir_timing"><i
 | 
                                                        
| 1973 | 1973 | class="fa fa-clock-o"></i> <?php echo $timing; ?></span><?php }  | 
                                                        
| 1974 | 1974 | |
| 1975 | - /**  | 
                                                        |
| 1976 | - * Fires after the meta info in the map info window.  | 
                                                        |
| 1977 | - *  | 
                                                        |
| 1978 | - * This can be used to add more info to the map info window after the normal meta info.  | 
                                                        |
| 1979 | - *  | 
                                                        |
| 1980 | - * @since 1.4.2  | 
                                                        |
| 1981 | - * @param object $postinfo_obj The posts info as an object.  | 
                                                        |
| 1982 | - * @param bool|string $post_preview True if currently in post preview page. Empty string if not. *  | 
                                                        |
| 1983 | - */  | 
                                                        |
| 1984 | -                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
 | 
                                                        |
| 1985 | - ?>  | 
                                                        |
| 1975 | + /**  | 
                                                        |
| 1976 | + * Fires after the meta info in the map info window.  | 
                                                        |
| 1977 | + *  | 
                                                        |
| 1978 | + * This can be used to add more info to the map info window after the normal meta info.  | 
                                                        |
| 1979 | + *  | 
                                                        |
| 1980 | + * @since 1.4.2  | 
                                                        |
| 1981 | + * @param object $postinfo_obj The posts info as an object.  | 
                                                        |
| 1982 | + * @param bool|string $post_preview True if currently in post preview page. Empty string if not. *  | 
                                                        |
| 1983 | + */  | 
                                                        |
| 1984 | +							do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
 | 
                                                        |
| 1985 | + ?>  | 
                                                        |
| 1986 | 1986 | </div>  | 
                                                        
| 1987 | 1987 | <?php  | 
                                                        
| 1988 | 1988 | |
| 1989 | -                        if ($ID) {
 | 
                                                        |
| 1989 | +						if ($ID) {
 | 
                                                        |
| 1990 | 1990 | |
| 1991 | -                            $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
 | 
                                                        |
| 1992 | - ?>  | 
                                                        |
| 1991 | +							$post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
 | 
                                                        |
| 1992 | + ?>  | 
                                                        |
| 1993 | 1993 | <div class="geodir-bubble-meta-fade"></div>  | 
                                                        
| 1994 | 1994 | |
| 1995 | 1995 | <div class="geodir-bubble-meta-bottom">  | 
                                                        
@@ -2009,69 +2009,69 @@ discard block  | 
                                                    ||
| 2009 | 2009 | </div>  | 
                                                        
| 2010 | 2010 | </div>  | 
                                                        
| 2011 | 2011 | <?php  | 
                                                        
| 2012 | - $html = ob_get_clean();  | 
                                                        |
| 2013 | - /**  | 
                                                        |
| 2014 | - * Filter to change infowindow html  | 
                                                        |
| 2015 | - *  | 
                                                        |
| 2016 | - * You can use this filter to change infowindow html.  | 
                                                        |
| 2017 | - *  | 
                                                        |
| 2018 | - * @since 1.0.0  | 
                                                        |
| 2019 | - * @package GeoDirectory  | 
                                                        |
| 2020 | - * @param string $html Infowindow html.  | 
                                                        |
| 2021 | - * @param object $postinfo_obj The Post object.  | 
                                                        |
| 2022 | - * @param bool|string $post_preview Is this a post preview?  | 
                                                        |
| 2023 | - */  | 
                                                        |
| 2024 | -            $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
 | 
                                                        |
| 2025 | - return $html;  | 
                                                        |
| 2026 | - }  | 
                                                        |
| 2027 | - }  | 
                                                        |
| 2012 | + $html = ob_get_clean();  | 
                                                        |
| 2013 | + /**  | 
                                                        |
| 2014 | + * Filter to change infowindow html  | 
                                                        |
| 2015 | + *  | 
                                                        |
| 2016 | + * You can use this filter to change infowindow html.  | 
                                                        |
| 2017 | + *  | 
                                                        |
| 2018 | + * @since 1.0.0  | 
                                                        |
| 2019 | + * @package GeoDirectory  | 
                                                        |
| 2020 | + * @param string $html Infowindow html.  | 
                                                        |
| 2021 | + * @param object $postinfo_obj The Post object.  | 
                                                        |
| 2022 | + * @param bool|string $post_preview Is this a post preview?  | 
                                                        |
| 2023 | + */  | 
                                                        |
| 2024 | +			$html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
 | 
                                                        |
| 2025 | + return $html;  | 
                                                        |
| 2026 | + }  | 
                                                        |
| 2027 | + }  | 
                                                        |
| 2028 | 2028 | }  | 
                                                        
| 2029 | 2029 | |
| 2030 | 2030 | |
| 2031 | 2031 |  if (!function_exists('geodir_new_post_default_status')) {
 | 
                                                        
| 2032 | - /**  | 
                                                        |
| 2033 | - * Default post status for new posts.  | 
                                                        |
| 2034 | - *  | 
                                                        |
| 2035 | - * @since 1.0.0  | 
                                                        |
| 2036 | - * @package GeoDirectory  | 
                                                        |
| 2037 | - * @return string Returns the default post status for new posts. Ex: draft, publish etc.  | 
                                                        |
| 2038 | - */  | 
                                                        |
| 2039 | - function geodir_new_post_default_status()  | 
                                                        |
| 2040 | -    {
 | 
                                                        |
| 2041 | -        if (get_option('geodir_new_post_default_status'))
 | 
                                                        |
| 2042 | -            return get_option('geodir_new_post_default_status');
 | 
                                                        |
| 2043 | - else  | 
                                                        |
| 2044 | - return 'publish';  | 
                                                        |
| 2045 | -  | 
                                                        |
| 2046 | - }  | 
                                                        |
| 2032 | + /**  | 
                                                        |
| 2033 | + * Default post status for new posts.  | 
                                                        |
| 2034 | + *  | 
                                                        |
| 2035 | + * @since 1.0.0  | 
                                                        |
| 2036 | + * @package GeoDirectory  | 
                                                        |
| 2037 | + * @return string Returns the default post status for new posts. Ex: draft, publish etc.  | 
                                                        |
| 2038 | + */  | 
                                                        |
| 2039 | + function geodir_new_post_default_status()  | 
                                                        |
| 2040 | +	{
 | 
                                                        |
| 2041 | +		if (get_option('geodir_new_post_default_status'))
 | 
                                                        |
| 2042 | +			return get_option('geodir_new_post_default_status');
 | 
                                                        |
| 2043 | + else  | 
                                                        |
| 2044 | + return 'publish';  | 
                                                        |
| 2045 | +  | 
                                                        |
| 2046 | + }  | 
                                                        |
| 2047 | 2047 | }  | 
                                                        
| 2048 | 2048 | |
| 2049 | 2049 |  if (!function_exists('geodir_change_post_status')) {
 | 
                                                        
| 2050 | - /**  | 
                                                        |
| 2051 | - * Change post status of a post.  | 
                                                        |
| 2052 | - *  | 
                                                        |
| 2053 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2054 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 2055 | - * @param int|string $post_id The post ID.  | 
                                                        |
| 2056 | - * @param string $status New post status. Ex: draft, publish etc.  | 
                                                        |
| 2057 | - */  | 
                                                        |
| 2058 | - function geodir_change_post_status($post_id = '', $status = '')  | 
                                                        |
| 2059 | -    {
 | 
                                                        |
| 2060 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 2061 | -  | 
                                                        |
| 2062 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 2063 | -  | 
                                                        |
| 2064 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2065 | -  | 
                                                        |
| 2066 | - $wpdb->query(  | 
                                                        |
| 2067 | - $wpdb->prepare(  | 
                                                        |
| 2068 | - "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",  | 
                                                        |
| 2069 | - array($status, $post_id)  | 
                                                        |
| 2070 | - )  | 
                                                        |
| 2071 | - );  | 
                                                        |
| 2072 | -  | 
                                                        |
| 2073 | -  | 
                                                        |
| 2074 | - }  | 
                                                        |
| 2050 | + /**  | 
                                                        |
| 2051 | + * Change post status of a post.  | 
                                                        |
| 2052 | + *  | 
                                                        |
| 2053 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2054 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 2055 | + * @param int|string $post_id The post ID.  | 
                                                        |
| 2056 | + * @param string $status New post status. Ex: draft, publish etc.  | 
                                                        |
| 2057 | + */  | 
                                                        |
| 2058 | + function geodir_change_post_status($post_id = '', $status = '')  | 
                                                        |
| 2059 | +	{
 | 
                                                        |
| 2060 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 2061 | +  | 
                                                        |
| 2062 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 2063 | +  | 
                                                        |
| 2064 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2065 | +  | 
                                                        |
| 2066 | + $wpdb->query(  | 
                                                        |
| 2067 | + $wpdb->prepare(  | 
                                                        |
| 2068 | + "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",  | 
                                                        |
| 2069 | + array($status, $post_id)  | 
                                                        |
| 2070 | + )  | 
                                                        |
| 2071 | + );  | 
                                                        |
| 2072 | +  | 
                                                        |
| 2073 | +  | 
                                                        |
| 2074 | + }  | 
                                                        |
| 2075 | 2075 | }  | 
                                                        
| 2076 | 2076 | |
| 2077 | 2077 | /**  | 
                                                        
@@ -2085,13 +2085,13 @@ discard block  | 
                                                    ||
| 2085 | 2085 | */  | 
                                                        
| 2086 | 2086 | function geodir_set_post_status($pid, $status)  | 
                                                        
| 2087 | 2087 |  {
 | 
                                                        
| 2088 | -    if ($pid) {
 | 
                                                        |
| 2089 | - global $wpdb;  | 
                                                        |
| 2090 | - $my_post = array();  | 
                                                        |
| 2091 | - $my_post['post_status'] = $status;  | 
                                                        |
| 2092 | - $my_post['ID'] = $pid;  | 
                                                        |
| 2093 | - $last_postid = wp_update_post($my_post);  | 
                                                        |
| 2094 | - }  | 
                                                        |
| 2088 | +	if ($pid) {
 | 
                                                        |
| 2089 | + global $wpdb;  | 
                                                        |
| 2090 | + $my_post = array();  | 
                                                        |
| 2091 | + $my_post['post_status'] = $status;  | 
                                                        |
| 2092 | + $my_post['ID'] = $pid;  | 
                                                        |
| 2093 | + $last_postid = wp_update_post($my_post);  | 
                                                        |
| 2094 | + }  | 
                                                        |
| 2095 | 2095 | }  | 
                                                        
| 2096 | 2096 | |
| 2097 | 2097 | |
@@ -2107,384 +2107,384 @@ discard block  | 
                                                    ||
| 2107 | 2107 | */  | 
                                                        
| 2108 | 2108 | function geodir_update_poststatus($new_status, $old_status, $post)  | 
                                                        
| 2109 | 2109 |  {
 | 
                                                        
| 2110 | - global $wpdb;  | 
                                                        |
| 2110 | + global $wpdb;  | 
                                                        |
| 2111 | 2111 | |
| 2112 | - $geodir_posttypes = geodir_get_posttypes();  | 
                                                        |
| 2112 | + $geodir_posttypes = geodir_get_posttypes();  | 
                                                        |
| 2113 | 2113 | |
| 2114 | -    if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
 | 
                                                        |
| 2114 | +	if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
 | 
                                                        |
| 2115 | 2115 | |
| 2116 | - geodir_change_post_status($post->ID, $new_status);  | 
                                                        |
| 2117 | - }  | 
                                                        |
| 2116 | + geodir_change_post_status($post->ID, $new_status);  | 
                                                        |
| 2117 | + }  | 
                                                        |
| 2118 | 2118 | }  | 
                                                        
| 2119 | 2119 | |
| 2120 | 2120 | |
| 2121 | 2121 |  if (!function_exists('geodir_update_listing_info')) {
 | 
                                                        
| 2122 | - /**  | 
                                                        |
| 2123 | - * Update post info.  | 
                                                        |
| 2124 | - *  | 
                                                        |
| 2125 | - * @since 1.0.0  | 
                                                        |
| 2126 | - * @package GeoDirectory  | 
                                                        |
| 2127 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2128 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 2129 | - * @param int $updatingpost The updating post ID.  | 
                                                        |
| 2130 | - * @param int $temppost The temporary post ID.  | 
                                                        |
| 2131 | - * @todo fix post_id variable  | 
                                                        |
| 2132 | - */  | 
                                                        |
| 2133 | - function geodir_update_listing_info($updatingpost, $temppost)  | 
                                                        |
| 2134 | -    {
 | 
                                                        |
| 2135 | -  | 
                                                        |
| 2136 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 2137 | -  | 
                                                        |
| 2138 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 2139 | -  | 
                                                        |
| 2140 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2141 | -  | 
                                                        |
| 2142 | - $wpdb->query(  | 
                                                        |
| 2143 | - $wpdb->prepare(  | 
                                                        |
| 2144 | - "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2145 | - array($updatingpost, $temppost)  | 
                                                        |
| 2146 | - )  | 
                                                        |
| 2147 | - );  | 
                                                        |
| 2148 | -  | 
                                                        |
| 2149 | - $wpdb->query(  | 
                                                        |
| 2150 | - $wpdb->prepare(  | 
                                                        |
| 2151 | - "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2152 | - array($updatingpost, $temppost)  | 
                                                        |
| 2153 | - )  | 
                                                        |
| 2154 | - );  | 
                                                        |
| 2155 | -  | 
                                                        |
| 2156 | - /* Update Attachments*/  | 
                                                        |
| 2157 | -  | 
                                                        |
| 2158 | - $wpdb->query(  | 
                                                        |
| 2159 | - $wpdb->prepare(  | 
                                                        |
| 2160 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2161 | - array($updatingpost, $temppost)  | 
                                                        |
| 2162 | - )  | 
                                                        |
| 2163 | - );  | 
                                                        |
| 2164 | -  | 
                                                        |
| 2165 | - }  | 
                                                        |
| 2122 | + /**  | 
                                                        |
| 2123 | + * Update post info.  | 
                                                        |
| 2124 | + *  | 
                                                        |
| 2125 | + * @since 1.0.0  | 
                                                        |
| 2126 | + * @package GeoDirectory  | 
                                                        |
| 2127 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2128 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 2129 | + * @param int $updatingpost The updating post ID.  | 
                                                        |
| 2130 | + * @param int $temppost The temporary post ID.  | 
                                                        |
| 2131 | + * @todo fix post_id variable  | 
                                                        |
| 2132 | + */  | 
                                                        |
| 2133 | + function geodir_update_listing_info($updatingpost, $temppost)  | 
                                                        |
| 2134 | +	{
 | 
                                                        |
| 2135 | +  | 
                                                        |
| 2136 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 2137 | +  | 
                                                        |
| 2138 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 2139 | +  | 
                                                        |
| 2140 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2141 | +  | 
                                                        |
| 2142 | + $wpdb->query(  | 
                                                        |
| 2143 | + $wpdb->prepare(  | 
                                                        |
| 2144 | + "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2145 | + array($updatingpost, $temppost)  | 
                                                        |
| 2146 | + )  | 
                                                        |
| 2147 | + );  | 
                                                        |
| 2148 | +  | 
                                                        |
| 2149 | + $wpdb->query(  | 
                                                        |
| 2150 | + $wpdb->prepare(  | 
                                                        |
| 2151 | + "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2152 | + array($updatingpost, $temppost)  | 
                                                        |
| 2153 | + )  | 
                                                        |
| 2154 | + );  | 
                                                        |
| 2155 | +  | 
                                                        |
| 2156 | + /* Update Attachments*/  | 
                                                        |
| 2157 | +  | 
                                                        |
| 2158 | + $wpdb->query(  | 
                                                        |
| 2159 | + $wpdb->prepare(  | 
                                                        |
| 2160 | + "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2161 | + array($updatingpost, $temppost)  | 
                                                        |
| 2162 | + )  | 
                                                        |
| 2163 | + );  | 
                                                        |
| 2164 | +  | 
                                                        |
| 2165 | + }  | 
                                                        |
| 2166 | 2166 | }  | 
                                                        
| 2167 | 2167 | |
| 2168 | 2168 | |
| 2169 | 2169 |  if (!function_exists('geodir_delete_listing_info')) {
 | 
                                                        
| 2170 | - /**  | 
                                                        |
| 2171 | - * Delete Listing info from details table for the given post id.  | 
                                                        |
| 2172 | - *  | 
                                                        |
| 2173 | - * @since 1.0.0  | 
                                                        |
| 2174 | - * @package GeoDirectory  | 
                                                        |
| 2175 | - * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2176 | - * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 2177 | - * @param int $deleted_postid The post ID.  | 
                                                        |
| 2178 | - * @param bool $force Optional. Do you want to force delete it? Default: false.  | 
                                                        |
| 2179 | - * @return bool|void  | 
                                                        |
| 2180 | - */  | 
                                                        |
| 2181 | - function geodir_delete_listing_info($deleted_postid, $force = false)  | 
                                                        |
| 2182 | -    {
 | 
                                                        |
| 2183 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 2184 | -  | 
                                                        |
| 2185 | - // check for multisite deletions  | 
                                                        |
| 2186 | -        if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
 | 
                                                        |
| 2187 | -        } else {
 | 
                                                        |
| 2188 | - return;  | 
                                                        |
| 2189 | - }  | 
                                                        |
| 2190 | -  | 
                                                        |
| 2191 | - $post_type = get_post_type($deleted_postid);  | 
                                                        |
| 2192 | -  | 
                                                        |
| 2193 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2194 | -  | 
                                                        |
| 2195 | - if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 2196 | - return false;  | 
                                                        |
| 2197 | -  | 
                                                        |
| 2198 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2199 | -  | 
                                                        |
| 2200 | - /* Delete custom post meta*/  | 
                                                        |
| 2201 | - $wpdb->query(  | 
                                                        |
| 2202 | - $wpdb->prepare(  | 
                                                        |
| 2203 | - "DELETE FROM " . $table . " WHERE `post_id` = %d",  | 
                                                        |
| 2204 | - array($deleted_postid)  | 
                                                        |
| 2205 | - )  | 
                                                        |
| 2206 | - );  | 
                                                        |
| 2207 | -  | 
                                                        |
| 2208 | - /* Delete post map icons*/  | 
                                                        |
| 2209 | -  | 
                                                        |
| 2210 | - $wpdb->query(  | 
                                                        |
| 2211 | - $wpdb->prepare(  | 
                                                        |
| 2212 | - "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",  | 
                                                        |
| 2213 | - array($deleted_postid)  | 
                                                        |
| 2214 | - )  | 
                                                        |
| 2215 | - );  | 
                                                        |
| 2216 | -  | 
                                                        |
| 2217 | - /* Delete Attachments*/  | 
                                                        |
| 2218 | - $postcurr_images = geodir_get_images($deleted_postid);  | 
                                                        |
| 2219 | -  | 
                                                        |
| 2220 | - $wpdb->query(  | 
                                                        |
| 2221 | - $wpdb->prepare(  | 
                                                        |
| 2222 | - "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",  | 
                                                        |
| 2223 | - array($deleted_postid)  | 
                                                        |
| 2224 | - )  | 
                                                        |
| 2225 | - );  | 
                                                        |
| 2226 | - geodir_remove_attachments($postcurr_images);  | 
                                                        |
| 2227 | -  | 
                                                        |
| 2228 | - }  | 
                                                        |
| 2170 | + /**  | 
                                                        |
| 2171 | + * Delete Listing info from details table for the given post id.  | 
                                                        |
| 2172 | + *  | 
                                                        |
| 2173 | + * @since 1.0.0  | 
                                                        |
| 2174 | + * @package GeoDirectory  | 
                                                        |
| 2175 | + * @global object $wpdb WordPress Database object.  | 
                                                        |
| 2176 | + * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        |
| 2177 | + * @param int $deleted_postid The post ID.  | 
                                                        |
| 2178 | + * @param bool $force Optional. Do you want to force delete it? Default: false.  | 
                                                        |
| 2179 | + * @return bool|void  | 
                                                        |
| 2180 | + */  | 
                                                        |
| 2181 | + function geodir_delete_listing_info($deleted_postid, $force = false)  | 
                                                        |
| 2182 | +	{
 | 
                                                        |
| 2183 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 2184 | +  | 
                                                        |
| 2185 | + // check for multisite deletions  | 
                                                        |
| 2186 | +		if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
 | 
                                                        |
| 2187 | +		} else {
 | 
                                                        |
| 2188 | + return;  | 
                                                        |
| 2189 | + }  | 
                                                        |
| 2190 | +  | 
                                                        |
| 2191 | + $post_type = get_post_type($deleted_postid);  | 
                                                        |
| 2192 | +  | 
                                                        |
| 2193 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2194 | +  | 
                                                        |
| 2195 | + if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 2196 | + return false;  | 
                                                        |
| 2197 | +  | 
                                                        |
| 2198 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2199 | +  | 
                                                        |
| 2200 | + /* Delete custom post meta*/  | 
                                                        |
| 2201 | + $wpdb->query(  | 
                                                        |
| 2202 | + $wpdb->prepare(  | 
                                                        |
| 2203 | + "DELETE FROM " . $table . " WHERE `post_id` = %d",  | 
                                                        |
| 2204 | + array($deleted_postid)  | 
                                                        |
| 2205 | + )  | 
                                                        |
| 2206 | + );  | 
                                                        |
| 2207 | +  | 
                                                        |
| 2208 | + /* Delete post map icons*/  | 
                                                        |
| 2209 | +  | 
                                                        |
| 2210 | + $wpdb->query(  | 
                                                        |
| 2211 | + $wpdb->prepare(  | 
                                                        |
| 2212 | + "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",  | 
                                                        |
| 2213 | + array($deleted_postid)  | 
                                                        |
| 2214 | + )  | 
                                                        |
| 2215 | + );  | 
                                                        |
| 2216 | +  | 
                                                        |
| 2217 | + /* Delete Attachments*/  | 
                                                        |
| 2218 | + $postcurr_images = geodir_get_images($deleted_postid);  | 
                                                        |
| 2219 | +  | 
                                                        |
| 2220 | + $wpdb->query(  | 
                                                        |
| 2221 | + $wpdb->prepare(  | 
                                                        |
| 2222 | + "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",  | 
                                                        |
| 2223 | + array($deleted_postid)  | 
                                                        |
| 2224 | + )  | 
                                                        |
| 2225 | + );  | 
                                                        |
| 2226 | + geodir_remove_attachments($postcurr_images);  | 
                                                        |
| 2227 | +  | 
                                                        |
| 2228 | + }  | 
                                                        |
| 2229 | 2229 | }  | 
                                                        
| 2230 | 2230 | |
| 2231 | 2231 | |
| 2232 | 2232 |  if (!function_exists('geodir_add_to_favorite')) {
 | 
                                                        
| 2233 | - /**  | 
                                                        |
| 2234 | - * This function would add listing to favorite listing.  | 
                                                        |
| 2235 | - *  | 
                                                        |
| 2236 | - * @since 1.0.0  | 
                                                        |
| 2237 | - * @package GeoDirectory  | 
                                                        |
| 2238 | - * @global object $current_user Current user object.  | 
                                                        |
| 2239 | - * @param int $post_id The post ID.  | 
                                                        |
| 2240 | - */  | 
                                                        |
| 2241 | - function geodir_add_to_favorite($post_id)  | 
                                                        |
| 2242 | -    {
 | 
                                                        |
| 2243 | -  | 
                                                        |
| 2244 | - global $current_user;  | 
                                                        |
| 2245 | -  | 
                                                        |
| 2246 | - /**  | 
                                                        |
| 2247 | - * Filter to modify "Unfavorite" text  | 
                                                        |
| 2248 | - *  | 
                                                        |
| 2249 | - * You can use this filter to rename "Unfavorite" text to something else.  | 
                                                        |
| 2250 | - *  | 
                                                        |
| 2251 | - * @since 1.0.0  | 
                                                        |
| 2252 | - * @package GeoDirectory  | 
                                                        |
| 2253 | - */  | 
                                                        |
| 2254 | -        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
 | 
                                                        |
| 2255 | -  | 
                                                        |
| 2256 | - /**  | 
                                                        |
| 2257 | - * Filter to modify "Remove from Favorites" text  | 
                                                        |
| 2258 | - *  | 
                                                        |
| 2259 | - * You can use this filter to rename "Remove from Favorites" text to something else.  | 
                                                        |
| 2260 | - *  | 
                                                        |
| 2261 | - * @since 1.0.0  | 
                                                        |
| 2262 | - * @package GeoDirectory  | 
                                                        |
| 2263 | - */  | 
                                                        |
| 2264 | -        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
 | 
                                                        |
| 2265 | -  | 
                                                        |
| 2266 | - /**  | 
                                                        |
| 2267 | - * Filter to modify "fa fa-heart" icon  | 
                                                        |
| 2268 | - *  | 
                                                        |
| 2269 | - * You can use this filter to change "fa fa-heart" icon to something else.  | 
                                                        |
| 2270 | - *  | 
                                                        |
| 2271 | - * @since 1.0.0  | 
                                                        |
| 2272 | - * @package GeoDirectory  | 
                                                        |
| 2273 | - */  | 
                                                        |
| 2274 | -        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
 | 
                                                        |
| 2275 | -  | 
                                                        |
| 2276 | - $user_meta_data = array();  | 
                                                        |
| 2277 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        |
| 2233 | + /**  | 
                                                        |
| 2234 | + * This function would add listing to favorite listing.  | 
                                                        |
| 2235 | + *  | 
                                                        |
| 2236 | + * @since 1.0.0  | 
                                                        |
| 2237 | + * @package GeoDirectory  | 
                                                        |
| 2238 | + * @global object $current_user Current user object.  | 
                                                        |
| 2239 | + * @param int $post_id The post ID.  | 
                                                        |
| 2240 | + */  | 
                                                        |
| 2241 | + function geodir_add_to_favorite($post_id)  | 
                                                        |
| 2242 | +	{
 | 
                                                        |
| 2243 | +  | 
                                                        |
| 2244 | + global $current_user;  | 
                                                        |
| 2245 | +  | 
                                                        |
| 2246 | + /**  | 
                                                        |
| 2247 | + * Filter to modify "Unfavorite" text  | 
                                                        |
| 2248 | + *  | 
                                                        |
| 2249 | + * You can use this filter to rename "Unfavorite" text to something else.  | 
                                                        |
| 2250 | + *  | 
                                                        |
| 2251 | + * @since 1.0.0  | 
                                                        |
| 2252 | + * @package GeoDirectory  | 
                                                        |
| 2253 | + */  | 
                                                        |
| 2254 | +		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
 | 
                                                        |
| 2255 | +  | 
                                                        |
| 2256 | + /**  | 
                                                        |
| 2257 | + * Filter to modify "Remove from Favorites" text  | 
                                                        |
| 2258 | + *  | 
                                                        |
| 2259 | + * You can use this filter to rename "Remove from Favorites" text to something else.  | 
                                                        |
| 2260 | + *  | 
                                                        |
| 2261 | + * @since 1.0.0  | 
                                                        |
| 2262 | + * @package GeoDirectory  | 
                                                        |
| 2263 | + */  | 
                                                        |
| 2264 | +		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
 | 
                                                        |
| 2265 | +  | 
                                                        |
| 2266 | + /**  | 
                                                        |
| 2267 | + * Filter to modify "fa fa-heart" icon  | 
                                                        |
| 2268 | + *  | 
                                                        |
| 2269 | + * You can use this filter to change "fa fa-heart" icon to something else.  | 
                                                        |
| 2270 | + *  | 
                                                        |
| 2271 | + * @since 1.0.0  | 
                                                        |
| 2272 | + * @package GeoDirectory  | 
                                                        |
| 2273 | + */  | 
                                                        |
| 2274 | +		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
 | 
                                                        |
| 2275 | +  | 
                                                        |
| 2276 | + $user_meta_data = array();  | 
                                                        |
| 2277 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        |
| 2278 | +  | 
                                                        |
| 2279 | +		if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
 | 
                                                        |
| 2280 | + $user_meta_data[] = $post_id;  | 
                                                        |
| 2281 | + }  | 
                                                        |
| 2282 | +  | 
                                                        |
| 2283 | + update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);  | 
                                                        |
| 2284 | +  | 
                                                        |
| 2285 | + /**  | 
                                                        |
| 2286 | + * Called before adding the post from favourites.  | 
                                                        |
| 2287 | + *  | 
                                                        |
| 2288 | + * @since 1.0.0  | 
                                                        |
| 2289 | + * @package GeoDirectory  | 
                                                        |
| 2290 | + * @param int $post_id The post ID.  | 
                                                        |
| 2291 | + */  | 
                                                        |
| 2292 | +		do_action('geodir_before_add_from_favorite', $post_id);
 | 
                                                        |
| 2293 | +  | 
                                                        |
| 2294 | + echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';  | 
                                                        |
| 2295 | +  | 
                                                        |
| 2296 | + /**  | 
                                                        |
| 2297 | + * Called after adding the post from favourites.  | 
                                                        |
| 2298 | + *  | 
                                                        |
| 2299 | + * @since 1.0.0  | 
                                                        |
| 2300 | + * @package GeoDirectory  | 
                                                        |
| 2301 | + * @param int $post_id The post ID.  | 
                                                        |
| 2302 | + */  | 
                                                        |
| 2303 | +		do_action('geodir_after_add_from_favorite', $post_id);
 | 
                                                        |
| 2278 | 2304 | |
| 2279 | -        if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
 | 
                                                        |
| 2280 | - $user_meta_data[] = $post_id;  | 
                                                        |
| 2281 | - }  | 
                                                        |
| 2282 | -  | 
                                                        |
| 2283 | - update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);  | 
                                                        |
| 2284 | -  | 
                                                        |
| 2285 | - /**  | 
                                                        |
| 2286 | - * Called before adding the post from favourites.  | 
                                                        |
| 2287 | - *  | 
                                                        |
| 2288 | - * @since 1.0.0  | 
                                                        |
| 2289 | - * @package GeoDirectory  | 
                                                        |
| 2290 | - * @param int $post_id The post ID.  | 
                                                        |
| 2291 | - */  | 
                                                        |
| 2292 | -        do_action('geodir_before_add_from_favorite', $post_id);
 | 
                                                        |
| 2293 | -  | 
                                                        |
| 2294 | - echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';  | 
                                                        |
| 2295 | -  | 
                                                        |
| 2296 | - /**  | 
                                                        |
| 2297 | - * Called after adding the post from favourites.  | 
                                                        |
| 2298 | - *  | 
                                                        |
| 2299 | - * @since 1.0.0  | 
                                                        |
| 2300 | - * @package GeoDirectory  | 
                                                        |
| 2301 | - * @param int $post_id The post ID.  | 
                                                        |
| 2302 | - */  | 
                                                        |
| 2303 | -        do_action('geodir_after_add_from_favorite', $post_id);
 | 
                                                        |
| 2304 | -  | 
                                                        |
| 2305 | - }  | 
                                                        |
| 2305 | + }  | 
                                                        |
| 2306 | 2306 | }  | 
                                                        
| 2307 | 2307 | |
| 2308 | 2308 |  if (!function_exists('geodir_remove_from_favorite')) {
 | 
                                                        
| 2309 | - /**  | 
                                                        |
| 2310 | - * This function would remove the favourited property earlier.  | 
                                                        |
| 2311 | - *  | 
                                                        |
| 2312 | - * @since 1.0.0  | 
                                                        |
| 2313 | - * @package GeoDirectory  | 
                                                        |
| 2314 | - * @global object $current_user Current user object.  | 
                                                        |
| 2315 | - * @param int $post_id The post ID.  | 
                                                        |
| 2316 | - */  | 
                                                        |
| 2317 | - function geodir_remove_from_favorite($post_id)  | 
                                                        |
| 2318 | -    {
 | 
                                                        |
| 2319 | - global $current_user;  | 
                                                        |
| 2320 | -  | 
                                                        |
| 2321 | - /**  | 
                                                        |
| 2322 | - * Filter to modify "Add to Favorites" text  | 
                                                        |
| 2323 | - *  | 
                                                        |
| 2324 | - * You can use this filter to rename "Add to Favorites" text to something else.  | 
                                                        |
| 2325 | - *  | 
                                                        |
| 2326 | - * @since 1.0.0  | 
                                                        |
| 2327 | - * @package GeoDirectory  | 
                                                        |
| 2328 | - */  | 
                                                        |
| 2329 | -        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
 | 
                                                        |
| 2330 | -  | 
                                                        |
| 2331 | - /**  | 
                                                        |
| 2332 | - * Filter to modify "Favourite" text  | 
                                                        |
| 2333 | - *  | 
                                                        |
| 2334 | - * You can use this filter to rename "Favourite" text to something else.  | 
                                                        |
| 2335 | - *  | 
                                                        |
| 2336 | - * @since 1.0.0  | 
                                                        |
| 2337 | - * @package GeoDirectory  | 
                                                        |
| 2338 | - */  | 
                                                        |
| 2339 | -        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
 | 
                                                        |
| 2340 | -  | 
                                                        |
| 2341 | - /**  | 
                                                        |
| 2342 | - * Filter to modify "fa fa-heart" icon  | 
                                                        |
| 2343 | - *  | 
                                                        |
| 2344 | - * You can use this filter to change "fa fa-heart" icon to something else.  | 
                                                        |
| 2345 | - *  | 
                                                        |
| 2346 | - * @since 1.0.0  | 
                                                        |
| 2347 | - * @package GeoDirectory  | 
                                                        |
| 2348 | - */  | 
                                                        |
| 2349 | -        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
 | 
                                                        |
| 2350 | -  | 
                                                        |
| 2351 | - $user_meta_data = array();  | 
                                                        |
| 2352 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        |
| 2353 | -  | 
                                                        |
| 2354 | -        if (!empty($user_meta_data)) {
 | 
                                                        |
| 2355 | -  | 
                                                        |
| 2356 | -            if (($key = array_search($post_id, $user_meta_data)) !== false) {
 | 
                                                        |
| 2357 | - unset($user_meta_data[$key]);  | 
                                                        |
| 2358 | - }  | 
                                                        |
| 2309 | + /**  | 
                                                        |
| 2310 | + * This function would remove the favourited property earlier.  | 
                                                        |
| 2311 | + *  | 
                                                        |
| 2312 | + * @since 1.0.0  | 
                                                        |
| 2313 | + * @package GeoDirectory  | 
                                                        |
| 2314 | + * @global object $current_user Current user object.  | 
                                                        |
| 2315 | + * @param int $post_id The post ID.  | 
                                                        |
| 2316 | + */  | 
                                                        |
| 2317 | + function geodir_remove_from_favorite($post_id)  | 
                                                        |
| 2318 | +	{
 | 
                                                        |
| 2319 | + global $current_user;  | 
                                                        |
| 2320 | +  | 
                                                        |
| 2321 | + /**  | 
                                                        |
| 2322 | + * Filter to modify "Add to Favorites" text  | 
                                                        |
| 2323 | + *  | 
                                                        |
| 2324 | + * You can use this filter to rename "Add to Favorites" text to something else.  | 
                                                        |
| 2325 | + *  | 
                                                        |
| 2326 | + * @since 1.0.0  | 
                                                        |
| 2327 | + * @package GeoDirectory  | 
                                                        |
| 2328 | + */  | 
                                                        |
| 2329 | +		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
 | 
                                                        |
| 2330 | +  | 
                                                        |
| 2331 | + /**  | 
                                                        |
| 2332 | + * Filter to modify "Favourite" text  | 
                                                        |
| 2333 | + *  | 
                                                        |
| 2334 | + * You can use this filter to rename "Favourite" text to something else.  | 
                                                        |
| 2335 | + *  | 
                                                        |
| 2336 | + * @since 1.0.0  | 
                                                        |
| 2337 | + * @package GeoDirectory  | 
                                                        |
| 2338 | + */  | 
                                                        |
| 2339 | +		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
 | 
                                                        |
| 2340 | +  | 
                                                        |
| 2341 | + /**  | 
                                                        |
| 2342 | + * Filter to modify "fa fa-heart" icon  | 
                                                        |
| 2343 | + *  | 
                                                        |
| 2344 | + * You can use this filter to change "fa fa-heart" icon to something else.  | 
                                                        |
| 2345 | + *  | 
                                                        |
| 2346 | + * @since 1.0.0  | 
                                                        |
| 2347 | + * @package GeoDirectory  | 
                                                        |
| 2348 | + */  | 
                                                        |
| 2349 | +		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
 | 
                                                        |
| 2350 | +  | 
                                                        |
| 2351 | + $user_meta_data = array();  | 
                                                        |
| 2352 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        |
| 2353 | +  | 
                                                        |
| 2354 | +		if (!empty($user_meta_data)) {
 | 
                                                        |
| 2355 | +  | 
                                                        |
| 2356 | +			if (($key = array_search($post_id, $user_meta_data)) !== false) {
 | 
                                                        |
| 2357 | + unset($user_meta_data[$key]);  | 
                                                        |
| 2358 | + }  | 
                                                        |
| 2359 | 2359 | |
| 2360 | - }  | 
                                                        |
| 2360 | + }  | 
                                                        |
| 2361 | 2361 | |
| 2362 | - update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);  | 
                                                        |
| 2362 | + update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);  | 
                                                        |
| 2363 | 2363 | |
| 2364 | - /**  | 
                                                        |
| 2365 | - * Called before removing the post from favourites.  | 
                                                        |
| 2366 | - *  | 
                                                        |
| 2367 | - * @since 1.0.0  | 
                                                        |
| 2368 | - * @package GeoDirectory  | 
                                                        |
| 2369 | - * @param int $post_id The post ID.  | 
                                                        |
| 2370 | - */  | 
                                                        |
| 2371 | -        do_action('geodir_before_remove_from_favorite', $post_id);
 | 
                                                        |
| 2364 | + /**  | 
                                                        |
| 2365 | + * Called before removing the post from favourites.  | 
                                                        |
| 2366 | + *  | 
                                                        |
| 2367 | + * @since 1.0.0  | 
                                                        |
| 2368 | + * @package GeoDirectory  | 
                                                        |
| 2369 | + * @param int $post_id The post ID.  | 
                                                        |
| 2370 | + */  | 
                                                        |
| 2371 | +		do_action('geodir_before_remove_from_favorite', $post_id);
 | 
                                                        |
| 2372 | 2372 | |
| 2373 | - echo '<a href="javascript:void(0);" title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';  | 
                                                        |
| 2373 | + echo '<a href="javascript:void(0);" title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';  | 
                                                        |
| 2374 | 2374 | |
| 2375 | - /**  | 
                                                        |
| 2376 | - * Called after removing the post from favourites.  | 
                                                        |
| 2377 | - *  | 
                                                        |
| 2378 | - * @since 1.0.0  | 
                                                        |
| 2379 | - * @package GeoDirectory  | 
                                                        |
| 2380 | - * @param int $post_id The post ID.  | 
                                                        |
| 2381 | - */  | 
                                                        |
| 2382 | -        do_action('geodir_after_remove_from_favorite', $post_id);
 | 
                                                        |
| 2375 | + /**  | 
                                                        |
| 2376 | + * Called after removing the post from favourites.  | 
                                                        |
| 2377 | + *  | 
                                                        |
| 2378 | + * @since 1.0.0  | 
                                                        |
| 2379 | + * @package GeoDirectory  | 
                                                        |
| 2380 | + * @param int $post_id The post ID.  | 
                                                        |
| 2381 | + */  | 
                                                        |
| 2382 | +		do_action('geodir_after_remove_from_favorite', $post_id);
 | 
                                                        |
| 2383 | 2383 | |
| 2384 | - }  | 
                                                        |
| 2384 | + }  | 
                                                        |
| 2385 | 2385 | }  | 
                                                        
| 2386 | 2386 | |
| 2387 | 2387 |  if (!function_exists('geodir_favourite_html')) {
 | 
                                                        
| 2388 | - /**  | 
                                                        |
| 2389 | - * This function would display the html content for add to favorite or remove from favorite.  | 
                                                        |
| 2390 | - *  | 
                                                        |
| 2391 | - * @since 1.0.0  | 
                                                        |
| 2392 | - * @package GeoDirectory  | 
                                                        |
| 2393 | - * @global object $current_user Current user object.  | 
                                                        |
| 2394 | - * @global object $post The current post object.  | 
                                                        |
| 2395 | - * @param int $user_id The user ID.  | 
                                                        |
| 2396 | - * @param int $post_id The post ID.  | 
                                                        |
| 2397 | - */  | 
                                                        |
| 2398 | - function geodir_favourite_html($user_id, $post_id)  | 
                                                        |
| 2399 | -    {
 | 
                                                        |
| 2400 | -  | 
                                                        |
| 2401 | - global $current_user, $post;  | 
                                                        |
| 2402 | -  | 
                                                        |
| 2403 | - /**  | 
                                                        |
| 2404 | - * Filter to modify "Add to Favorites" text  | 
                                                        |
| 2405 | - *  | 
                                                        |
| 2406 | - * You can use this filter to rename "Add to Favorites" text to something else.  | 
                                                        |
| 2407 | - *  | 
                                                        |
| 2408 | - * @since 1.0.0  | 
                                                        |
| 2409 | - * @package GeoDirectory  | 
                                                        |
| 2410 | - */  | 
                                                        |
| 2411 | -        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
 | 
                                                        |
| 2412 | -  | 
                                                        |
| 2413 | - /**  | 
                                                        |
| 2414 | - * Filter to modify "Favourite" text  | 
                                                        |
| 2415 | - *  | 
                                                        |
| 2416 | - * You can use this filter to rename "Favourite" text to something else.  | 
                                                        |
| 2417 | - *  | 
                                                        |
| 2418 | - * @since 1.0.0  | 
                                                        |
| 2419 | - * @package GeoDirectory  | 
                                                        |
| 2420 | - */  | 
                                                        |
| 2421 | -        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
 | 
                                                        |
| 2422 | -  | 
                                                        |
| 2423 | - /**  | 
                                                        |
| 2424 | - * Filter to modify "Unfavorite" text  | 
                                                        |
| 2425 | - *  | 
                                                        |
| 2426 | - * You can use this filter to rename "Unfavorite" text to something else.  | 
                                                        |
| 2427 | - *  | 
                                                        |
| 2428 | - * @since 1.0.0  | 
                                                        |
| 2429 | - * @package GeoDirectory  | 
                                                        |
| 2430 | - */  | 
                                                        |
| 2431 | -        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
 | 
                                                        |
| 2432 | -  | 
                                                        |
| 2433 | - /**  | 
                                                        |
| 2434 | - * Filter to modify "Remove from Favorites" text  | 
                                                        |
| 2435 | - *  | 
                                                        |
| 2436 | - * You can use this filter to rename "Remove from Favorites" text to something else.  | 
                                                        |
| 2437 | - *  | 
                                                        |
| 2438 | - * @since 1.0.0  | 
                                                        |
| 2439 | - * @package GeoDirectory  | 
                                                        |
| 2440 | - */  | 
                                                        |
| 2441 | -        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
 | 
                                                        |
| 2442 | -  | 
                                                        |
| 2443 | - /**  | 
                                                        |
| 2444 | - * Filter to modify "fa fa-heart" icon  | 
                                                        |
| 2445 | - *  | 
                                                        |
| 2446 | - * You can use this filter to change "fa fa-heart" icon to something else.  | 
                                                        |
| 2447 | - *  | 
                                                        |
| 2448 | - * @since 1.0.0  | 
                                                        |
| 2449 | - * @package GeoDirectory  | 
                                                        |
| 2450 | - */  | 
                                                        |
| 2451 | -        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
 | 
                                                        |
| 2452 | -  | 
                                                        |
| 2453 | - /**  | 
                                                        |
| 2454 | - * Filter to modify "fa fa-heart" icon for "remove from favorites" link  | 
                                                        |
| 2455 | - *  | 
                                                        |
| 2456 | - * You can use this filter to change "fa fa-heart" icon to something else.  | 
                                                        |
| 2457 | - *  | 
                                                        |
| 2458 | - * @since 1.0.0  | 
                                                        |
| 2459 | - * @package GeoDirectory  | 
                                                        |
| 2460 | - */  | 
                                                        |
| 2461 | -        $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
 | 
                                                        |
| 2462 | -  | 
                                                        |
| 2463 | - $user_meta_data = '';  | 
                                                        |
| 2464 | - if (isset($current_user->data->ID))  | 
                                                        |
| 2465 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        |
| 2466 | -  | 
                                                        |
| 2467 | -        if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
 | 
                                                        |
| 2468 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a  | 
                                                        |
| 2388 | + /**  | 
                                                        |
| 2389 | + * This function would display the html content for add to favorite or remove from favorite.  | 
                                                        |
| 2390 | + *  | 
                                                        |
| 2391 | + * @since 1.0.0  | 
                                                        |
| 2392 | + * @package GeoDirectory  | 
                                                        |
| 2393 | + * @global object $current_user Current user object.  | 
                                                        |
| 2394 | + * @global object $post The current post object.  | 
                                                        |
| 2395 | + * @param int $user_id The user ID.  | 
                                                        |
| 2396 | + * @param int $post_id The post ID.  | 
                                                        |
| 2397 | + */  | 
                                                        |
| 2398 | + function geodir_favourite_html($user_id, $post_id)  | 
                                                        |
| 2399 | +	{
 | 
                                                        |
| 2400 | +  | 
                                                        |
| 2401 | + global $current_user, $post;  | 
                                                        |
| 2402 | +  | 
                                                        |
| 2403 | + /**  | 
                                                        |
| 2404 | + * Filter to modify "Add to Favorites" text  | 
                                                        |
| 2405 | + *  | 
                                                        |
| 2406 | + * You can use this filter to rename "Add to Favorites" text to something else.  | 
                                                        |
| 2407 | + *  | 
                                                        |
| 2408 | + * @since 1.0.0  | 
                                                        |
| 2409 | + * @package GeoDirectory  | 
                                                        |
| 2410 | + */  | 
                                                        |
| 2411 | +		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
 | 
                                                        |
| 2412 | +  | 
                                                        |
| 2413 | + /**  | 
                                                        |
| 2414 | + * Filter to modify "Favourite" text  | 
                                                        |
| 2415 | + *  | 
                                                        |
| 2416 | + * You can use this filter to rename "Favourite" text to something else.  | 
                                                        |
| 2417 | + *  | 
                                                        |
| 2418 | + * @since 1.0.0  | 
                                                        |
| 2419 | + * @package GeoDirectory  | 
                                                        |
| 2420 | + */  | 
                                                        |
| 2421 | +		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
 | 
                                                        |
| 2422 | +  | 
                                                        |
| 2423 | + /**  | 
                                                        |
| 2424 | + * Filter to modify "Unfavorite" text  | 
                                                        |
| 2425 | + *  | 
                                                        |
| 2426 | + * You can use this filter to rename "Unfavorite" text to something else.  | 
                                                        |
| 2427 | + *  | 
                                                        |
| 2428 | + * @since 1.0.0  | 
                                                        |
| 2429 | + * @package GeoDirectory  | 
                                                        |
| 2430 | + */  | 
                                                        |
| 2431 | +		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
 | 
                                                        |
| 2432 | +  | 
                                                        |
| 2433 | + /**  | 
                                                        |
| 2434 | + * Filter to modify "Remove from Favorites" text  | 
                                                        |
| 2435 | + *  | 
                                                        |
| 2436 | + * You can use this filter to rename "Remove from Favorites" text to something else.  | 
                                                        |
| 2437 | + *  | 
                                                        |
| 2438 | + * @since 1.0.0  | 
                                                        |
| 2439 | + * @package GeoDirectory  | 
                                                        |
| 2440 | + */  | 
                                                        |
| 2441 | +		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
 | 
                                                        |
| 2442 | +  | 
                                                        |
| 2443 | + /**  | 
                                                        |
| 2444 | + * Filter to modify "fa fa-heart" icon  | 
                                                        |
| 2445 | + *  | 
                                                        |
| 2446 | + * You can use this filter to change "fa fa-heart" icon to something else.  | 
                                                        |
| 2447 | + *  | 
                                                        |
| 2448 | + * @since 1.0.0  | 
                                                        |
| 2449 | + * @package GeoDirectory  | 
                                                        |
| 2450 | + */  | 
                                                        |
| 2451 | +		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
 | 
                                                        |
| 2452 | +  | 
                                                        |
| 2453 | + /**  | 
                                                        |
| 2454 | + * Filter to modify "fa fa-heart" icon for "remove from favorites" link  | 
                                                        |
| 2455 | + *  | 
                                                        |
| 2456 | + * You can use this filter to change "fa fa-heart" icon to something else.  | 
                                                        |
| 2457 | + *  | 
                                                        |
| 2458 | + * @since 1.0.0  | 
                                                        |
| 2459 | + * @package GeoDirectory  | 
                                                        |
| 2460 | + */  | 
                                                        |
| 2461 | +		$unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
 | 
                                                        |
| 2462 | +  | 
                                                        |
| 2463 | + $user_meta_data = '';  | 
                                                        |
| 2464 | + if (isset($current_user->data->ID))  | 
                                                        |
| 2465 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        |
| 2466 | +  | 
                                                        |
| 2467 | +		if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
 | 
                                                        |
| 2468 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a  | 
                                                        |
| 2469 | 2469 | class="geodir-removetofav-icon" href="javascript:void(0);"  | 
                                                        
| 2470 | 2470 | onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"  | 
                                                        
| 2471 | 2471 | title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>  | 
                                                        
| 2472 | 2472 | </a> </span><?php  | 
                                                        
| 2473 | 2473 | |
| 2474 | -        } else {
 | 
                                                        |
| 2474 | +		} else {
 | 
                                                        |
| 2475 | 2475 | |
| 2476 | -            if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
 | 
                                                        |
| 2477 | - $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';  | 
                                                        |
| 2478 | - } else  | 
                                                        |
| 2479 | -                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
 | 
                                                        |
| 2476 | +			if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
 | 
                                                        |
| 2477 | + $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';  | 
                                                        |
| 2478 | + } else  | 
                                                        |
| 2479 | +				$script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
 | 
                                                        |
| 2480 | 2480 | |
| 2481 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"  | 
                                                        |
| 2481 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"  | 
                                                        |
| 2482 | 2482 | href="javascript:void(0);"  | 
                                                        
| 2483 | 2483 | onclick="<?php echo $script_text;?>"  | 
                                                        
| 2484 | 2484 | title="<?php echo $add_favourite_text;?>"><i  | 
                                                        
| 2485 | 2485 | class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>  | 
                                                        
| 2486 | 2486 | <?php }  | 
                                                        
| 2487 | - }  | 
                                                        |
| 2487 | + }  | 
                                                        |
| 2488 | 2488 | }  | 
                                                        
| 2489 | 2489 | |
| 2490 | 2490 | |
@@ -2501,54 +2501,54 @@ discard block  | 
                                                    ||
| 2501 | 2501 | function geodir_get_cat_postcount($term = array())  | 
                                                        
| 2502 | 2502 |  {
 | 
                                                        
| 2503 | 2503 | |
| 2504 | -    if (!empty($term)) {
 | 
                                                        |
| 2504 | +	if (!empty($term)) {
 | 
                                                        |
| 2505 | 2505 | |
| 2506 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 2506 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 2507 | 2507 | |
| 2508 | - $where = '';  | 
                                                        |
| 2509 | - $join = '';  | 
                                                        |
| 2510 | -        if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
 | 
                                                        |
| 2511 | - $taxonomy_obj = get_taxonomy($term->taxonomy);  | 
                                                        |
| 2508 | + $where = '';  | 
                                                        |
| 2509 | + $join = '';  | 
                                                        |
| 2510 | +		if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
 | 
                                                        |
| 2511 | + $taxonomy_obj = get_taxonomy($term->taxonomy);  | 
                                                        |
| 2512 | 2512 | |
| 2513 | - $post_type = $taxonomy_obj->object_type[0];  | 
                                                        |
| 2513 | + $post_type = $taxonomy_obj->object_type[0];  | 
                                                        |
| 2514 | 2514 | |
| 2515 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2515 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2516 | 2516 | |
| 2517 | - /**  | 
                                                        |
| 2518 | - * Filter to modify the 'join' query  | 
                                                        |
| 2519 | - *  | 
                                                        |
| 2520 | - * @since 1.0.0  | 
                                                        |
| 2521 | - * @package GeoDirectory  | 
                                                        |
| 2522 | - * @param object|array $term category / term object that need to be processed.  | 
                                                        |
| 2523 | - * @param string $join The join query.  | 
                                                        |
| 2524 | - */  | 
                                                        |
| 2525 | -            $join = apply_filters('geodir_cat_post_count_join', $join, $term);
 | 
                                                        |
| 2517 | + /**  | 
                                                        |
| 2518 | + * Filter to modify the 'join' query  | 
                                                        |
| 2519 | + *  | 
                                                        |
| 2520 | + * @since 1.0.0  | 
                                                        |
| 2521 | + * @package GeoDirectory  | 
                                                        |
| 2522 | + * @param object|array $term category / term object that need to be processed.  | 
                                                        |
| 2523 | + * @param string $join The join query.  | 
                                                        |
| 2524 | + */  | 
                                                        |
| 2525 | +			$join = apply_filters('geodir_cat_post_count_join', $join, $term);
 | 
                                                        |
| 2526 | 2526 | |
| 2527 | - /**  | 
                                                        |
| 2528 | - * Filter to modify the 'where' query  | 
                                                        |
| 2529 | - *  | 
                                                        |
| 2530 | - * @since 1.0.0  | 
                                                        |
| 2531 | - * @package GeoDirectory  | 
                                                        |
| 2532 | - * @param object|array $term category / term object that need to be processed.  | 
                                                        |
| 2533 | - * @param string $where The where query.  | 
                                                        |
| 2534 | - */  | 
                                                        |
| 2535 | -            $where = apply_filters('geodir_cat_post_count_where', $where, $term);
 | 
                                                        |
| 2527 | + /**  | 
                                                        |
| 2528 | + * Filter to modify the 'where' query  | 
                                                        |
| 2529 | + *  | 
                                                        |
| 2530 | + * @since 1.0.0  | 
                                                        |
| 2531 | + * @package GeoDirectory  | 
                                                        |
| 2532 | + * @param object|array $term category / term object that need to be processed.  | 
                                                        |
| 2533 | + * @param string $where The where query.  | 
                                                        |
| 2534 | + */  | 
                                                        |
| 2535 | +			$where = apply_filters('geodir_cat_post_count_where', $where, $term);
 | 
                                                        |
| 2536 | 2536 | |
| 2537 | - $count_query = "SELECT count(post_id) FROM  | 
                                                        |
| 2537 | + $count_query = "SELECT count(post_id) FROM  | 
                                                        |
| 2538 | 2538 | " . $table . " as pd " . $join . "  | 
                                                        
| 2539 | 2539 |  							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
 | 
                                                        
| 2540 | 2540 | |
| 2541 | - $cat_post_count = $wpdb->get_var($count_query);  | 
                                                        |
| 2542 | - if (empty($cat_post_count) || is_wp_error($cat_post_count))  | 
                                                        |
| 2543 | - $cat_post_count = 0;  | 
                                                        |
| 2541 | + $cat_post_count = $wpdb->get_var($count_query);  | 
                                                        |
| 2542 | + if (empty($cat_post_count) || is_wp_error($cat_post_count))  | 
                                                        |
| 2543 | + $cat_post_count = 0;  | 
                                                        |
| 2544 | 2544 | |
| 2545 | - return $cat_post_count;  | 
                                                        |
| 2545 | + return $cat_post_count;  | 
                                                        |
| 2546 | 2546 | |
| 2547 | - } else  | 
                                                        |
| 2547 | + } else  | 
                                                        |
| 2548 | 2548 | |
| 2549 | - return $term->count;  | 
                                                        |
| 2550 | - }  | 
                                                        |
| 2551 | - return false;  | 
                                                        |
| 2549 | + return $term->count;  | 
                                                        |
| 2550 | + }  | 
                                                        |
| 2551 | + return false;  | 
                                                        |
| 2552 | 2552 | |
| 2553 | 2553 | }  | 
                                                        
| 2554 | 2554 | |
@@ -2561,17 +2561,17 @@ discard block  | 
                                                    ||
| 2561 | 2561 | */  | 
                                                        
| 2562 | 2562 | function geodir_allow_post_type_frontend()  | 
                                                        
| 2563 | 2563 |  {
 | 
                                                        
| 2564 | -    $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
 | 
                                                        |
| 2564 | +	$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
 | 
                                                        |
| 2565 | 2565 | |
| 2566 | - if (!is_admin() && isset($_REQUEST['listing_type'])  | 
                                                        |
| 2567 | - && !empty($geodir_allow_posttype_frontend)  | 
                                                        |
| 2568 | - && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)  | 
                                                        |
| 2569 | -    ) {
 | 
                                                        |
| 2566 | + if (!is_admin() && isset($_REQUEST['listing_type'])  | 
                                                        |
| 2567 | + && !empty($geodir_allow_posttype_frontend)  | 
                                                        |
| 2568 | + && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)  | 
                                                        |
| 2569 | +	) {
 | 
                                                        |
| 2570 | 2570 | |
| 2571 | - wp_redirect(home_url());  | 
                                                        |
| 2572 | - exit;  | 
                                                        |
| 2571 | + wp_redirect(home_url());  | 
                                                        |
| 2572 | + exit;  | 
                                                        |
| 2573 | 2573 | |
| 2574 | - }  | 
                                                        |
| 2574 | + }  | 
                                                        |
| 2575 | 2575 | |
| 2576 | 2576 | }  | 
                                                        
| 2577 | 2577 | |
@@ -2588,20 +2588,20 @@ discard block  | 
                                                    ||
| 2588 | 2588 | */  | 
                                                        
| 2589 | 2589 | function geodir_excerpt_length($length)  | 
                                                        
| 2590 | 2590 |  {
 | 
                                                        
| 2591 | - global $wp_query, $geodir_is_widget_listing;  | 
                                                        |
| 2591 | + global $wp_query, $geodir_is_widget_listing;  | 
                                                        |
| 2592 | 2592 |  	if ($geodir_is_widget_listing) {
 | 
                                                        
| 2593 | 2593 | return $length;  | 
                                                        
| 2594 | 2594 | }  | 
                                                        
| 2595 | 2595 | |
| 2596 | -    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
 | 
                                                        |
| 2597 | -        $length = get_option('geodir_desc_word_limit');
 | 
                                                        |
| 2598 | -    elseif (get_query_var('excerpt_length'))
 | 
                                                        |
| 2599 | -        $length = get_query_var('excerpt_length');
 | 
                                                        |
| 2596 | +	if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
 | 
                                                        |
| 2597 | +		$length = get_option('geodir_desc_word_limit');
 | 
                                                        |
| 2598 | +	elseif (get_query_var('excerpt_length'))
 | 
                                                        |
| 2599 | +		$length = get_query_var('excerpt_length');
 | 
                                                        |
| 2600 | 2600 | |
| 2601 | -    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
 | 
                                                        |
| 2602 | -        $length = get_option('geodir_author_desc_word_limit');
 | 
                                                        |
| 2601 | +	if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
 | 
                                                        |
| 2602 | +		$length = get_option('geodir_author_desc_word_limit');
 | 
                                                        |
| 2603 | 2603 | |
| 2604 | - return $length;  | 
                                                        |
| 2604 | + return $length;  | 
                                                        |
| 2605 | 2605 | }  | 
                                                        
| 2606 | 2606 | |
| 2607 | 2607 | /**  | 
                                                        
@@ -2616,13 +2616,13 @@ discard block  | 
                                                    ||
| 2616 | 2616 | */  | 
                                                        
| 2617 | 2617 | function geodir_excerpt_more($more)  | 
                                                        
| 2618 | 2618 |  {
 | 
                                                        
| 2619 | - global $post;  | 
                                                        |
| 2620 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2621 | -    if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
 | 
                                                        |
| 2622 | - return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';  | 
                                                        |
| 2623 | - }  | 
                                                        |
| 2619 | + global $post;  | 
                                                        |
| 2620 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2621 | +	if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
 | 
                                                        |
| 2622 | + return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';  | 
                                                        |
| 2623 | + }  | 
                                                        |
| 2624 | 2624 | |
| 2625 | - return $more;  | 
                                                        |
| 2625 | + return $more;  | 
                                                        |
| 2626 | 2626 | }  | 
                                                        
| 2627 | 2627 | |
| 2628 | 2628 | |
@@ -2639,63 +2639,63 @@ discard block  | 
                                                    ||
| 2639 | 2639 | */  | 
                                                        
| 2640 | 2640 | function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy)  | 
                                                        
| 2641 | 2641 |  {
 | 
                                                        
| 2642 | - global $plugin_prefix, $wpdb;  | 
                                                        |
| 2642 | + global $plugin_prefix, $wpdb;  | 
                                                        |
| 2643 | 2643 | |
| 2644 | - $gd_taxonomies = geodir_get_taxonomies();  | 
                                                        |
| 2644 | + $gd_taxonomies = geodir_get_taxonomies();  | 
                                                        |
| 2645 | 2645 | |
| 2646 | -    if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
 | 
                                                        |
| 2646 | +	if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
 | 
                                                        |
| 2647 | 2647 | |
| 2648 | - $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);  | 
                                                        |
| 2649 | - $table = $plugin_prefix . $geodir_post_type . '_detail';  | 
                                                        |
| 2648 | + $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);  | 
                                                        |
| 2649 | + $table = $plugin_prefix . $geodir_post_type . '_detail';  | 
                                                        |
| 2650 | 2650 | |
| 2651 | - $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);  | 
                                                        |
| 2652 | - $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';  | 
                                                        |
| 2651 | + $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);  | 
                                                        |
| 2652 | + $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';  | 
                                                        |
| 2653 | 2653 | |
| 2654 | - $posts = $wpdb->get_results(  | 
                                                        |
| 2655 | - $wpdb->prepare(  | 
                                                        |
| 2656 | - "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",  | 
                                                        |
| 2657 | - array($term_id, $taxonomy)  | 
                                                        |
| 2658 | - )  | 
                                                        |
| 2659 | - );  | 
                                                        |
| 2654 | + $posts = $wpdb->get_results(  | 
                                                        |
| 2655 | + $wpdb->prepare(  | 
                                                        |
| 2656 | + "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",  | 
                                                        |
| 2657 | + array($term_id, $taxonomy)  | 
                                                        |
| 2658 | + )  | 
                                                        |
| 2659 | + );  | 
                                                        |
| 2660 | 2660 | |
| 2661 | - if (!empty($posts)):  | 
                                                        |
| 2662 | -            foreach ($posts as $post_obj) {
 | 
                                                        |
| 2661 | + if (!empty($posts)):  | 
                                                        |
| 2662 | +			foreach ($posts as $post_obj) {
 | 
                                                        |
| 2663 | 2663 | |
| 2664 | - $lat = $post_obj->post_latitude;  | 
                                                        |
| 2665 | - $lng = $post_obj->post_longitude;  | 
                                                        |
| 2664 | + $lat = $post_obj->post_latitude;  | 
                                                        |
| 2665 | + $lng = $post_obj->post_longitude;  | 
                                                        |
| 2666 | 2666 | |
| 2667 | -                $json = '{';
 | 
                                                        |
| 2668 | - $json .= '"id":"' . $post_obj->post_id . '",';  | 
                                                        |
| 2669 | - $json .= '"lat_pos": "' . $lat . '",';  | 
                                                        |
| 2670 | - $json .= '"long_pos": "' . $lng . '",';  | 
                                                        |
| 2671 | - $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';  | 
                                                        |
| 2672 | - $json .= '"icon":"' . $term_icon . '",';  | 
                                                        |
| 2673 | - $json .= '"group":"catgroup' . $term_id . '"';  | 
                                                        |
| 2674 | - $json .= '}';  | 
                                                        |
| 2667 | +				$json = '{';
 | 
                                                        |
| 2668 | + $json .= '"id":"' . $post_obj->post_id . '",';  | 
                                                        |
| 2669 | + $json .= '"lat_pos": "' . $lat . '",';  | 
                                                        |
| 2670 | + $json .= '"long_pos": "' . $lng . '",';  | 
                                                        |
| 2671 | + $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';  | 
                                                        |
| 2672 | + $json .= '"icon":"' . $term_icon . '",';  | 
                                                        |
| 2673 | + $json .= '"group":"catgroup' . $term_id . '"';  | 
                                                        |
| 2674 | + $json .= '}';  | 
                                                        |
| 2675 | 2675 | |
| 2676 | -                if ($post_obj->default_category == $term_id) {
 | 
                                                        |
| 2676 | +				if ($post_obj->default_category == $term_id) {
 | 
                                                        |
| 2677 | 2677 | |
| 2678 | - $wpdb->query(  | 
                                                        |
| 2679 | - $wpdb->prepare(  | 
                                                        |
| 2680 | - "UPDATE " . $table . " SET marker_json = %s where post_id = %d",  | 
                                                        |
| 2681 | - array($json, $post_obj->post_id)  | 
                                                        |
| 2682 | - )  | 
                                                        |
| 2683 | - );  | 
                                                        |
| 2684 | - }  | 
                                                        |
| 2678 | + $wpdb->query(  | 
                                                        |
| 2679 | + $wpdb->prepare(  | 
                                                        |
| 2680 | + "UPDATE " . $table . " SET marker_json = %s where post_id = %d",  | 
                                                        |
| 2681 | + array($json, $post_obj->post_id)  | 
                                                        |
| 2682 | + )  | 
                                                        |
| 2683 | + );  | 
                                                        |
| 2684 | + }  | 
                                                        |
| 2685 | 2685 | |
| 2686 | - $wpdb->query(  | 
                                                        |
| 2687 | - $wpdb->prepare(  | 
                                                        |
| 2688 | - "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",  | 
                                                        |
| 2689 | - array($json, $post_obj->post_id, $term_id)  | 
                                                        |
| 2690 | - )  | 
                                                        |
| 2691 | - );  | 
                                                        |
| 2686 | + $wpdb->query(  | 
                                                        |
| 2687 | + $wpdb->prepare(  | 
                                                        |
| 2688 | + "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",  | 
                                                        |
| 2689 | + array($json, $post_obj->post_id, $term_id)  | 
                                                        |
| 2690 | + )  | 
                                                        |
| 2691 | + );  | 
                                                        |
| 2692 | 2692 | |
| 2693 | - }  | 
                                                        |
| 2693 | + }  | 
                                                        |
| 2694 | 2694 | |
| 2695 | 2695 | |
| 2696 | - endif;  | 
                                                        |
| 2696 | + endif;  | 
                                                        |
| 2697 | 2697 | |
| 2698 | - }  | 
                                                        |
| 2698 | + }  | 
                                                        |
| 2699 | 2699 | |
| 2700 | 2700 | }  | 
                                                        
| 2701 | 2701 | |
@@ -2709,14 +2709,14 @@ discard block  | 
                                                    ||
| 2709 | 2709 | */  | 
                                                        
| 2710 | 2710 | function geodir_get_listing_author($listing_id = '')  | 
                                                        
| 2711 | 2711 |  {
 | 
                                                        
| 2712 | -    if ($listing_id == '') {
 | 
                                                        |
| 2713 | -        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        |
| 2714 | - $listing_id = $_REQUEST['pid'];  | 
                                                        |
| 2715 | - }  | 
                                                        |
| 2716 | - }  | 
                                                        |
| 2717 | - $listing = get_post(strip_tags($listing_id));  | 
                                                        |
| 2718 | - $listing_author_id = $listing->post_author;  | 
                                                        |
| 2719 | - return $listing_author_id;  | 
                                                        |
| 2712 | +	if ($listing_id == '') {
 | 
                                                        |
| 2713 | +		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        |
| 2714 | + $listing_id = $_REQUEST['pid'];  | 
                                                        |
| 2715 | + }  | 
                                                        |
| 2716 | + }  | 
                                                        |
| 2717 | + $listing = get_post(strip_tags($listing_id));  | 
                                                        |
| 2718 | + $listing_author_id = $listing->post_author;  | 
                                                        |
| 2719 | + return $listing_author_id;  | 
                                                        |
| 2720 | 2720 | }  | 
                                                        
| 2721 | 2721 | |
| 2722 | 2722 | |
@@ -2731,11 +2731,11 @@ discard block  | 
                                                    ||
| 2731 | 2731 | */  | 
                                                        
| 2732 | 2732 | function geodir_lisiting_belong_to_user($listing_id, $user_id)  | 
                                                        
| 2733 | 2733 |  {
 | 
                                                        
| 2734 | - $listing_author_id = geodir_get_listing_author($listing_id);  | 
                                                        |
| 2735 | - if ($listing_author_id == $user_id)  | 
                                                        |
| 2736 | - return true;  | 
                                                        |
| 2737 | - else  | 
                                                        |
| 2738 | - return false;  | 
                                                        |
| 2734 | + $listing_author_id = geodir_get_listing_author($listing_id);  | 
                                                        |
| 2735 | + if ($listing_author_id == $user_id)  | 
                                                        |
| 2736 | + return true;  | 
                                                        |
| 2737 | + else  | 
                                                        |
| 2738 | + return false;  | 
                                                        |
| 2739 | 2739 | |
| 2740 | 2740 | }  | 
                                                        
| 2741 | 2741 | |
@@ -2751,17 +2751,17 @@ discard block  | 
                                                    ||
| 2751 | 2751 | */  | 
                                                        
| 2752 | 2752 | function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true)  | 
                                                        
| 2753 | 2753 |  {
 | 
                                                        
| 2754 | - global $current_user;  | 
                                                        |
| 2755 | -    if ($exclude_admin) {
 | 
                                                        |
| 2756 | -        foreach ($current_user->caps as $key => $caps) {
 | 
                                                        |
| 2757 | -            if (geodir_strtolower($key) == 'administrator') {
 | 
                                                        |
| 2758 | - return true;  | 
                                                        |
| 2759 | - break;  | 
                                                        |
| 2760 | - }  | 
                                                        |
| 2761 | - }  | 
                                                        |
| 2762 | - }  | 
                                                        |
| 2763 | -  | 
                                                        |
| 2764 | - return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);  | 
                                                        |
| 2754 | + global $current_user;  | 
                                                        |
| 2755 | +	if ($exclude_admin) {
 | 
                                                        |
| 2756 | +		foreach ($current_user->caps as $key => $caps) {
 | 
                                                        |
| 2757 | +			if (geodir_strtolower($key) == 'administrator') {
 | 
                                                        |
| 2758 | + return true;  | 
                                                        |
| 2759 | + break;  | 
                                                        |
| 2760 | + }  | 
                                                        |
| 2761 | + }  | 
                                                        |
| 2762 | + }  | 
                                                        |
| 2763 | +  | 
                                                        |
| 2764 | + return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);  | 
                                                        |
| 2765 | 2765 | }  | 
                                                        
| 2766 | 2766 | |
| 2767 | 2767 | |
@@ -2777,17 +2777,17 @@ discard block  | 
                                                    ||
| 2777 | 2777 | function geodir_only_supportable_attachments_remove($file)  | 
                                                        
| 2778 | 2778 |  {
 | 
                                                        
| 2779 | 2779 | |
| 2780 | - global $wpdb;  | 
                                                        |
| 2780 | + global $wpdb;  | 
                                                        |
| 2781 | 2781 | |
| 2782 | - $matches = array();  | 
                                                        |
| 2782 | + $matches = array();  | 
                                                        |
| 2783 | 2783 | |
| 2784 | - $pattern = '/-\d+x\d+\./';  | 
                                                        |
| 2785 | - preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);  | 
                                                        |
| 2784 | + $pattern = '/-\d+x\d+\./';  | 
                                                        |
| 2785 | + preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);  | 
                                                        |
| 2786 | 2786 | |
| 2787 | - if (empty($matches))  | 
                                                        |
| 2788 | - return '';  | 
                                                        |
| 2789 | - else  | 
                                                        |
| 2790 | - return $file;  | 
                                                        |
| 2787 | + if (empty($matches))  | 
                                                        |
| 2788 | + return '';  | 
                                                        |
| 2789 | + else  | 
                                                        |
| 2790 | + return $file;  | 
                                                        |
| 2791 | 2791 | |
| 2792 | 2792 | }  | 
                                                        
| 2793 | 2793 | |
@@ -2804,78 +2804,78 @@ discard block  | 
                                                    ||
| 2804 | 2804 | function geodir_set_wp_featured_image($post_id)  | 
                                                        
| 2805 | 2805 |  {
 | 
                                                        
| 2806 | 2806 | |
| 2807 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 2808 | - $uploads = wp_upload_dir();  | 
                                                        |
| 2807 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 2808 | + $uploads = wp_upload_dir();  | 
                                                        |
| 2809 | 2809 | // print_r($uploads ) ;  | 
                                                        
| 2810 | - $post_first_image = $wpdb->get_results(  | 
                                                        |
| 2811 | - $wpdb->prepare(  | 
                                                        |
| 2812 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id)  | 
                                                        |
| 2813 | - )  | 
                                                        |
| 2814 | - );  | 
                                                        |
| 2810 | + $post_first_image = $wpdb->get_results(  | 
                                                        |
| 2811 | + $wpdb->prepare(  | 
                                                        |
| 2812 | + "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id)  | 
                                                        |
| 2813 | + )  | 
                                                        |
| 2814 | + );  | 
                                                        |
| 2815 | 2815 | |
| 2816 | - $old_attachment_name = '';  | 
                                                        |
| 2817 | - $post_thumbnail_id = '';  | 
                                                        |
| 2818 | -    if (has_post_thumbnail($post_id)) {
 | 
                                                        |
| 2816 | + $old_attachment_name = '';  | 
                                                        |
| 2817 | + $post_thumbnail_id = '';  | 
                                                        |
| 2818 | +	if (has_post_thumbnail($post_id)) {
 | 
                                                        |
| 2819 | 2819 | |
| 2820 | -        if (has_post_thumbnail($post_id)) {
 | 
                                                        |
| 2820 | +		if (has_post_thumbnail($post_id)) {
 | 
                                                        |
| 2821 | 2821 | |
| 2822 | - $post_thumbnail_id = get_post_thumbnail_id($post_id);  | 
                                                        |
| 2822 | + $post_thumbnail_id = get_post_thumbnail_id($post_id);  | 
                                                        |
| 2823 | 2823 | |
| 2824 | - $old_attachment_name = basename(get_attached_file($post_thumbnail_id));  | 
                                                        |
| 2824 | + $old_attachment_name = basename(get_attached_file($post_thumbnail_id));  | 
                                                        |
| 2825 | 2825 | |
| 2826 | - }  | 
                                                        |
| 2827 | - }  | 
                                                        |
| 2828 | -  | 
                                                        |
| 2829 | -    if (!empty($post_first_image)) {
 | 
                                                        |
| 2826 | + }  | 
                                                        |
| 2827 | + }  | 
                                                        |
| 2830 | 2828 | |
| 2831 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 2829 | +	if (!empty($post_first_image)) {
 | 
                                                        |
| 2832 | 2830 | |
| 2833 | - $table_name = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2831 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 2834 | 2832 | |
| 2835 | -        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2833 | + $table_name = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2836 | 2834 | |
| 2837 | - $new_attachment_name = basename($post_first_image[0]->file);  | 
                                                        |
| 2835 | +		$wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2838 | 2836 | |
| 2839 | -        if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
 | 
                                                        |
| 2837 | + $new_attachment_name = basename($post_first_image[0]->file);  | 
                                                        |
| 2840 | 2838 | |
| 2841 | -            if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
 | 
                                                        |
| 2839 | +		if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
 | 
                                                        |
| 2842 | 2840 | |
| 2843 | -                add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
 | 
                                                        |
| 2841 | +			if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
 | 
                                                        |
| 2844 | 2842 | |
| 2845 | - wp_delete_attachment($post_thumbnail_id);  | 
                                                        |
| 2843 | +				add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
 | 
                                                        |
| 2846 | 2844 | |
| 2847 | - }  | 
                                                        |
| 2848 | - $filename = $uploads['basedir'] . $post_first_image[0]->file;  | 
                                                        |
| 2845 | + wp_delete_attachment($post_thumbnail_id);  | 
                                                        |
| 2849 | 2846 | |
| 2850 | - $attachment = array(  | 
                                                        |
| 2851 | - 'post_mime_type' => $post_first_image[0]->mime_type,  | 
                                                        |
| 2852 | - 'guid' => $uploads['baseurl'] . $post_first_image[0]->file,  | 
                                                        |
| 2853 | - 'post_parent' => $post_id,  | 
                                                        |
| 2854 | -                'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
 | 
                                                        |
| 2855 | - 'post_content' => ''  | 
                                                        |
| 2856 | - );  | 
                                                        |
| 2847 | + }  | 
                                                        |
| 2848 | + $filename = $uploads['basedir'] . $post_first_image[0]->file;  | 
                                                        |
| 2849 | +  | 
                                                        |
| 2850 | + $attachment = array(  | 
                                                        |
| 2851 | + 'post_mime_type' => $post_first_image[0]->mime_type,  | 
                                                        |
| 2852 | + 'guid' => $uploads['baseurl'] . $post_first_image[0]->file,  | 
                                                        |
| 2853 | + 'post_parent' => $post_id,  | 
                                                        |
| 2854 | +				'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
 | 
                                                        |
| 2855 | + 'post_content' => ''  | 
                                                        |
| 2856 | + );  | 
                                                        |
| 2857 | 2857 | |
| 2858 | 2858 | |
| 2859 | - $id = wp_insert_attachment($attachment, $filename, $post_id);  | 
                                                        |
| 2859 | + $id = wp_insert_attachment($attachment, $filename, $post_id);  | 
                                                        |
| 2860 | 2860 | |
| 2861 | -            if (!is_wp_error($id)) {
 | 
                                                        |
| 2861 | +			if (!is_wp_error($id)) {
 | 
                                                        |
| 2862 | 2862 | |
| 2863 | - set_post_thumbnail($post_id, $id);  | 
                                                        |
| 2863 | + set_post_thumbnail($post_id, $id);  | 
                                                        |
| 2864 | 2864 | |
| 2865 | - require_once(ABSPATH . 'wp-admin/includes/image.php');  | 
                                                        |
| 2866 | - wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));  | 
                                                        |
| 2865 | + require_once(ABSPATH . 'wp-admin/includes/image.php');  | 
                                                        |
| 2866 | + wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));  | 
                                                        |
| 2867 | 2867 | |
| 2868 | - }  | 
                                                        |
| 2868 | + }  | 
                                                        |
| 2869 | 2869 | |
| 2870 | - }  | 
                                                        |
| 2870 | + }  | 
                                                        |
| 2871 | 2871 | |
| 2872 | -    } else {
 | 
                                                        |
| 2873 | - //set_post_thumbnail($post_id,-1);  | 
                                                        |
| 2872 | +	} else {
 | 
                                                        |
| 2873 | + //set_post_thumbnail($post_id,-1);  | 
                                                        |
| 2874 | 2874 | |
| 2875 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))  | 
                                                        |
| 2876 | - wp_delete_attachment($post_thumbnail_id);  | 
                                                        |
| 2875 | + if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))  | 
                                                        |
| 2876 | + wp_delete_attachment($post_thumbnail_id);  | 
                                                        |
| 2877 | 2877 | |
| 2878 | - }  | 
                                                        |
| 2878 | + }  | 
                                                        |
| 2879 | 2879 | }  | 
                                                        
| 2880 | 2880 | |
| 2881 | 2881 | |
@@ -2890,53 +2890,53 @@ discard block  | 
                                                    ||
| 2890 | 2890 | */  | 
                                                        
| 2891 | 2891 | function gd_copy_original_translation()  | 
                                                        
| 2892 | 2892 |  {
 | 
                                                        
| 2893 | -    if (function_exists('icl_object_id')) {
 | 
                                                        |
| 2894 | - global $wpdb, $table_prefix, $plugin_prefix;  | 
                                                        |
| 2895 | - $post_id = absint($_POST['post_id']);  | 
                                                        |
| 2896 | - $upload_dir = wp_upload_dir();  | 
                                                        |
| 2897 | - $post_type = get_post_type($_POST['post_id']);  | 
                                                        |
| 2898 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2899 | -  | 
                                                        |
| 2900 | - $post_arr = $wpdb->get_results($wpdb->prepare(  | 
                                                        |
| 2901 | - "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",  | 
                                                        |
| 2902 | - array($post_id)  | 
                                                        |
| 2903 | - )  | 
                                                        |
| 2904 | - , ARRAY_A);  | 
                                                        |
| 2905 | -  | 
                                                        |
| 2906 | - $arrImages = $wpdb->get_results(  | 
                                                        |
| 2907 | - $wpdb->prepare(  | 
                                                        |
| 2908 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",  | 
                                                        |
| 2909 | -                array('%image%', $post_id)
 | 
                                                        |
| 2910 | - )  | 
                                                        |
| 2911 | - );  | 
                                                        |
| 2912 | -        if ($arrImages) {
 | 
                                                        |
| 2913 | - $image_arr = array();  | 
                                                        |
| 2914 | -            foreach ($arrImages as $img) {
 | 
                                                        |
| 2915 | - $image_arr[] = $upload_dir['baseurl'] . $img->file;  | 
                                                        |
| 2916 | - }  | 
                                                        |
| 2917 | -            $comma_separated = implode(",", $image_arr);
 | 
                                                        |
| 2918 | - $post_arr[0]['post_images'] = $comma_separated;  | 
                                                        |
| 2919 | - }  | 
                                                        |
| 2920 | -  | 
                                                        |
| 2921 | -  | 
                                                        |
| 2922 | - $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];  | 
                                                        |
| 2923 | -        $cat_arr = array_filter(explode(",", $cats));
 | 
                                                        |
| 2924 | - $trans_cat = array();  | 
                                                        |
| 2925 | -        foreach ($cat_arr as $cat) {
 | 
                                                        |
| 2926 | - $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);  | 
                                                        |
| 2927 | - }  | 
                                                        |
| 2928 | -  | 
                                                        |
| 2929 | -  | 
                                                        |
| 2930 | - $post_arr[0]['categories'] = array_filter($trans_cat);  | 
                                                        |
| 2893 | +	if (function_exists('icl_object_id')) {
 | 
                                                        |
| 2894 | + global $wpdb, $table_prefix, $plugin_prefix;  | 
                                                        |
| 2895 | + $post_id = absint($_POST['post_id']);  | 
                                                        |
| 2896 | + $upload_dir = wp_upload_dir();  | 
                                                        |
| 2897 | + $post_type = get_post_type($_POST['post_id']);  | 
                                                        |
| 2898 | + $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2899 | +  | 
                                                        |
| 2900 | + $post_arr = $wpdb->get_results($wpdb->prepare(  | 
                                                        |
| 2901 | + "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",  | 
                                                        |
| 2902 | + array($post_id)  | 
                                                        |
| 2903 | + )  | 
                                                        |
| 2904 | + , ARRAY_A);  | 
                                                        |
| 2905 | +  | 
                                                        |
| 2906 | + $arrImages = $wpdb->get_results(  | 
                                                        |
| 2907 | + $wpdb->prepare(  | 
                                                        |
| 2908 | + "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",  | 
                                                        |
| 2909 | +				array('%image%', $post_id)
 | 
                                                        |
| 2910 | + )  | 
                                                        |
| 2911 | + );  | 
                                                        |
| 2912 | +		if ($arrImages) {
 | 
                                                        |
| 2913 | + $image_arr = array();  | 
                                                        |
| 2914 | +			foreach ($arrImages as $img) {
 | 
                                                        |
| 2915 | + $image_arr[] = $upload_dir['baseurl'] . $img->file;  | 
                                                        |
| 2916 | + }  | 
                                                        |
| 2917 | +			$comma_separated = implode(",", $image_arr);
 | 
                                                        |
| 2918 | + $post_arr[0]['post_images'] = $comma_separated;  | 
                                                        |
| 2919 | + }  | 
                                                        |
| 2920 | +  | 
                                                        |
| 2921 | +  | 
                                                        |
| 2922 | + $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];  | 
                                                        |
| 2923 | +		$cat_arr = array_filter(explode(",", $cats));
 | 
                                                        |
| 2924 | + $trans_cat = array();  | 
                                                        |
| 2925 | +		foreach ($cat_arr as $cat) {
 | 
                                                        |
| 2926 | + $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);  | 
                                                        |
| 2927 | + }  | 
                                                        |
| 2928 | +  | 
                                                        |
| 2929 | +  | 
                                                        |
| 2930 | + $post_arr[0]['categories'] = array_filter($trans_cat);  | 
                                                        |
| 2931 | 2931 | //print_r($image_arr);  | 
                                                        
| 2932 | - //print_r($arrImages);  | 
                                                        |
| 2933 | - //echo $_REQUEST['lang'];  | 
                                                        |
| 2932 | + //print_r($arrImages);  | 
                                                        |
| 2933 | + //echo $_REQUEST['lang'];  | 
                                                        |
| 2934 | 2934 | //print_r($post_arr);  | 
                                                        
| 2935 | 2935 | //print_r($trans_cat);  | 
                                                        
| 2936 | - echo json_encode($post_arr[0]);  | 
                                                        |
| 2936 | + echo json_encode($post_arr[0]);  | 
                                                        |
| 2937 | 2937 | |
| 2938 | - }  | 
                                                        |
| 2939 | - die();  | 
                                                        |
| 2938 | + }  | 
                                                        |
| 2939 | + die();  | 
                                                        |
| 2940 | 2940 | }  | 
                                                        
| 2941 | 2941 | |
| 2942 | 2942 | |
@@ -2956,54 +2956,54 @@ discard block  | 
                                                    ||
| 2956 | 2956 | function geodir_get_custom_fields_type($listing_type = '')  | 
                                                        
| 2957 | 2957 |  {
 | 
                                                        
| 2958 | 2958 | |
| 2959 | - global $wpdb;  | 
                                                        |
| 2959 | + global $wpdb;  | 
                                                        |
| 2960 | 2960 | |
| 2961 | - if ($listing_type == '')  | 
                                                        |
| 2962 | - $listing_type = 'gd_place';  | 
                                                        |
| 2961 | + if ($listing_type == '')  | 
                                                        |
| 2962 | + $listing_type = 'gd_place';  | 
                                                        |
| 2963 | 2963 | |
| 2964 | - $fields_info = array();  | 
                                                        |
| 2964 | + $fields_info = array();  | 
                                                        |
| 2965 | 2965 | |
| 2966 | - $get_data = $wpdb->get_results(  | 
                                                        |
| 2967 | - $wpdb->prepare(  | 
                                                        |
| 2968 | - "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",  | 
                                                        |
| 2969 | - array($listing_type)  | 
                                                        |
| 2970 | - )  | 
                                                        |
| 2971 | - );  | 
                                                        |
| 2966 | + $get_data = $wpdb->get_results(  | 
                                                        |
| 2967 | + $wpdb->prepare(  | 
                                                        |
| 2968 | + "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",  | 
                                                        |
| 2969 | + array($listing_type)  | 
                                                        |
| 2970 | + )  | 
                                                        |
| 2971 | + );  | 
                                                        |
| 2972 | 2972 | |
| 2973 | -    if (!empty($get_data)) {
 | 
                                                        |
| 2973 | +	if (!empty($get_data)) {
 | 
                                                        |
| 2974 | 2974 | |
| 2975 | -        foreach ($get_data as $data) {
 | 
                                                        |
| 2975 | +		foreach ($get_data as $data) {
 | 
                                                        |
| 2976 | 2976 | |
| 2977 | -            if ($data->field_type == 'address') {
 | 
                                                        |
| 2977 | +			if ($data->field_type == 'address') {
 | 
                                                        |
| 2978 | 2978 | |
| 2979 | - $extra_fields = unserialize($data->extra_fields);  | 
                                                        |
| 2979 | + $extra_fields = unserialize($data->extra_fields);  | 
                                                        |
| 2980 | 2980 | |
| 2981 | - $prefix = $data->htmlvar_name . '_';  | 
                                                        |
| 2981 | + $prefix = $data->htmlvar_name . '_';  | 
                                                        |
| 2982 | 2982 | |
| 2983 | - $fields_info[$prefix . 'address'] = $data->field_type;  | 
                                                        |
| 2983 | + $fields_info[$prefix . 'address'] = $data->field_type;  | 
                                                        |
| 2984 | 2984 | |
| 2985 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])  | 
                                                        |
| 2986 | - $fields_info[$prefix . 'zip'] = $data->field_type;  | 
                                                        |
| 2985 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])  | 
                                                        |
| 2986 | + $fields_info[$prefix . 'zip'] = $data->field_type;  | 
                                                        |
| 2987 | 2987 | |
| 2988 | -            } else {
 | 
                                                        |
| 2988 | +			} else {
 | 
                                                        |
| 2989 | 2989 | |
| 2990 | - $fields_info[$data->htmlvar_name] = $data->field_type;  | 
                                                        |
| 2990 | + $fields_info[$data->htmlvar_name] = $data->field_type;  | 
                                                        |
| 2991 | 2991 | |
| 2992 | - }  | 
                                                        |
| 2992 | + }  | 
                                                        |
| 2993 | 2993 | |
| 2994 | - }  | 
                                                        |
| 2994 | + }  | 
                                                        |
| 2995 | 2995 | |
| 2996 | - }  | 
                                                        |
| 2996 | + }  | 
                                                        |
| 2997 | 2997 | |
| 2998 | - /**  | 
                                                        |
| 2999 | - * Filter to modify custom fields info using listing post type.  | 
                                                        |
| 3000 | - *  | 
                                                        |
| 3001 | - * @since 1.0.0  | 
                                                        |
| 3002 | - * @package GeoDirectory  | 
                                                        |
| 3003 | - * @return array $fields_info Custom fields info.  | 
                                                        |
| 3004 | - * @param string $listing_type The listing post type.  | 
                                                        |
| 3005 | - */  | 
                                                        |
| 3006 | -    return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
 | 
                                                        |
| 2998 | + /**  | 
                                                        |
| 2999 | + * Filter to modify custom fields info using listing post type.  | 
                                                        |
| 3000 | + *  | 
                                                        |
| 3001 | + * @since 1.0.0  | 
                                                        |
| 3002 | + * @package GeoDirectory  | 
                                                        |
| 3003 | + * @return array $fields_info Custom fields info.  | 
                                                        |
| 3004 | + * @param string $listing_type The listing post type.  | 
                                                        |
| 3005 | + */  | 
                                                        |
| 3006 | +	return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
 | 
                                                        |
| 3007 | 3007 | }  | 
                                                        
| 3008 | 3008 | |
| 3009 | 3009 | |
@@ -3018,58 +3018,58 @@ discard block  | 
                                                    ||
| 3018 | 3018 | */  | 
                                                        
| 3019 | 3019 | function geodir_function_post_updated($post_ID, $post_after, $post_before)  | 
                                                        
| 3020 | 3020 |  {
 | 
                                                        
| 3021 | - $post_type = get_post_type($post_ID);  | 
                                                        |
| 3021 | + $post_type = get_post_type($post_ID);  | 
                                                        |
| 3022 | 3022 | |
| 3023 | -    if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
 | 
                                                        |
| 3024 | - // send notification to client when post moves from draft to publish  | 
                                                        |
| 3025 | -        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')) {
 | 
                                                        |
| 3026 | - $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;  | 
                                                        |
| 3027 | - $post_author_data = get_userdata($post_author_id);  | 
                                                        |
| 3023 | +	if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
 | 
                                                        |
| 3024 | + // send notification to client when post moves from draft to publish  | 
                                                        |
| 3025 | +		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')) {
 | 
                                                        |
| 3026 | + $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;  | 
                                                        |
| 3027 | + $post_author_data = get_userdata($post_author_id);  | 
                                                        |
| 3028 | 3028 | |
| 3029 | - $to_name = geodir_get_client_name($post_author_id);  | 
                                                        |
| 3029 | + $to_name = geodir_get_client_name($post_author_id);  | 
                                                        |
| 3030 | 3030 | |
| 3031 | - $from_email = geodir_get_site_email_id();  | 
                                                        |
| 3032 | - $from_name = get_site_emailName();  | 
                                                        |
| 3033 | - $to_email = $post_author_data->user_email;  | 
                                                        |
| 3031 | + $from_email = geodir_get_site_email_id();  | 
                                                        |
| 3032 | + $from_name = get_site_emailName();  | 
                                                        |
| 3033 | + $to_email = $post_author_data->user_email;  | 
                                                        |
| 3034 | 3034 | |
| 3035 | -            if (!is_email($to_email) && !empty($post_author_data->user_email)) {
 | 
                                                        |
| 3036 | - $to_email = $post_author_data->user_email;  | 
                                                        |
| 3037 | - }  | 
                                                        |
| 3035 | +			if (!is_email($to_email) && !empty($post_author_data->user_email)) {
 | 
                                                        |
| 3036 | + $to_email = $post_author_data->user_email;  | 
                                                        |
| 3037 | + }  | 
                                                        |
| 3038 | 3038 | |
| 3039 | - $message_type = 'listing_published';  | 
                                                        |
| 3039 | + $message_type = 'listing_published';  | 
                                                        |
| 3040 | 3040 | |
| 3041 | -            if (get_option('geodir_post_published_email_subject') == '') {
 | 
                                                        |
| 3042 | -                update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
 | 
                                                        |
| 3043 | - }  | 
                                                        |
| 3041 | +			if (get_option('geodir_post_published_email_subject') == '') {
 | 
                                                        |
| 3042 | +				update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
 | 
                                                        |
| 3043 | + }  | 
                                                        |
| 3044 | 3044 | |
| 3045 | -            if (get_option('geodir_post_published_email_content') == '') {
 | 
                                                        |
| 3046 | -                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'));
 | 
                                                        |
| 3047 | - }  | 
                                                        |
| 3045 | +			if (get_option('geodir_post_published_email_content') == '') {
 | 
                                                        |
| 3046 | +				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'));
 | 
                                                        |
| 3047 | + }  | 
                                                        |
| 3048 | 3048 | |
| 3049 | - /**  | 
                                                        |
| 3050 | - * Called before sending the email when listing gets published.  | 
                                                        |
| 3051 | - *  | 
                                                        |
| 3052 | - * @since 1.0.0  | 
                                                        |
| 3053 | - * @package GeoDirectory  | 
                                                        |
| 3054 | - * @param object $post_after The post object after update.  | 
                                                        |
| 3055 | - * @param object $post_before The post object before update.  | 
                                                        |
| 3056 | - */  | 
                                                        |
| 3057 | -            do_action('geodir_before_listing_published_email', $post_after, $post_before);
 | 
                                                        |
| 3058 | -            if (is_email($to_email)) {
 | 
                                                        |
| 3059 | - geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);  | 
                                                        |
| 3060 | - }  | 
                                                        |
| 3049 | + /**  | 
                                                        |
| 3050 | + * Called before sending the email when listing gets published.  | 
                                                        |
| 3051 | + *  | 
                                                        |
| 3052 | + * @since 1.0.0  | 
                                                        |
| 3053 | + * @package GeoDirectory  | 
                                                        |
| 3054 | + * @param object $post_after The post object after update.  | 
                                                        |
| 3055 | + * @param object $post_before The post object before update.  | 
                                                        |
| 3056 | + */  | 
                                                        |
| 3057 | +			do_action('geodir_before_listing_published_email', $post_after, $post_before);
 | 
                                                        |
| 3058 | +			if (is_email($to_email)) {
 | 
                                                        |
| 3059 | + geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);  | 
                                                        |
| 3060 | + }  | 
                                                        |
| 3061 | 3061 | |
| 3062 | - /**  | 
                                                        |
| 3063 | - * Called after sending the email when listing gets published.  | 
                                                        |
| 3064 | - *  | 
                                                        |
| 3065 | - * @since 1.0.0  | 
                                                        |
| 3066 | - * @package GeoDirectory  | 
                                                        |
| 3067 | - * @param object $post_after The post object after update.  | 
                                                        |
| 3068 | - * @param object $post_before The post object before update.  | 
                                                        |
| 3069 | - */  | 
                                                        |
| 3070 | -            do_action('geodir_after_listing_published_email', $post_after, $post_before);
 | 
                                                        |
| 3071 | - }  | 
                                                        |
| 3072 | - }  | 
                                                        |
| 3062 | + /**  | 
                                                        |
| 3063 | + * Called after sending the email when listing gets published.  | 
                                                        |
| 3064 | + *  | 
                                                        |
| 3065 | + * @since 1.0.0  | 
                                                        |
| 3066 | + * @package GeoDirectory  | 
                                                        |
| 3067 | + * @param object $post_after The post object after update.  | 
                                                        |
| 3068 | + * @param object $post_before The post object before update.  | 
                                                        |
| 3069 | + */  | 
                                                        |
| 3070 | +			do_action('geodir_after_listing_published_email', $post_after, $post_before);
 | 
                                                        |
| 3071 | + }  | 
                                                        |
| 3072 | + }  | 
                                                        |
| 3073 | 3073 | }  | 
                                                        
| 3074 | 3074 | |
| 3075 | 3075 |  add_action('wp_head', 'geodir_fb_like_thumbnail');
 | 
                                                        
@@ -3083,14 +3083,14 @@ discard block  | 
                                                    ||
| 3083 | 3083 | */  | 
                                                        
| 3084 | 3084 |  function geodir_fb_like_thumbnail(){
 | 
                                                        
| 3085 | 3085 | |
| 3086 | - // return if not a single post  | 
                                                        |
| 3087 | -    if(!is_single()){return;}
 | 
                                                        |
| 3086 | + // return if not a single post  | 
                                                        |
| 3087 | +	if(!is_single()){return;}
 | 
                                                        |
| 3088 | 3088 | |
| 3089 | - global $post;  | 
                                                        |
| 3090 | -    if(isset($post->featured_image) && $post->featured_image){
 | 
                                                        |
| 3091 | - $upload_dir = wp_upload_dir();  | 
                                                        |
| 3092 | - $thumb = $upload_dir['baseurl'].$post->featured_image;  | 
                                                        |
| 3093 | - echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";  | 
                                                        |
| 3089 | + global $post;  | 
                                                        |
| 3090 | +	if(isset($post->featured_image) && $post->featured_image){
 | 
                                                        |
| 3091 | + $upload_dir = wp_upload_dir();  | 
                                                        |
| 3092 | + $thumb = $upload_dir['baseurl'].$post->featured_image;  | 
                                                        |
| 3093 | + echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";  | 
                                                        |
| 3094 | 3094 | |
| 3095 | - }  | 
                                                        |
| 3095 | + }  | 
                                                        |
| 3096 | 3096 | }  | 
                                                        
| 3097 | 3097 | \ 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 | |
@@ -227,7 +227,7 @@ discard block  | 
                                                    ||
| 227 | 227 | $send_post_submit_mail = false;  | 
                                                        
| 228 | 228 | |
| 229 | 229 | // unhook this function so it doesn't loop infinitely  | 
                                                        
| 230 | -        remove_action('save_post', 'geodir_post_information_save',10,2);
 | 
                                                        |
| 230 | +        remove_action('save_post', 'geodir_post_information_save', 10, 2);
 | 
                                                        |
| 231 | 231 | |
| 232 | 232 |          if (isset($request_info['pid']) && $request_info['pid'] != '') {
 | 
                                                        
| 233 | 233 | $post['ID'] = $request_info['pid'];  | 
                                                        
@@ -251,13 +251,13 @@ discard block  | 
                                                    ||
| 251 | 251 | }  | 
                                                        
| 252 | 252 | |
| 253 | 253 | // re-hook this function  | 
                                                        
| 254 | -        add_action('save_post', 'geodir_post_information_save',10,2);
 | 
                                                        |
| 254 | +        add_action('save_post', 'geodir_post_information_save', 10, 2);
 | 
                                                        |
| 255 | 255 | |
| 256 | 256 | $post_tags = '';  | 
                                                        
| 257 | 257 |          if (!isset($request_info['post_tags'])) {
 | 
                                                        
| 258 | 258 | |
| 259 | 259 | $post_type = $request_info['listing_type'];  | 
                                                        
| 260 | -            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
 | 
                                                        |
| 260 | +            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type.'_tags', array('fields' => 'names')));
 | 
                                                        |
| 261 | 261 | |
| 262 | 262 | }  | 
                                                        
| 263 | 263 | |
@@ -275,13 +275,13 @@ discard block  | 
                                                    ||
| 275 | 275 | $payment_info = array();  | 
                                                        
| 276 | 276 | $package_info = array();  | 
                                                        
| 277 | 277 | |
| 278 | - $package_info = (array)geodir_post_package_info($package_info, $post);  | 
                                                        |
| 278 | + $package_info = (array) geodir_post_package_info($package_info, $post);  | 
                                                        |
| 279 | 279 | |
| 280 | 280 | $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');  | 
                                                        
| 281 | 281 | |
| 282 | 282 |          if (!empty($package_info) && !$post_package_id) {
 | 
                                                        
| 283 | 283 |              if (isset($package_info['days']) && $package_info['days'] != 0) {
 | 
                                                        
| 284 | -                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
 | 
                                                        |
| 284 | +                $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['days']." days"));
 | 
                                                        |
| 285 | 285 |              } else {
 | 
                                                        
| 286 | 286 | $payment_info['expire_date'] = 'Never';  | 
                                                        
| 287 | 287 | }  | 
                                                        
@@ -302,8 +302,8 @@ discard block  | 
                                                    ||
| 302 | 302 | $extrafields = $val['extra_fields'];  | 
                                                        
| 303 | 303 | |
| 304 | 304 |              if (trim($type) == 'address') {
 | 
                                                        
| 305 | - $prefix = $name . '_';  | 
                                                        |
| 306 | - $address = $prefix . 'address';  | 
                                                        |
| 305 | + $prefix = $name.'_';  | 
                                                        |
| 306 | + $address = $prefix.'address';  | 
                                                        |
| 307 | 307 | |
| 308 | 308 |                  if (isset($request_info[$address]) && $request_info[$address] != '') {
 | 
                                                        
| 309 | 309 | $gd_post_info[$address] = wp_slash($request_info[$address]);  | 
                                                        
@@ -313,59 +313,59 @@ discard block  | 
                                                    ||
| 313 | 313 | $extrafields = unserialize($extrafields);  | 
                                                        
| 314 | 314 | |
| 315 | 315 | |
| 316 | -                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
 | 
                                                        |
| 316 | +                    if (!isset($request_info[$prefix.'city']) || $request_info[$prefix.'city'] == '') {
 | 
                                                        |
| 317 | 317 | |
| 318 | 318 | $location_result = geodir_get_default_location();  | 
                                                        
| 319 | 319 | |
| 320 | - $gd_post_info[$prefix . 'city'] = $location_result->city;  | 
                                                        |
| 321 | - $gd_post_info[$prefix . 'region'] = $location_result->region;  | 
                                                        |
| 322 | - $gd_post_info[$prefix . 'country'] = $location_result->country;  | 
                                                        |
| 320 | + $gd_post_info[$prefix.'city'] = $location_result->city;  | 
                                                        |
| 321 | + $gd_post_info[$prefix.'region'] = $location_result->region;  | 
                                                        |
| 322 | + $gd_post_info[$prefix.'country'] = $location_result->country;  | 
                                                        |
| 323 | 323 | |
| 324 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location  | 
                                                        |
| 324 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location  | 
                                                        |
| 325 | 325 | |
| 326 | 326 |                      } else {
 | 
                                                        
| 327 | 327 | |
| 328 | - $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];  | 
                                                        |
| 329 | - $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];  | 
                                                        |
| 330 | - $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];  | 
                                                        |
| 328 | + $gd_post_info[$prefix.'city'] = $request_info[$prefix.'city'];  | 
                                                        |
| 329 | + $gd_post_info[$prefix.'region'] = $request_info[$prefix.'region'];  | 
                                                        |
| 330 | + $gd_post_info[$prefix.'country'] = $request_info[$prefix.'country'];  | 
                                                        |
| 331 | 331 | |
| 332 | 332 | //----------set post locations when import dummy data-------  | 
                                                        
| 333 | 333 | $location_result = geodir_get_default_location();  | 
                                                        
| 334 | 334 | |
| 335 | - $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location  | 
                                                        |
| 335 | + $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location  | 
                                                        |
| 336 | 336 | //-----------------------------------------------------------------  | 
                                                        
| 337 | 337 | |
| 338 | 338 | }  | 
                                                        
| 339 | 339 | |
| 340 | 340 | |
| 341 | -                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
 | 
                                                        |
| 342 | - $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];  | 
                                                        |
| 341 | +                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix.'zip'])) {
 | 
                                                        |
| 342 | + $gd_post_info[$prefix.'zip'] = $request_info[$prefix.'zip'];  | 
                                                        |
| 343 | 343 | }  | 
                                                        
| 344 | 344 | |
| 345 | 345 | |
| 346 | 346 |                      if (isset($extrafields['show_map']) && $extrafields['show_map']) {
 | 
                                                        
| 347 | 347 | |
| 348 | -                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
 | 
                                                        |
| 349 | - $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];  | 
                                                        |
| 348 | +                        if (isset($request_info[$prefix.'latitude']) && $request_info[$prefix.'latitude'] != '') {
 | 
                                                        |
| 349 | + $gd_post_info[$prefix.'latitude'] = $request_info[$prefix.'latitude'];  | 
                                                        |
| 350 | 350 | }  | 
                                                        
| 351 | 351 | |
| 352 | -                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
 | 
                                                        |
| 353 | - $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];  | 
                                                        |
| 352 | +                        if (isset($request_info[$prefix.'longitude']) && $request_info[$prefix.'longitude'] != '') {
 | 
                                                        |
| 353 | + $gd_post_info[$prefix.'longitude'] = $request_info[$prefix.'longitude'];  | 
                                                        |
| 354 | 354 | }  | 
                                                        
| 355 | 355 | |
| 356 | -                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
 | 
                                                        |
| 357 | - $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];  | 
                                                        |
| 356 | +                        if (isset($request_info[$prefix.'mapview']) && $request_info[$prefix.'mapview'] != '') {
 | 
                                                        |
| 357 | + $gd_post_info[$prefix.'mapview'] = $request_info[$prefix.'mapview'];  | 
                                                        |
| 358 | 358 | }  | 
                                                        
| 359 | 359 | |
| 360 | -                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
 | 
                                                        |
| 361 | - $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];  | 
                                                        |
| 360 | +                        if (isset($request_info[$prefix.'mapzoom']) && $request_info[$prefix.'mapzoom'] != '') {
 | 
                                                        |
| 361 | + $gd_post_info[$prefix.'mapzoom'] = $request_info[$prefix.'mapzoom'];  | 
                                                        |
| 362 | 362 | }  | 
                                                        
| 363 | 363 | |
| 364 | 364 | }  | 
                                                        
| 365 | 365 | |
| 366 | 366 | // show lat lng  | 
                                                        
| 367 | -                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
 | 
                                                        |
| 368 | - $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];  | 
                                                        |
| 367 | +                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix.'latlng'])) {
 | 
                                                        |
| 368 | + $gd_post_info[$prefix.'latlng'] = $request_info[$prefix.'latlng'];  | 
                                                        |
| 369 | 369 | }  | 
                                                        
| 370 | 370 | }  | 
                                                        
| 371 | 371 | |
@@ -390,20 +390,20 @@ discard block  | 
                                                    ||
| 390 | 390 | |
| 391 | 391 | // check if we need to change the format or not  | 
                                                        
| 392 | 392 |                      $date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        
| 393 | -                    if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 393 | +                    if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
 | 
                                                        |
| 394 | 394 | |
| 395 | -                        $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 396 | -                        $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 395 | +                        $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
 | 
                                                        |
| 396 | +                        $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
 | 
                                                        |
| 397 | 397 | |
| 398 | 398 | $date_format = str_replace($search, $replace, $date_format);  | 
                                                        
| 399 | 399 | |
| 400 | 400 |                          $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
 | 
                                                        
| 401 | 401 | |
| 402 | -                    }else{
 | 
                                                        |
| 402 | +                    } else {
 | 
                                                        |
| 403 | 403 | $post_htmlvar_value = $request_info[$name];  | 
                                                        
| 404 | 404 | }  | 
                                                        
| 405 | 405 | |
| 406 | - $post_htmlvar_value = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated  | 
                                                        |
| 406 | + $post_htmlvar_value = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated  | 
                                                        |
| 407 | 407 | |
| 408 | 408 |                      $datetime = date("Y-m-d", strtotime($post_htmlvar_value)); // save as sql format Y-m-d
 | 
                                                        
| 409 | 409 | |
@@ -413,7 +413,7 @@ discard block  | 
                                                    ||
| 413 | 413 |                  if (isset($request_info[$name])) {
 | 
                                                        
| 414 | 414 | $gd_post_info[$name] = $request_info[$name];  | 
                                                        
| 415 | 415 |                  } else {
 | 
                                                        
| 416 | -                    if (isset($request_info['gd_field_' . $name])) {
 | 
                                                        |
| 416 | +                    if (isset($request_info['gd_field_'.$name])) {
 | 
                                                        |
| 417 | 417 | $gd_post_info[$name] = ''; /* fix de-select for multiselect */  | 
                                                        
| 418 | 418 | }  | 
                                                        
| 419 | 419 | }  | 
                                                        
@@ -473,7 +473,7 @@ discard block  | 
                                                    ||
| 473 | 473 | }  | 
                                                        
| 474 | 474 | |
| 475 | 475 |          if (is_array($post_tags)) {
 | 
                                                        
| 476 | - $taxonomy = $request_info['listing_type'] . '_tags';  | 
                                                        |
| 476 | + $taxonomy = $request_info['listing_type'].'_tags';  | 
                                                        |
| 477 | 477 | wp_set_object_terms($last_post_id, $post_tags, $taxonomy);  | 
                                                        
| 478 | 478 | }  | 
                                                        
| 479 | 479 | |
@@ -485,7 +485,7 @@ discard block  | 
                                                    ||
| 485 | 485 | $tmpimgArr = trim($request_info['post_images'], ",");  | 
                                                        
| 486 | 486 |                  $tmpimgArr = explode(",", $tmpimgArr);
 | 
                                                        
| 487 | 487 | geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);  | 
                                                        
| 488 | -            } else{
 | 
                                                        |
| 488 | +            } else {
 | 
                                                        |
| 489 | 489 | geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);  | 
                                                        
| 490 | 490 | }  | 
                                                        
| 491 | 491 | |
@@ -566,7 +566,7 @@ discard block  | 
                                                    ||
| 566 | 566 | if (!in_array($post_type, $all_postypes))  | 
                                                        
| 567 | 567 | return false;  | 
                                                        
| 568 | 568 | |
| 569 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 569 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 570 | 570 | |
| 571 | 571 | /**  | 
                                                        
| 572 | 572 | * Apply Filter to change Post info  | 
                                                        
@@ -576,7 +576,7 @@ discard block  | 
                                                    ||
| 576 | 576 | * @since 1.0.0  | 
                                                        
| 577 | 577 | * @package GeoDirectory  | 
                                                        
| 578 | 578 | */  | 
                                                        
| 579 | -    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
 | 
                                                        |
| 579 | +    $query = apply_filters('geodir_post_info_query', "SELECT p.*,pd.* FROM ".$wpdb->posts." p,".$table." pd
 | 
                                                        |
| 580 | 580 | WHERE p.ID = pd.post_id  | 
                                                        
| 581 | 581 | AND post_id = " . $post_id);  | 
                                                        
| 582 | 582 | |
@@ -639,7 +639,7 @@ discard block  | 
                                                    ||
| 639 | 639 | |
| 640 | 640 | $post_type = get_post_type($post_id);  | 
                                                        
| 641 | 641 | |
| 642 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 642 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 643 | 643 | |
| 644 | 644 | /**  | 
                                                        
| 645 | 645 | * Filter to change Post info  | 
                                                        
@@ -663,13 +663,13 @@ discard block  | 
                                                    ||
| 663 | 663 |                          $mval = implode(",", $mval);
 | 
                                                        
| 664 | 664 | }  | 
                                                        
| 665 | 665 | |
| 666 | - $post_meta_set_query .= $mkey . " = '" . $mval . "', ";  | 
                                                        |
| 666 | + $post_meta_set_query .= $mkey." = '".$mval."', ";  | 
                                                        |
| 667 | 667 | }  | 
                                                        
| 668 | 668 | }  | 
                                                        
| 669 | 669 | |
| 670 | 670 | $post_meta_set_query = trim($post_meta_set_query, ", ");  | 
                                                        
| 671 | 671 | |
| 672 | -            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
 | 
                                                        |
| 672 | +            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query); // escape %
 | 
                                                        |
| 673 | 673 | |
| 674 | 674 | /**  | 
                                                        
| 675 | 675 | * Called before saving the listing info.  | 
                                                        
@@ -681,11 +681,11 @@ discard block  | 
                                                    ||
| 681 | 681 | */  | 
                                                        
| 682 | 682 |              do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
 | 
                                                        
| 683 | 683 | |
| 684 | -            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 684 | +            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 685 | 685 | |
| 686 | 686 | $wpdb->query(  | 
                                                        
| 687 | 687 | $wpdb->prepare(  | 
                                                        
| 688 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id =%d",  | 
                                                        |
| 688 | + "UPDATE ".$table." SET ".$post_meta_set_query." where post_id =%d",  | 
                                                        |
| 689 | 689 | array($post_id)  | 
                                                        
| 690 | 690 | )  | 
                                                        
| 691 | 691 | );  | 
                                                        
@@ -695,7 +695,7 @@ discard block  | 
                                                    ||
| 695 | 695 | |
| 696 | 696 | $wpdb->query(  | 
                                                        
| 697 | 697 | $wpdb->prepare(  | 
                                                        
| 698 | - "INSERT INTO " . $table . " SET post_id = %d," . $post_meta_set_query,  | 
                                                        |
| 698 | + "INSERT INTO ".$table." SET post_id = %d,".$post_meta_set_query,  | 
                                                        |
| 699 | 699 | array($post_id)  | 
                                                        
| 700 | 700 | )  | 
                                                        
| 701 | 701 | );  | 
                                                        
@@ -741,7 +741,7 @@ discard block  | 
                                                    ||
| 741 | 741 | |
| 742 | 742 | $post_type = get_post_type($post_id);  | 
                                                        
| 743 | 743 | |
| 744 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 744 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 745 | 745 | |
| 746 | 746 |          if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
 | 
                                                        
| 747 | 747 | |
@@ -749,11 +749,11 @@ discard block  | 
                                                    ||
| 749 | 749 |                  $meta_value = implode(",", $meta_value);
 | 
                                                        
| 750 | 750 | }  | 
                                                        
| 751 | 751 | |
| 752 | -            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 752 | +            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 753 | 753 | |
| 754 | 754 | $wpdb->query(  | 
                                                        
| 755 | 755 | $wpdb->prepare(  | 
                                                        
| 756 | - "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",  | 
                                                        |
| 756 | + "UPDATE ".$table." SET ".$postmeta." = '".$meta_value."' where post_id =%d",  | 
                                                        |
| 757 | 757 | array($post_id)  | 
                                                        
| 758 | 758 | )  | 
                                                        
| 759 | 759 | );  | 
                                                        
@@ -762,7 +762,7 @@ discard block  | 
                                                    ||
| 762 | 762 | |
| 763 | 763 | $wpdb->query(  | 
                                                        
| 764 | 764 | $wpdb->prepare(  | 
                                                        
| 765 | - "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",  | 
                                                        |
| 765 | + "INSERT INTO ".$table." SET post_id = %d, ".$postmeta." = '".$meta_value."'",  | 
                                                        |
| 766 | 766 | array($post_id)  | 
                                                        
| 767 | 767 | )  | 
                                                        
| 768 | 768 | );  | 
                                                        
@@ -795,23 +795,23 @@ discard block  | 
                                                    ||
| 795 | 795 | |
| 796 | 796 | $post_type = get_post_type($post_id);  | 
                                                        
| 797 | 797 | |
| 798 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 798 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 799 | 799 | |
| 800 | 800 |          if (is_array($postmeta) && !empty($postmeta) && $post_id) {
 | 
                                                        
| 801 | 801 | $post_meta_set_query = '';  | 
                                                        
| 802 | 802 | |
| 803 | 803 |              foreach ($postmeta as $mkey) {
 | 
                                                        
| 804 | 804 | if ($mval != '')  | 
                                                        
| 805 | - $post_meta_set_query .= $mkey . " = '', ";  | 
                                                        |
| 805 | + $post_meta_set_query .= $mkey." = '', ";  | 
                                                        |
| 806 | 806 | }  | 
                                                        
| 807 | 807 | |
| 808 | 808 | $post_meta_set_query = trim($post_meta_set_query, ", ");  | 
                                                        
| 809 | 809 | |
| 810 | -            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
 | 
                                                        |
| 810 | +            if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
 | 
                                                        |
| 811 | 811 | |
| 812 | 812 | $wpdb->query(  | 
                                                        
| 813 | 813 | $wpdb->prepare(  | 
                                                        
| 814 | - "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",  | 
                                                        |
| 814 | + "UPDATE ".$table." SET ".$post_meta_set_query." where post_id = %d",  | 
                                                        |
| 815 | 815 | array($post_id)  | 
                                                        
| 816 | 816 | )  | 
                                                        
| 817 | 817 | );  | 
                                                        
@@ -820,11 +820,11 @@ discard block  | 
                                                    ||
| 820 | 820 | }  | 
                                                        
| 821 | 821 | |
| 822 | 822 |          } elseif ($postmeta != '' && $post_id) {
 | 
                                                        
| 823 | -            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
 | 
                                                        |
| 823 | +            if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
 | 
                                                        |
| 824 | 824 | |
| 825 | 825 | $wpdb->query(  | 
                                                        
| 826 | 826 | $wpdb->prepare(  | 
                                                        
| 827 | - "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",  | 
                                                        |
| 827 | + "UPDATE ".$table." SET ".$postmeta."= '' where post_id = %d",  | 
                                                        |
| 828 | 828 | array($post_id)  | 
                                                        
| 829 | 829 | )  | 
                                                        
| 830 | 830 | );  | 
                                                        
@@ -866,10 +866,10 @@ discard block  | 
                                                    ||
| 866 | 866 | if (!in_array($post_type, $all_postypes))  | 
                                                        
| 867 | 867 | return false;  | 
                                                        
| 868 | 868 | |
| 869 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 869 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 870 | 870 | |
| 871 | -        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
 | 
                                                        |
| 872 | -            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
 | 
                                                        |
| 871 | +        if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$meta_key."'") != '') {
 | 
                                                        |
| 872 | +            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT ".$meta_key." from ".$table." where post_id = %d", array($post_id)));
 | 
                                                        |
| 873 | 873 | |
| 874 | 874 |              if ($meta_value && $meta_value !== '') {
 | 
                                                        
| 875 | 875 | return maybe_serialize($meta_value);  | 
                                                        
@@ -903,13 +903,13 @@ discard block  | 
                                                    ||
| 903 | 903 | |
| 904 | 904 | $post_type = get_post_type($post_id);  | 
                                                        
| 905 | 905 | |
| 906 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 906 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 907 | 907 | |
| 908 | 908 | $post_images = geodir_get_images($post_id);  | 
                                                        
| 909 | 909 | |
| 910 | 910 | $wpdb->query(  | 
                                                        
| 911 | 911 | $wpdb->prepare(  | 
                                                        
| 912 | - "UPDATE " . $table . " SET featured_image = '' where post_id =%d",  | 
                                                        |
| 912 | + "UPDATE ".$table." SET featured_image = '' where post_id =%d",  | 
                                                        |
| 913 | 913 | array($post_id)  | 
                                                        
| 914 | 914 | )  | 
                                                        
| 915 | 915 | );  | 
                                                        
@@ -939,12 +939,12 @@ discard block  | 
                                                    ||
| 939 | 939 | $file_path = '';  | 
                                                        
| 940 | 940 | /* --------- start ------- */  | 
                                                        
| 941 | 941 | |
| 942 | -                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
 | 
                                                        |
| 942 | +                $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
 | 
                                                        |
| 943 | 943 | |
| 944 | 944 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';  | 
                                                        
| 945 | 945 | |
| 946 | 946 | |
| 947 | -                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)))) {
 | 
                                                        |
| 947 | +                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)))) {
 | 
                                                        |
| 948 | 948 | |
| 949 | 949 | /* --------- end ------- */  | 
                                                        
| 950 | 950 | $curr_img_url = $post_image[$m];  | 
                                                        
@@ -988,7 +988,7 @@ discard block  | 
                                                    ||
| 988 | 988 | // If the uploaded file is the right format  | 
                                                        
| 989 | 989 |                      if (in_array($uploaded_file_type, $allowed_file_types)) {
 | 
                                                        
| 990 | 990 |                          if (!function_exists('wp_handle_upload')) {
 | 
                                                        
| 991 | - require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 991 | + require_once(ABSPATH.'wp-admin/includes/file.php');  | 
                                                        |
| 992 | 992 | }  | 
                                                        
| 993 | 993 | |
| 994 | 994 |                          if (!is_dir($geodir_uploadpath)) {
 | 
                                                        
@@ -996,41 +996,41 @@ discard block  | 
                                                    ||
| 996 | 996 | }  | 
                                                        
| 997 | 997 | |
| 998 | 998 | $external_img = false;  | 
                                                        
| 999 | -                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
 | 
                                                        |
| 999 | +                        if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
 | 
                                                        |
| 1000 | 1000 |                          } else {
 | 
                                                        
| 1001 | 1001 | $external_img = true;  | 
                                                        
| 1002 | 1002 | }  | 
                                                        
| 1003 | 1003 | |
| 1004 | 1004 |                          if ($dummy || $external_img) {
 | 
                                                        
| 1005 | 1005 | $uploaded_file = array();  | 
                                                        
| 1006 | - $uploaded = (array)fetch_remote_file($curr_img_url);  | 
                                                        |
| 1006 | + $uploaded = (array) fetch_remote_file($curr_img_url);  | 
                                                        |
| 1007 | 1007 | |
| 1008 | 1008 |                              if (isset($uploaded['error']) && empty($uploaded['error'])) {
 | 
                                                        
| 1009 | 1009 | $new_name = basename($uploaded['file']);  | 
                                                        
| 1010 | 1010 | $uploaded_file = $uploaded;  | 
                                                        
| 1011 | -                            }else{
 | 
                                                        |
| 1012 | - print_r($uploaded);exit;  | 
                                                        |
| 1011 | +                            } else {
 | 
                                                        |
| 1012 | + print_r($uploaded); exit;  | 
                                                        |
| 1013 | 1013 | }  | 
                                                        
| 1014 | 1014 | $external_img = false;  | 
                                                        
| 1015 | 1015 |                          } else {
 | 
                                                        
| 1016 | - $new_name = $post_id . '_' . $file_name;  | 
                                                        |
| 1016 | + $new_name = $post_id.'_'.$file_name;  | 
                                                        |
| 1017 | 1017 | |
| 1018 | 1018 |                              if ($curr_img_dir == $sub_dir) {
 | 
                                                        
| 1019 | - $img_path = $geodir_uploadpath . '/' . $filename;  | 
                                                        |
| 1020 | - $img_url = $geodir_uploadurl . '/' . $filename;  | 
                                                        |
| 1019 | + $img_path = $geodir_uploadpath.'/'.$filename;  | 
                                                        |
| 1020 | + $img_url = $geodir_uploadurl.'/'.$filename;  | 
                                                        |
| 1021 | 1021 |                              } else {
 | 
                                                        
| 1022 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 1023 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;  | 
                                                        |
| 1022 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;  | 
                                                        |
| 1023 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;  | 
                                                        |
| 1024 | 1024 | }  | 
                                                        
| 1025 | 1025 | |
| 1026 | 1026 | $uploaded_file = '';  | 
                                                        
| 1027 | 1027 | |
| 1028 | 1028 |                              if (file_exists($img_path)) {
 | 
                                                        
| 1029 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);  | 
                                                        |
| 1029 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);  | 
                                                        |
| 1030 | 1030 | $file_path = '';  | 
                                                        
| 1031 | -                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
 | 
                                                        |
| 1031 | +                            } else if (file_exists($uploads['basedir'].$curr_img_dir.$filename)) {
 | 
                                                        |
| 1032 | 1032 | $uploaded_file = true;  | 
                                                        
| 1033 | - $file_path = $curr_img_dir . '/' . $filename;  | 
                                                        |
| 1033 | + $file_path = $curr_img_dir.'/'.$filename;  | 
                                                        |
| 1034 | 1034 | }  | 
                                                        
| 1035 | 1035 | |
| 1036 | 1036 | if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))  | 
                                                        
@@ -1039,14 +1039,14 @@ discard block  | 
                                                    ||
| 1039 | 1039 | |
| 1040 | 1040 |                          if (!empty($uploaded_file)) {
 | 
                                                        
| 1041 | 1041 |                              if (!isset($file_path) || !$file_path) {
 | 
                                                        
| 1042 | - $file_path = $sub_dir . '/' . $new_name;  | 
                                                        |
| 1042 | + $file_path = $sub_dir.'/'.$new_name;  | 
                                                        |
| 1043 | 1043 | }  | 
                                                        
| 1044 | 1044 | |
| 1045 | -                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
 | 
                                                        |
| 1045 | +                            $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'].$file_path);
 | 
                                                        |
| 1046 | 1046 | |
| 1047 | 1047 |                              if ($menu_order == 1) {
 | 
                                                        
| 1048 | 1048 | |
| 1049 | -                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
 | 
                                                        |
| 1049 | +                                $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
 | 
                                                        |
| 1050 | 1050 | |
| 1051 | 1051 | }  | 
                                                        
| 1052 | 1052 | |
@@ -1064,12 +1064,12 @@ discard block  | 
                                                    ||
| 1064 | 1064 | |
| 1065 | 1065 |                              foreach ($attachment as $key => $val) {
 | 
                                                        
| 1066 | 1066 | if ($val != '')  | 
                                                        
| 1067 | - $attachment_set .= $key . " = '" . $val . "', ";  | 
                                                        |
| 1067 | + $attachment_set .= $key." = '".$val."', ";  | 
                                                        |
| 1068 | 1068 | }  | 
                                                        
| 1069 | 1069 | |
| 1070 | 1070 | $attachment_set = trim($attachment_set, ", ");  | 
                                                        
| 1071 | 1071 | |
| 1072 | -                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
 | 
                                                        |
| 1072 | +                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
 | 
                                                        |
| 1073 | 1073 | |
| 1074 | 1074 | $valid_file_ids[] = $wpdb->insert_id;  | 
                                                        
| 1075 | 1075 | }  | 
                                                        
@@ -1080,17 +1080,17 @@ discard block  | 
                                                    ||
| 1080 | 1080 |                  } else {
 | 
                                                        
| 1081 | 1081 | $valid_file_ids[] = $find_image;  | 
                                                        
| 1082 | 1082 | |
| 1083 | -                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
 | 
                                                        |
| 1083 | +                    $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
 | 
                                                        |
| 1084 | 1084 | |
| 1085 | 1085 | $wpdb->query(  | 
                                                        
| 1086 | 1086 | $wpdb->prepare(  | 
                                                        
| 1087 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",  | 
                                                        |
| 1087 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d where file =%s AND post_id =%d",  | 
                                                        |
| 1088 | 1088 | array($menu_order, $split_img_path[1], $post_id)  | 
                                                        
| 1089 | 1089 | )  | 
                                                        
| 1090 | 1090 | );  | 
                                                        
| 1091 | 1091 | |
| 1092 | 1092 | if ($menu_order == 1)  | 
                                                        
| 1093 | -                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
 | 
                                                        |
| 1093 | +                        $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
 | 
                                                        |
| 1094 | 1094 | |
| 1095 | 1095 | }  | 
                                                        
| 1096 | 1096 | |
@@ -1114,9 +1114,9 @@ discard block  | 
                                                    ||
| 1114 | 1114 | |
| 1115 | 1115 |                  foreach ($post_images as $img) {
 | 
                                                        
| 1116 | 1116 | |
| 1117 | -                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
 | 
                                                        |
| 1117 | +                    if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
 | 
                                                        |
| 1118 | 1118 | |
| 1119 | -                        $invalid_files[] = (object)array('src' => $img->src);
 | 
                                                        |
| 1119 | +                        $invalid_files[] = (object) array('src' => $img->src);
 | 
                                                        |
| 1120 | 1120 | |
| 1121 | 1121 | }  | 
                                                        
| 1122 | 1122 | |
@@ -1124,12 +1124,12 @@ discard block  | 
                                                    ||
| 1124 | 1124 | |
| 1125 | 1125 | }  | 
                                                        
| 1126 | 1126 | |
| 1127 | - $invalid_files = (object)$invalid_files;  | 
                                                        |
| 1127 | + $invalid_files = (object) $invalid_files;  | 
                                                        |
| 1128 | 1128 | }  | 
                                                        
| 1129 | 1129 | |
| 1130 | 1130 | $remove_files[] = $post_id;  | 
                                                        
| 1131 | 1131 | |
| 1132 | -        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
 | 
                                                        |
| 1132 | +        $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ".$valid_files_condition." post_id = %d", $remove_files));
 | 
                                                        |
| 1133 | 1133 | |
| 1134 | 1134 | if (!empty($invalid_files))  | 
                                                        
| 1135 | 1135 | geodir_remove_attachments($invalid_files);  | 
                                                        
@@ -1169,7 +1169,7 @@ discard block  | 
                                                    ||
| 1169 | 1169 | rmdir($dirPath);  | 
                                                        
| 1170 | 1170 | } */  | 
                                                        
| 1171 | 1171 | |
| 1172 | - $dirname = $uploads_dir . '/temp_' . $current_user->ID;  | 
                                                        |
| 1172 | + $dirname = $uploads_dir.'/temp_'.$current_user->ID;  | 
                                                        |
| 1173 | 1173 | geodir_delete_directory($dirname);  | 
                                                        
| 1174 | 1174 | }  | 
                                                        
| 1175 | 1175 | |
@@ -1191,10 +1191,10 @@ discard block  | 
                                                    ||
| 1191 | 1191 | return false;  | 
                                                        
| 1192 | 1192 |      while ($file = readdir($dir_handle)) {
 | 
                                                        
| 1193 | 1193 |          if ($file != "." && $file != "..") {
 | 
                                                        
| 1194 | - if (!is_dir($dirname . "/" . $file))  | 
                                                        |
| 1195 | - unlink($dirname . "/" . $file);  | 
                                                        |
| 1194 | + if (!is_dir($dirname."/".$file))  | 
                                                        |
| 1195 | + unlink($dirname."/".$file);  | 
                                                        |
| 1196 | 1196 | else  | 
                                                        
| 1197 | - geodir_delete_directory($dirname . '/' . $file);  | 
                                                        |
| 1197 | + geodir_delete_directory($dirname.'/'.$file);  | 
                                                        |
| 1198 | 1198 | }  | 
                                                        
| 1199 | 1199 | }  | 
                                                        
| 1200 | 1200 | closedir($dir_handle);  | 
                                                        
@@ -1223,8 +1223,8 @@ discard block  | 
                                                    ||
| 1223 | 1223 |              foreach ($postcurr_images as $postimg) {
 | 
                                                        
| 1224 | 1224 |                  $image_name_arr = explode('/', $postimg->src);
 | 
                                                        
| 1225 | 1225 | $filename = end($image_name_arr);  | 
                                                        
| 1226 | - if (file_exists($uploads_dir . '/' . $filename))  | 
                                                        |
| 1227 | - unlink($uploads_dir . '/' . $filename);  | 
                                                        |
| 1226 | + if (file_exists($uploads_dir.'/'.$filename))  | 
                                                        |
| 1227 | + unlink($uploads_dir.'/'.$filename);  | 
                                                        |
| 1228 | 1228 | }  | 
                                                        
| 1229 | 1229 | |
| 1230 | 1230 | } // endif  | 
                                                        
@@ -1265,16 +1265,16 @@ discard block  | 
                                                    ||
| 1265 | 1265 | }  | 
                                                        
| 1266 | 1266 | |
| 1267 | 1267 |          if (!in_array($post_type, geodir_get_posttypes())) {
 | 
                                                        
| 1268 | - return false;// if not a GD CPT return;  | 
                                                        |
| 1268 | + return false; // if not a GD CPT return;  | 
                                                        |
| 1269 | 1269 | }  | 
                                                        
| 1270 | 1270 | |
| 1271 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 1271 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 1272 | 1272 | |
| 1273 | 1273 |          if (!$file) {
 | 
                                                        
| 1274 | 1274 |              if (isset($post->featured_image)) {
 | 
                                                        
| 1275 | 1275 | $file = $post->featured_image;  | 
                                                        
| 1276 | 1276 |              } else {
 | 
                                                        
| 1277 | -                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
 | 
                                                        |
| 1277 | +                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM ".$table." WHERE post_id = %d", array($post_id)));
 | 
                                                        |
| 1278 | 1278 | }  | 
                                                        
| 1279 | 1279 | }  | 
                                                        
| 1280 | 1280 | |
@@ -1292,7 +1292,7 @@ discard block  | 
                                                    ||
| 1292 | 1292 | |
| 1293 | 1293 | $file_name = $file_info['basename'];  | 
                                                        
| 1294 | 1294 | |
| 1295 | - $uploads_url = $uploads_baseurl . $sub_dir;  | 
                                                        |
| 1295 | + $uploads_url = $uploads_baseurl.$sub_dir;  | 
                                                        |
| 1296 | 1296 | /*  | 
                                                        
| 1297 | 1297 | * Allows the filter of image src for such things as CDN change.  | 
                                                        
| 1298 | 1298 | *  | 
                                                        
@@ -1302,8 +1302,8 @@ discard block  | 
                                                    ||
| 1302 | 1302 | * @param string $uploads_url The server upload directory url.  | 
                                                        
| 1303 | 1303 | * @param string $uploads_baseurl The uploads dir base url.  | 
                                                        
| 1304 | 1304 | */  | 
                                                        
| 1305 | -            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
 | 
                                                        |
| 1306 | - $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1305 | +            $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
 | 
                                                        |
| 1306 | + $img_arr['path'] = $uploads_path.'/'.$file_name;  | 
                                                        |
| 1307 | 1307 | $width = 0;  | 
                                                        
| 1308 | 1308 | $height = 0;  | 
                                                        
| 1309 | 1309 |              if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
 | 
                                                        
@@ -1346,7 +1346,7 @@ discard block  | 
                                                    ||
| 1346 | 1346 | $file_name = $file_info['basename'];  | 
                                                        
| 1347 | 1347 | |
| 1348 | 1348 | $img_arr['src'] = $default_img;  | 
                                                        
| 1349 | - $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1349 | + $img_arr['path'] = $uploads_path.'/'.$file_name;  | 
                                                        |
| 1350 | 1350 | |
| 1351 | 1351 | $width = 0;  | 
                                                        
| 1352 | 1352 | $height = 0;  | 
                                                        
@@ -1363,7 +1363,7 @@ discard block  | 
                                                    ||
| 1363 | 1363 | }  | 
                                                        
| 1364 | 1364 | |
| 1365 | 1365 | if (!empty($img_arr))  | 
                                                        
| 1366 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );  | 
                                                        |
| 1366 | + return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path );  | 
                                                        |
| 1367 | 1367 | else  | 
                                                        
| 1368 | 1368 | return false;  | 
                                                        
| 1369 | 1369 | }  | 
                                                        
@@ -1426,7 +1426,7 @@ discard block  | 
                                                    ||
| 1426 | 1426 | |
| 1427 | 1427 | $arrImages = $wpdb->get_results(  | 
                                                        
| 1428 | 1428 | $wpdb->prepare(  | 
                                                        
| 1429 | - "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 ",  | 
                                                        |
| 1429 | + "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 ",  | 
                                                        |
| 1430 | 1430 |                  array('%image%', $post_id)
 | 
                                                        
| 1431 | 1431 | )  | 
                                                        
| 1432 | 1432 | );  | 
                                                        
@@ -1452,7 +1452,7 @@ discard block  | 
                                                    ||
| 1452 | 1452 | |
| 1453 | 1453 | $file_name = $file_info['basename'];  | 
                                                        
| 1454 | 1454 | |
| 1455 | - $uploads_url = $uploads_baseurl . $sub_dir;  | 
                                                        |
| 1455 | + $uploads_url = $uploads_baseurl.$sub_dir;  | 
                                                        |
| 1456 | 1456 | /*  | 
                                                        
| 1457 | 1457 | * Allows the filter of image src for such things as CDN change.  | 
                                                        
| 1458 | 1458 | *  | 
                                                        
@@ -1462,8 +1462,8 @@ discard block  | 
                                                    ||
| 1462 | 1462 | * @param string $uploads_url The server upload directory url.  | 
                                                        
| 1463 | 1463 | * @param string $uploads_baseurl The uploads dir base url.  | 
                                                        
| 1464 | 1464 | */  | 
                                                        
| 1465 | -                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
 | 
                                                        |
| 1466 | - $img_arr['path'] = $uploads_path . '/' . $file_name;  | 
                                                        |
| 1465 | +                $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
 | 
                                                        |
| 1466 | + $img_arr['path'] = $uploads_path.'/'.$file_name;  | 
                                                        |
| 1467 | 1467 | $width = 0;  | 
                                                        
| 1468 | 1468 | $height = 0;  | 
                                                        
| 1469 | 1469 |                  if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
 | 
                                                        
@@ -1480,11 +1480,11 @@ discard block  | 
                                                    ||
| 1480 | 1480 | $img_arr['content'] = $attechment->content; // add the description to the array  | 
                                                        
| 1481 | 1481 | $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.  | 
                                                        
| 1482 | 1482 | |
| 1483 | - $return_arr[] = (object)$img_arr;  | 
                                                        |
| 1483 | + $return_arr[] = (object) $img_arr;  | 
                                                        |
| 1484 | 1484 | |
| 1485 | 1485 | $counter++;  | 
                                                        
| 1486 | 1486 | }  | 
                                                        
| 1487 | - return (object)$return_arr;  | 
                                                        |
| 1487 | + return (object) $return_arr;  | 
                                                        |
| 1488 | 1488 |          } else if ($no_images) {
 | 
                                                        
| 1489 | 1489 | $default_img = '';  | 
                                                        
| 1490 | 1490 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        
@@ -1523,7 +1523,7 @@ discard block  | 
                                                    ||
| 1523 | 1523 | $img_arr['title'] = $file_info['filename']; // add the title to the array  | 
                                                        
| 1524 | 1524 | $img_arr['content'] = $file_info['filename']; // add the description to the array  | 
                                                        
| 1525 | 1525 | |
| 1526 | - $return_arr[] = (object)$img_arr;  | 
                                                        |
| 1526 | + $return_arr[] = (object) $img_arr;  | 
                                                        |
| 1527 | 1527 | |
| 1528 | 1528 | return $return_arr;  | 
                                                        
| 1529 | 1529 | } else  | 
                                                        
@@ -1550,8 +1550,8 @@ discard block  | 
                                                    ||
| 1550 | 1550 | |
| 1551 | 1551 | $html = '';  | 
                                                        
| 1552 | 1552 |          if (!empty($request)) {
 | 
                                                        
| 1553 | -            if (!is_object($request)){
 | 
                                                        |
| 1554 | - $request = (object)$request;  | 
                                                        |
| 1553 | +            if (!is_object($request)) {
 | 
                                                        |
| 1554 | + $request = (object) $request;  | 
                                                        |
| 1555 | 1555 | }  | 
                                                        
| 1556 | 1556 | |
| 1557 | 1557 |              if (isset($request->src) && !isset($request->path)) {
 | 
                                                        
@@ -1565,7 +1565,7 @@ discard block  | 
                                                    ||
| 1565 | 1565 |              $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
 | 
                                                        
| 1566 | 1566 |              $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
 | 
                                                        
| 1567 | 1567 |              if (strpos($img_no_http, $upload_no_http) !== false) {
 | 
                                                        
| 1568 | - $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);  | 
                                                        |
| 1568 | + $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path);  | 
                                                        |
| 1569 | 1569 | }  | 
                                                        
| 1570 | 1570 | |
| 1571 | 1571 | $width = 0;  | 
                                                        
@@ -1580,7 +1580,7 @@ discard block  | 
                                                    ||
| 1580 | 1580 | $image->width = $width;  | 
                                                        
| 1581 | 1581 | $image->height = $height;  | 
                                                        
| 1582 | 1582 | |
| 1583 | - $max_size = (object)geodir_get_imagesize($size);  | 
                                                        |
| 1583 | + $max_size = (object) geodir_get_imagesize($size);  | 
                                                        |
| 1584 | 1584 | |
| 1585 | 1585 |              if (!is_wp_error($max_size)) {
 | 
                                                        
| 1586 | 1586 |                  if ($image->width) {
 | 
                                                        
@@ -1592,12 +1592,12 @@ discard block  | 
                                                    ||
| 1592 | 1592 | $width_per = 100;  | 
                                                        
| 1593 | 1593 | }  | 
                                                        
| 1594 | 1594 | |
| 1595 | -                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
 | 
                                                        |
| 1596 | - $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '" /></div>';  | 
                                                        |
| 1595 | +                if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
 | 
                                                        |
| 1596 | + $html = '<div class="geodir_thumbnail"><img style="max-height:'.$max_size->h.'px;" alt="place image" src="'.$image->src.'" /></div>';  | 
                                                        |
| 1597 | 1597 |                  } else {
 | 
                                                        
| 1598 | -                    if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
 | 
                                                        |
| 1599 | - $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';  | 
                                                        |
| 1600 | -                    }else{
 | 
                                                        |
| 1598 | +                    if ($size == 'widget-thumb' || !get_option('geodir_lazy_load', 1)) {
 | 
                                                        |
| 1599 | + $html = '<div class="geodir_thumbnail" style="background-image:url(\''.$image->src.'\');"></div>';  | 
                                                        |
| 1600 | +                    } else {
 | 
                                                        |
| 1601 | 1601 | //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';  | 
                                                        
| 1602 | 1602 | //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';  | 
                                                        
| 1603 | 1603 | $html = '<div data-src="'.$image->src.'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';  | 
                                                        
@@ -1636,15 +1636,15 @@ discard block  | 
                                                    ||
| 1636 | 1636 | |
| 1637 | 1637 | $post_type = get_post_type($post_id);  | 
                                                        
| 1638 | 1638 | |
| 1639 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 1639 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 1640 | 1640 | |
| 1641 | 1641 |          if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
 | 
                                                        
| 1642 | 1642 | |
| 1643 | -            if ($taxonomy == $post_type . '_tags') {
 | 
                                                        |
| 1643 | +            if ($taxonomy == $post_type.'_tags') {
 | 
                                                        |
| 1644 | 1644 |                  if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
 | 
                                                        
| 1645 | 1645 | geodir_save_post_meta($post_id, 'post_tags', $terms);  | 
                                                        
| 1646 | 1646 | }  | 
                                                        
| 1647 | -            } elseif ($taxonomy == $post_type . 'category') {
 | 
                                                        |
| 1647 | +            } elseif ($taxonomy == $post_type.'category') {
 | 
                                                        |
| 1648 | 1648 |                  $srcharr = array('"', '\\');
 | 
                                                        
| 1649 | 1649 |                  $replarr = array(""", '');
 | 
                                                        
| 1650 | 1650 | |
@@ -1666,7 +1666,7 @@ discard block  | 
                                                    ||
| 1666 | 1666 | |
| 1667 | 1667 | $wpdb->get_var(  | 
                                                        
| 1668 | 1668 | $wpdb->prepare(  | 
                                                        
| 1669 | - "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",  | 
                                                        |
| 1669 | + "DELETE from ".GEODIR_ICON_TABLE." WHERE cat_id NOT IN ($format) AND post_id = %d ",  | 
                                                        |
| 1670 | 1670 | $cat_ids_array_del  | 
                                                        
| 1671 | 1671 | )  | 
                                                        
| 1672 | 1672 | );  | 
                                                        
@@ -1674,7 +1674,7 @@ discard block  | 
                                                    ||
| 1674 | 1674 | |
| 1675 | 1675 | $post_term = $wpdb->get_col(  | 
                                                        
| 1676 | 1676 | $wpdb->prepare(  | 
                                                        
| 1677 | - "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",  | 
                                                        |
| 1677 | + "SELECT term_id FROM ".$wpdb->term_taxonomy." WHERE term_taxonomy_id IN($format) GROUP BY term_id",  | 
                                                        |
| 1678 | 1678 | $cat_ids_array  | 
                                                        
| 1679 | 1679 | )  | 
                                                        
| 1680 | 1680 | );  | 
                                                        
@@ -1696,16 +1696,16 @@ discard block  | 
                                                    ||
| 1696 | 1696 | $lat = geodir_get_post_meta($post_id, 'post_latitude', true);  | 
                                                        
| 1697 | 1697 | $lng = geodir_get_post_meta($post_id, 'post_longitude', true);  | 
                                                        
| 1698 | 1698 | |
| 1699 | -                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
 | 
                                                        |
| 1700 | - $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);  | 
                                                        |
| 1699 | +                        $timing = ' - '.date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
 | 
                                                        |
| 1700 | + $timing .= ' - '.geodir_get_post_meta($post_id, 'st_time', true);  | 
                                                        |
| 1701 | 1701 | |
| 1702 | 1702 |                          $json = '{';
 | 
                                                        
| 1703 | - $json .= '"id":"' . $post_id . '",';  | 
                                                        |
| 1704 | - $json .= '"lat_pos": "' . $lat . '",';  | 
                                                        |
| 1705 | - $json .= '"long_pos": "' . $lng . '",';  | 
                                                        |
| 1706 | - $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';  | 
                                                        |
| 1707 | - $json .= '"icon":"' . $term_icon . '",';  | 
                                                        |
| 1708 | - $json .= '"group":"catgroup' . $cat_id . '"';  | 
                                                        |
| 1703 | + $json .= '"id":"'.$post_id.'",';  | 
                                                        |
| 1704 | + $json .= '"lat_pos": "'.$lat.'",';  | 
                                                        |
| 1705 | + $json .= '"long_pos": "'.$lng.'",';  | 
                                                        |
| 1706 | + $json .= '"marker_id":"'.$post_id.'_'.$cat_id.'",';  | 
                                                        |
| 1707 | + $json .= '"icon":"'.$term_icon.'",';  | 
                                                        |
| 1708 | + $json .= '"group":"catgroup'.$cat_id.'"';  | 
                                                        |
| 1709 | 1709 | $json .= '}';  | 
                                                        
| 1710 | 1710 | |
| 1711 | 1711 | |
@@ -1713,9 +1713,9 @@ discard block  | 
                                                    ||
| 1713 | 1713 | $post_marker_json = $json;  | 
                                                        
| 1714 | 1714 | |
| 1715 | 1715 | |
| 1716 | -                        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)))) {
 | 
                                                        |
| 1716 | +                        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)))) {
 | 
                                                        |
| 1717 | 1717 | |
| 1718 | -                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
 | 
                                                        |
| 1718 | +                            $json_query = $wpdb->prepare("UPDATE ".GEODIR_ICON_TABLE." SET
 | 
                                                        |
| 1719 | 1719 | post_title = %s,  | 
                                                        
| 1720 | 1720 | json = %s  | 
                                                        
| 1721 | 1721 | WHERE post_id = %d AND cat_id = %d ",  | 
                                                        
@@ -1723,7 +1723,7 @@ discard block  | 
                                                    ||
| 1723 | 1723 | |
| 1724 | 1724 |                          } else {
 | 
                                                        
| 1725 | 1725 | |
| 1726 | -                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
 | 
                                                        |
| 1726 | +                            $json_query = $wpdb->prepare("INSERT INTO ".GEODIR_ICON_TABLE." SET
 | 
                                                        |
| 1727 | 1727 | post_id = %d,  | 
                                                        
| 1728 | 1728 | post_title = %s,  | 
                                                        
| 1729 | 1729 | cat_id = %d,  | 
                                                        
@@ -1741,17 +1741,17 @@ discard block  | 
                                                    ||
| 1741 | 1741 |                  if (!empty($post_term) && is_array($post_term)) {
 | 
                                                        
| 1742 | 1742 |                      $categories = implode(',', $post_term);
 | 
                                                        
| 1743 | 1743 | |
| 1744 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';  | 
                                                        |
| 1744 | + if ($categories != '' && $categories != 0) $categories = ','.$categories.',';  | 
                                                        |
| 1745 | 1745 | |
| 1746 | 1746 | if (empty($post_marker_json))  | 
                                                        
| 1747 | 1747 | $post_marker_json = isset($json) ? $json : '';  | 
                                                        
| 1748 | 1748 | |
| 1749 | -                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 1749 | +                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
 | 
                                                        |
| 1750 | 1750 | |
| 1751 | 1751 | $wpdb->query(  | 
                                                        
| 1752 | 1752 | $wpdb->prepare(  | 
                                                        
| 1753 | - "UPDATE " . $table . " SET  | 
                                                        |
| 1754 | - " . $taxonomy . " = %s,  | 
                                                        |
| 1753 | + "UPDATE ".$table." SET  | 
                                                        |
| 1754 | + " . $taxonomy." = %s,  | 
                                                        |
| 1755 | 1755 | marker_json = %s  | 
                                                        
| 1756 | 1756 | where post_id = %d",  | 
                                                        
| 1757 | 1757 | array($categories, $post_marker_json, $post_id)  | 
                                                        
@@ -1772,7 +1772,7 @@ discard block  | 
                                                    ||
| 1772 | 1772 | |
| 1773 | 1773 | $wpdb->query(  | 
                                                        
| 1774 | 1774 | $wpdb->prepare(  | 
                                                        
| 1775 | - "UPDATE " . $table . " SET  | 
                                                        |
| 1775 | + "UPDATE ".$table." SET  | 
                                                        |
| 1776 | 1776 | default_category = %s  | 
                                                        
| 1777 | 1777 | where post_id = %d",  | 
                                                        
| 1778 | 1778 | array($categories[0], $post_id)  | 
                                                        
@@ -1797,9 +1797,9 @@ discard block  | 
                                                    ||
| 1797 | 1797 | |
| 1798 | 1798 | $wpdb->query(  | 
                                                        
| 1799 | 1799 | $wpdb->prepare(  | 
                                                        
| 1800 | - "INSERT INTO " . $table . " SET  | 
                                                        |
| 1800 | + "INSERT INTO ".$table." SET  | 
                                                        |
| 1801 | 1801 | post_id = %d,  | 
                                                        
| 1802 | - " . $taxonomy . " = %s,  | 
                                                        |
| 1802 | + " . $taxonomy." = %s,  | 
                                                        |
| 1803 | 1803 | marker_json = %s ",  | 
                                                        
| 1804 | 1804 | |
| 1805 | 1805 | array($post_id, $categories, $post_marker_json)  | 
                                                        
@@ -1928,7 +1928,7 @@ discard block  | 
                                                    ||
| 1928 | 1928 | } ?>"><img alt="bubble image" style="max-height:50px;"  | 
                                                        
| 1929 | 1929 | src="<?php echo $post_images[0]; ?>"/></a></div>  | 
                                                        
| 1930 | 1930 | <?php  | 
                                                        
| 1931 | -                            }else{
 | 
                                                        |
| 1931 | +                            } else {
 | 
                                                        |
| 1932 | 1932 | echo '<div class="geodir-bubble_image"></div>';  | 
                                                        
| 1933 | 1933 | }  | 
                                                        
| 1934 | 1934 |                          } else {
 | 
                                                        
@@ -1936,7 +1936,7 @@ discard block  | 
                                                    ||
| 1936 | 1936 | ?>  | 
                                                        
| 1937 | 1937 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>  | 
                                                        
| 1938 | 1938 | <?php  | 
                                                        
| 1939 | -                            }else{
 | 
                                                        |
| 1939 | +                            } else {
 | 
                                                        |
| 1940 | 1940 | echo '<div class="geodir-bubble_image"></div>';  | 
                                                        
| 1941 | 1941 | }  | 
                                                        
| 1942 | 1942 | }  | 
                                                        
@@ -1981,7 +1981,7 @@ discard block  | 
                                                    ||
| 1981 | 1981 | * @param object $postinfo_obj The posts info as an object.  | 
                                                        
| 1982 | 1982 | * @param bool|string $post_preview True if currently in post preview page. Empty string if not. *  | 
                                                        
| 1983 | 1983 | */  | 
                                                        
| 1984 | -                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
 | 
                                                        |
| 1984 | +                            do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
 | 
                                                        |
| 1985 | 1985 | ?>  | 
                                                        
| 1986 | 1986 | </div>  | 
                                                        
| 1987 | 1987 | <?php  | 
                                                        
@@ -1993,10 +1993,10 @@ discard block  | 
                                                    ||
| 1993 | 1993 | <div class="geodir-bubble-meta-fade"></div>  | 
                                                        
| 1994 | 1994 | |
| 1995 | 1995 | <div class="geodir-bubble-meta-bottom">  | 
                                                        
| 1996 | - <span class="geodir-bubble-rating"><?php echo $rating_star;?></span>  | 
                                                        |
| 1996 | + <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span>  | 
                                                        |
| 1997 | 1997 | |
| 1998 | 1998 | <span  | 
                                                        
| 1999 | - class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span>  | 
                                                        |
| 1999 | + class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span>  | 
                                                        |
| 2000 | 2000 | <span class="geodir-bubble-reviews"><a href="<?php echo get_comments_link($ID); ?>"  | 
                                                        
| 2001 | 2001 | class="geodir-pcomments"><i class="fa fa-comments"></i>  | 
                                                        
| 2002 | 2002 | <?php echo get_comments_number($ID); ?>  | 
                                                        
@@ -2061,11 +2061,11 @@ discard block  | 
                                                    ||
| 2061 | 2061 | |
| 2062 | 2062 | $post_type = get_post_type($post_id);  | 
                                                        
| 2063 | 2063 | |
| 2064 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2064 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 2065 | 2065 | |
| 2066 | 2066 | $wpdb->query(  | 
                                                        
| 2067 | 2067 | $wpdb->prepare(  | 
                                                        
| 2068 | - "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",  | 
                                                        |
| 2068 | + "UPDATE ".$table." SET post_status=%s WHERE post_id=%d",  | 
                                                        |
| 2069 | 2069 | array($status, $post_id)  | 
                                                        
| 2070 | 2070 | )  | 
                                                        
| 2071 | 2071 | );  | 
                                                        
@@ -2137,18 +2137,18 @@ discard block  | 
                                                    ||
| 2137 | 2137 | |
| 2138 | 2138 | $post_type = get_post_type($post_id);  | 
                                                        
| 2139 | 2139 | |
| 2140 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2140 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 2141 | 2141 | |
| 2142 | 2142 | $wpdb->query(  | 
                                                        
| 2143 | 2143 | $wpdb->prepare(  | 
                                                        
| 2144 | - "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2144 | + "UPDATE ".$table." SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2145 | 2145 | array($updatingpost, $temppost)  | 
                                                        
| 2146 | 2146 | )  | 
                                                        
| 2147 | 2147 | );  | 
                                                        
| 2148 | 2148 | |
| 2149 | 2149 | $wpdb->query(  | 
                                                        
| 2150 | 2150 | $wpdb->prepare(  | 
                                                        
| 2151 | - "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2151 | + "UPDATE ".GEODIR_ICON_TABLE." SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2152 | 2152 | array($updatingpost, $temppost)  | 
                                                        
| 2153 | 2153 | )  | 
                                                        
| 2154 | 2154 | );  | 
                                                        
@@ -2157,7 +2157,7 @@ discard block  | 
                                                    ||
| 2157 | 2157 | |
| 2158 | 2158 | $wpdb->query(  | 
                                                        
| 2159 | 2159 | $wpdb->prepare(  | 
                                                        
| 2160 | - "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2160 | + "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET `post_id` = %d WHERE `post_id` = %d",  | 
                                                        |
| 2161 | 2161 | array($updatingpost, $temppost)  | 
                                                        
| 2162 | 2162 | )  | 
                                                        
| 2163 | 2163 | );  | 
                                                        
@@ -2195,12 +2195,12 @@ discard block  | 
                                                    ||
| 2195 | 2195 | if (!in_array($post_type, $all_postypes))  | 
                                                        
| 2196 | 2196 | return false;  | 
                                                        
| 2197 | 2197 | |
| 2198 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2198 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 2199 | 2199 | |
| 2200 | 2200 | /* Delete custom post meta*/  | 
                                                        
| 2201 | 2201 | $wpdb->query(  | 
                                                        
| 2202 | 2202 | $wpdb->prepare(  | 
                                                        
| 2203 | - "DELETE FROM " . $table . " WHERE `post_id` = %d",  | 
                                                        |
| 2203 | + "DELETE FROM ".$table." WHERE `post_id` = %d",  | 
                                                        |
| 2204 | 2204 | array($deleted_postid)  | 
                                                        
| 2205 | 2205 | )  | 
                                                        
| 2206 | 2206 | );  | 
                                                        
@@ -2209,7 +2209,7 @@ discard block  | 
                                                    ||
| 2209 | 2209 | |
| 2210 | 2210 | $wpdb->query(  | 
                                                        
| 2211 | 2211 | $wpdb->prepare(  | 
                                                        
| 2212 | - "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",  | 
                                                        |
| 2212 | + "DELETE FROM ".GEODIR_ICON_TABLE." WHERE `post_id` = %d",  | 
                                                        |
| 2213 | 2213 | array($deleted_postid)  | 
                                                        
| 2214 | 2214 | )  | 
                                                        
| 2215 | 2215 | );  | 
                                                        
@@ -2219,7 +2219,7 @@ discard block  | 
                                                    ||
| 2219 | 2219 | |
| 2220 | 2220 | $wpdb->query(  | 
                                                        
| 2221 | 2221 | $wpdb->prepare(  | 
                                                        
| 2222 | - "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",  | 
                                                        |
| 2222 | + "DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE `post_id` = %d",  | 
                                                        |
| 2223 | 2223 | array($deleted_postid)  | 
                                                        
| 2224 | 2224 | )  | 
                                                        
| 2225 | 2225 | );  | 
                                                        
@@ -2291,7 +2291,7 @@ discard block  | 
                                                    ||
| 2291 | 2291 | */  | 
                                                        
| 2292 | 2292 |          do_action('geodir_before_add_from_favorite', $post_id);
 | 
                                                        
| 2293 | 2293 | |
| 2294 | - echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';  | 
                                                        |
| 2294 | + echo '<a href="javascript:void(0);" title="'.$remove_favourite_text.'" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'remove\');"><i class="'.$favourite_icon.'"></i> '.$unfavourite_text.'</a>';  | 
                                                        |
| 2295 | 2295 | |
| 2296 | 2296 | /**  | 
                                                        
| 2297 | 2297 | * Called after adding the post from favourites.  | 
                                                        
@@ -2370,7 +2370,7 @@ discard block  | 
                                                    ||
| 2370 | 2370 | */  | 
                                                        
| 2371 | 2371 |          do_action('geodir_before_remove_from_favorite', $post_id);
 | 
                                                        
| 2372 | 2372 | |
| 2373 | - echo '<a href="javascript:void(0);" title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';  | 
                                                        |
| 2373 | + echo '<a href="javascript:void(0);" title="'.$add_favourite_text.'" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'add\');"><i class="'.$favourite_icon.'"></i> '.$favourite_text.'</a>';  | 
                                                        |
| 2374 | 2374 | |
| 2375 | 2375 | /**  | 
                                                        
| 2376 | 2376 | * Called after removing the post from favourites.  | 
                                                        
@@ -2465,24 +2465,24 @@ discard block  | 
                                                    ||
| 2465 | 2465 | $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        
| 2466 | 2466 | |
| 2467 | 2467 |          if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
 | 
                                                        
| 2468 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a  | 
                                                        |
| 2468 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>" ><a  | 
                                                        |
| 2469 | 2469 | class="geodir-removetofav-icon" href="javascript:void(0);"  | 
                                                        
| 2470 | - onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"  | 
                                                        |
| 2471 | - title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>  | 
                                                        |
| 2470 | + onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');"  | 
                                                        |
| 2471 | + title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?>  | 
                                                        |
| 2472 | 2472 | </a> </span><?php  | 
                                                        
| 2473 | 2473 | |
| 2474 | 2474 |          } else {
 | 
                                                        
| 2475 | 2475 | |
| 2476 | 2476 |              if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
 | 
                                                        
| 2477 | - $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';  | 
                                                        |
| 2477 | + $script_text = 'javascript:window.location.href=\''.geodir_login_url().'\'';  | 
                                                        |
| 2478 | 2478 | } else  | 
                                                        
| 2479 | -                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
 | 
                                                        |
| 2479 | +                $script_text = 'javascript:addToFavourite('.$post_id.',\'add\')';
 | 
                                                        |
| 2480 | 2480 | |
| 2481 | - ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"  | 
                                                        |
| 2481 | + ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon"  | 
                                                        |
| 2482 | 2482 | href="javascript:void(0);"  | 
                                                        
| 2483 | - onclick="<?php echo $script_text;?>"  | 
                                                        |
| 2484 | - title="<?php echo $add_favourite_text;?>"><i  | 
                                                        |
| 2485 | - class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>  | 
                                                        |
| 2483 | + onclick="<?php echo $script_text; ?>"  | 
                                                        |
| 2484 | + title="<?php echo $add_favourite_text; ?>"><i  | 
                                                        |
| 2485 | + class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span>  | 
                                                        |
| 2486 | 2486 | <?php }  | 
                                                        
| 2487 | 2487 | }  | 
                                                        
| 2488 | 2488 | }  | 
                                                        
@@ -2512,7 +2512,7 @@ discard block  | 
                                                    ||
| 2512 | 2512 | |
| 2513 | 2513 | $post_type = $taxonomy_obj->object_type[0];  | 
                                                        
| 2514 | 2514 | |
| 2515 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2515 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 2516 | 2516 | |
| 2517 | 2517 | /**  | 
                                                        
| 2518 | 2518 | * Filter to modify the 'join' query  | 
                                                        
@@ -2535,8 +2535,8 @@ discard block  | 
                                                    ||
| 2535 | 2535 |              $where = apply_filters('geodir_cat_post_count_where', $where, $term);
 | 
                                                        
| 2536 | 2536 | |
| 2537 | 2537 | $count_query = "SELECT count(post_id) FROM  | 
                                                        
| 2538 | - " . $table . " as pd " . $join . "  | 
                                                        |
| 2539 | -							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
 | 
                                                        |
| 2538 | + " . $table." as pd ".$join."  | 
                                                        |
| 2539 | +							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id."',".$term->taxonomy.") ".$where;
 | 
                                                        |
| 2540 | 2540 | |
| 2541 | 2541 | $cat_post_count = $wpdb->get_var($count_query);  | 
                                                        
| 2542 | 2542 | if (empty($cat_post_count) || is_wp_error($cat_post_count))  | 
                                                        
@@ -2619,7 +2619,7 @@ discard block  | 
                                                    ||
| 2619 | 2619 | global $post;  | 
                                                        
| 2620 | 2620 | $all_postypes = geodir_get_posttypes();  | 
                                                        
| 2621 | 2621 |      if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
 | 
                                                        
| 2622 | - return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';  | 
                                                        |
| 2622 | + return ' <a href="'.get_permalink($post->ID).'">'.READ_MORE_TXT.'</a>';  | 
                                                        |
| 2623 | 2623 | }  | 
                                                        
| 2624 | 2624 | |
| 2625 | 2625 | return $more;  | 
                                                        
@@ -2646,14 +2646,14 @@ discard block  | 
                                                    ||
| 2646 | 2646 |      if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
 | 
                                                        
| 2647 | 2647 | |
| 2648 | 2648 | $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);  | 
                                                        
| 2649 | - $table = $plugin_prefix . $geodir_post_type . '_detail';  | 
                                                        |
| 2649 | + $table = $plugin_prefix.$geodir_post_type.'_detail';  | 
                                                        |
| 2650 | 2650 | |
| 2651 | 2651 | $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);  | 
                                                        
| 2652 | - $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';  | 
                                                        |
| 2652 | + $term_icon = $path_parts['dirname'].'/cat_icon_'.$term_id.'.png';  | 
                                                        |
| 2653 | 2653 | |
| 2654 | 2654 | $posts = $wpdb->get_results(  | 
                                                        
| 2655 | 2655 | $wpdb->prepare(  | 
                                                        
| 2656 | - "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",  | 
                                                        |
| 2656 | + "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM ".$table." WHERE FIND_IN_SET(%s,%1\$s ) ",  | 
                                                        |
| 2657 | 2657 | array($term_id, $taxonomy)  | 
                                                        
| 2658 | 2658 | )  | 
                                                        
| 2659 | 2659 | );  | 
                                                        
@@ -2665,19 +2665,19 @@ discard block  | 
                                                    ||
| 2665 | 2665 | $lng = $post_obj->post_longitude;  | 
                                                        
| 2666 | 2666 | |
| 2667 | 2667 |                  $json = '{';
 | 
                                                        
| 2668 | - $json .= '"id":"' . $post_obj->post_id . '",';  | 
                                                        |
| 2669 | - $json .= '"lat_pos": "' . $lat . '",';  | 
                                                        |
| 2670 | - $json .= '"long_pos": "' . $lng . '",';  | 
                                                        |
| 2671 | - $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';  | 
                                                        |
| 2672 | - $json .= '"icon":"' . $term_icon . '",';  | 
                                                        |
| 2673 | - $json .= '"group":"catgroup' . $term_id . '"';  | 
                                                        |
| 2668 | + $json .= '"id":"'.$post_obj->post_id.'",';  | 
                                                        |
| 2669 | + $json .= '"lat_pos": "'.$lat.'",';  | 
                                                        |
| 2670 | + $json .= '"long_pos": "'.$lng.'",';  | 
                                                        |
| 2671 | + $json .= '"marker_id":"'.$post_obj->post_id.'_'.$term_id.'",';  | 
                                                        |
| 2672 | + $json .= '"icon":"'.$term_icon.'",';  | 
                                                        |
| 2673 | + $json .= '"group":"catgroup'.$term_id.'"';  | 
                                                        |
| 2674 | 2674 | $json .= '}';  | 
                                                        
| 2675 | 2675 | |
| 2676 | 2676 |                  if ($post_obj->default_category == $term_id) {
 | 
                                                        
| 2677 | 2677 | |
| 2678 | 2678 | $wpdb->query(  | 
                                                        
| 2679 | 2679 | $wpdb->prepare(  | 
                                                        
| 2680 | - "UPDATE " . $table . " SET marker_json = %s where post_id = %d",  | 
                                                        |
| 2680 | + "UPDATE ".$table." SET marker_json = %s where post_id = %d",  | 
                                                        |
| 2681 | 2681 | array($json, $post_obj->post_id)  | 
                                                        
| 2682 | 2682 | )  | 
                                                        
| 2683 | 2683 | );  | 
                                                        
@@ -2685,7 +2685,7 @@ discard block  | 
                                                    ||
| 2685 | 2685 | |
| 2686 | 2686 | $wpdb->query(  | 
                                                        
| 2687 | 2687 | $wpdb->prepare(  | 
                                                        
| 2688 | - "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",  | 
                                                        |
| 2688 | + "UPDATE ".GEODIR_ICON_TABLE." SET json = %s WHERE post_id = %d AND cat_id = %d",  | 
                                                        |
| 2689 | 2689 | array($json, $post_obj->post_id, $term_id)  | 
                                                        
| 2690 | 2690 | )  | 
                                                        
| 2691 | 2691 | );  | 
                                                        
@@ -2809,7 +2809,7 @@ discard block  | 
                                                    ||
| 2809 | 2809 | // print_r($uploads ) ;  | 
                                                        
| 2810 | 2810 | $post_first_image = $wpdb->get_results(  | 
                                                        
| 2811 | 2811 | $wpdb->prepare(  | 
                                                        
| 2812 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1 ", array($post_id)  | 
                                                        |
| 2812 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d and menu_order = 1 ", array($post_id)  | 
                                                        |
| 2813 | 2813 | )  | 
                                                        
| 2814 | 2814 | );  | 
                                                        
| 2815 | 2815 | |
@@ -2830,9 +2830,9 @@ discard block  | 
                                                    ||
| 2830 | 2830 | |
| 2831 | 2831 | $post_type = get_post_type($post_id);  | 
                                                        
| 2832 | 2832 | |
| 2833 | - $table_name = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2833 | + $table_name = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 2834 | 2834 | |
| 2835 | -        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2835 | +        $wpdb->query("UPDATE ".$table_name." SET featured_image='".$post_first_image[0]->file."' WHERE post_id =".$post_id);
 | 
                                                        |
| 2836 | 2836 | |
| 2837 | 2837 | $new_attachment_name = basename($post_first_image[0]->file);  | 
                                                        
| 2838 | 2838 | |
@@ -2845,11 +2845,11 @@ discard block  | 
                                                    ||
| 2845 | 2845 | wp_delete_attachment($post_thumbnail_id);  | 
                                                        
| 2846 | 2846 | |
| 2847 | 2847 | }  | 
                                                        
| 2848 | - $filename = $uploads['basedir'] . $post_first_image[0]->file;  | 
                                                        |
| 2848 | + $filename = $uploads['basedir'].$post_first_image[0]->file;  | 
                                                        |
| 2849 | 2849 | |
| 2850 | 2850 | $attachment = array(  | 
                                                        
| 2851 | 2851 | 'post_mime_type' => $post_first_image[0]->mime_type,  | 
                                                        
| 2852 | - 'guid' => $uploads['baseurl'] . $post_first_image[0]->file,  | 
                                                        |
| 2852 | + 'guid' => $uploads['baseurl'].$post_first_image[0]->file,  | 
                                                        |
| 2853 | 2853 | 'post_parent' => $post_id,  | 
                                                        
| 2854 | 2854 |                  'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
 | 
                                                        
| 2855 | 2855 | 'post_content' => ''  | 
                                                        
@@ -2862,7 +2862,7 @@ discard block  | 
                                                    ||
| 2862 | 2862 | |
| 2863 | 2863 | set_post_thumbnail($post_id, $id);  | 
                                                        
| 2864 | 2864 | |
| 2865 | - require_once(ABSPATH . 'wp-admin/includes/image.php');  | 
                                                        |
| 2865 | + require_once(ABSPATH.'wp-admin/includes/image.php');  | 
                                                        |
| 2866 | 2866 | wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));  | 
                                                        
| 2867 | 2867 | |
| 2868 | 2868 | }  | 
                                                        
@@ -2895,35 +2895,35 @@ discard block  | 
                                                    ||
| 2895 | 2895 | $post_id = absint($_POST['post_id']);  | 
                                                        
| 2896 | 2896 | $upload_dir = wp_upload_dir();  | 
                                                        
| 2897 | 2897 | $post_type = get_post_type($_POST['post_id']);  | 
                                                        
| 2898 | - $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2898 | + $table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 2899 | 2899 | |
| 2900 | 2900 | $post_arr = $wpdb->get_results($wpdb->prepare(  | 
                                                        
| 2901 | - "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",  | 
                                                        |
| 2901 | + "SELECT * FROM $wpdb->posts p JOIN ".$table." gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",  | 
                                                        |
| 2902 | 2902 | array($post_id)  | 
                                                        
| 2903 | 2903 | )  | 
                                                        
| 2904 | 2904 | , ARRAY_A);  | 
                                                        
| 2905 | 2905 | |
| 2906 | 2906 | $arrImages = $wpdb->get_results(  | 
                                                        
| 2907 | 2907 | $wpdb->prepare(  | 
                                                        
| 2908 | - "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",  | 
                                                        |
| 2908 | + "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",  | 
                                                        |
| 2909 | 2909 |                  array('%image%', $post_id)
 | 
                                                        
| 2910 | 2910 | )  | 
                                                        
| 2911 | 2911 | );  | 
                                                        
| 2912 | 2912 |          if ($arrImages) {
 | 
                                                        
| 2913 | 2913 | $image_arr = array();  | 
                                                        
| 2914 | 2914 |              foreach ($arrImages as $img) {
 | 
                                                        
| 2915 | - $image_arr[] = $upload_dir['baseurl'] . $img->file;  | 
                                                        |
| 2915 | + $image_arr[] = $upload_dir['baseurl'].$img->file;  | 
                                                        |
| 2916 | 2916 | }  | 
                                                        
| 2917 | 2917 |              $comma_separated = implode(",", $image_arr);
 | 
                                                        
| 2918 | 2918 | $post_arr[0]['post_images'] = $comma_separated;  | 
                                                        
| 2919 | 2919 | }  | 
                                                        
| 2920 | 2920 | |
| 2921 | 2921 | |
| 2922 | - $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];  | 
                                                        |
| 2922 | + $cats = $post_arr[0][$post_arr[0]['post_type'].'category'];  | 
                                                        |
| 2923 | 2923 |          $cat_arr = array_filter(explode(",", $cats));
 | 
                                                        
| 2924 | 2924 | $trans_cat = array();  | 
                                                        
| 2925 | 2925 |          foreach ($cat_arr as $cat) {
 | 
                                                        
| 2926 | - $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);  | 
                                                        |
| 2926 | + $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'].'category', false);  | 
                                                        |
| 2927 | 2927 | }  | 
                                                        
| 2928 | 2928 | |
| 2929 | 2929 | |
@@ -2965,7 +2965,7 @@ discard block  | 
                                                    ||
| 2965 | 2965 | |
| 2966 | 2966 | $get_data = $wpdb->get_results(  | 
                                                        
| 2967 | 2967 | $wpdb->prepare(  | 
                                                        
| 2968 | - "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",  | 
                                                        |
| 2968 | + "SELECT htmlvar_name, field_type, extra_fields FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1'",  | 
                                                        |
| 2969 | 2969 | array($listing_type)  | 
                                                        
| 2970 | 2970 | )  | 
                                                        
| 2971 | 2971 | );  | 
                                                        
@@ -2978,12 +2978,12 @@ discard block  | 
                                                    ||
| 2978 | 2978 | |
| 2979 | 2979 | $extra_fields = unserialize($data->extra_fields);  | 
                                                        
| 2980 | 2980 | |
| 2981 | - $prefix = $data->htmlvar_name . '_';  | 
                                                        |
| 2981 | + $prefix = $data->htmlvar_name.'_';  | 
                                                        |
| 2982 | 2982 | |
| 2983 | - $fields_info[$prefix . 'address'] = $data->field_type;  | 
                                                        |
| 2983 | + $fields_info[$prefix.'address'] = $data->field_type;  | 
                                                        |
| 2984 | 2984 | |
| 2985 | 2985 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])  | 
                                                        
| 2986 | - $fields_info[$prefix . 'zip'] = $data->field_type;  | 
                                                        |
| 2986 | + $fields_info[$prefix.'zip'] = $data->field_type;  | 
                                                        |
| 2987 | 2987 | |
| 2988 | 2988 |              } else {
 | 
                                                        
| 2989 | 2989 | |
@@ -3081,13 +3081,13 @@ discard block  | 
                                                    ||
| 3081 | 3081 | * @since 1.4.9  | 
                                                        
| 3082 | 3082 | * @package GeoDirectory  | 
                                                        
| 3083 | 3083 | */  | 
                                                        
| 3084 | -function geodir_fb_like_thumbnail(){
 | 
                                                        |
| 3084 | +function geodir_fb_like_thumbnail() {
 | 
                                                        |
| 3085 | 3085 | |
| 3086 | 3086 | // return if not a single post  | 
                                                        
| 3087 | -    if(!is_single()){return;}
 | 
                                                        |
| 3087 | +    if (!is_single()) {return; }
 | 
                                                        |
| 3088 | 3088 | |
| 3089 | 3089 | global $post;  | 
                                                        
| 3090 | -    if(isset($post->featured_image) && $post->featured_image){
 | 
                                                        |
| 3090 | +    if (isset($post->featured_image) && $post->featured_image) {
 | 
                                                        |
| 3091 | 3091 | $upload_dir = wp_upload_dir();  | 
                                                        
| 3092 | 3092 | $thumb = $upload_dir['baseurl'].$post->featured_image;  | 
                                                        
| 3093 | 3093 | echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";  | 
                                                        
@@ -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)){
 | 
                                                        
@@ -372,8 +373,9 @@ discard block  | 
                                                    ||
| 372 | 373 |              } elseif (trim($type) == 'file') {
 | 
                                                        
| 373 | 374 |                  if (isset($request_info[$name])) {
 | 
                                                        
| 374 | 375 | $request_files = array();  | 
                                                        
| 375 | - if ($request_info[$name] != '')  | 
                                                        |
| 376 | -                        $request_files = explode(",", $request_info[$name]);
 | 
                                                        |
| 376 | +                    if ($request_info[$name] != '') { | 
                                                        |
| 377 | +                                            $request_files = explode(",", $request_info[$name]); | 
                                                        |
| 378 | + }  | 
                                                        |
| 377 | 379 | |
| 378 | 380 | $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;  | 
                                                        
| 379 | 381 | geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);  | 
                                                        
@@ -399,7 +401,7 @@ discard block  | 
                                                    ||
| 399 | 401 | |
| 400 | 402 |                          $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
 | 
                                                        
| 401 | 403 | |
| 402 | -                    }else{
 | 
                                                        |
| 404 | +                    } else{
 | 
                                                        |
| 403 | 405 | $post_htmlvar_value = $request_info[$name];  | 
                                                        
| 404 | 406 | }  | 
                                                        
| 405 | 407 | |
@@ -439,15 +441,17 @@ discard block  | 
                                                    ||
| 439 | 441 | |
| 440 | 442 |              foreach ($request_info['post_category'] as $taxonomy => $cat) {
 | 
                                                        
| 441 | 443 | |
| 442 | - if ($dummy)  | 
                                                        |
| 443 | - $post_category = $cat;  | 
                                                        |
| 444 | -                else {
 | 
                                                        |
| 444 | +                if ($dummy) { | 
                                                        |
| 445 | + $post_category = $cat;  | 
                                                        |
| 446 | +                } else {
 | 
                                                        |
| 445 | 447 | |
| 446 | - if (!is_array($cat) && strstr($cat, ','))  | 
                                                        |
| 447 | -                        $cat = explode(',', $cat);
 | 
                                                        |
| 448 | +                    if (!is_array($cat) && strstr($cat, ',')) { | 
                                                        |
| 449 | +                                            $cat = explode(',', $cat); | 
                                                        |
| 450 | + }  | 
                                                        |
| 448 | 451 | |
| 449 | - if (!empty($cat) && is_array($cat))  | 
                                                        |
| 450 | -                        $post_category = array_map('intval', $cat);
 | 
                                                        |
| 452 | +                    if (!empty($cat) && is_array($cat)) { | 
                                                        |
| 453 | +                                            $post_category = array_map('intval', $cat); | 
                                                        |
| 454 | + }  | 
                                                        |
| 451 | 455 | }  | 
                                                        
| 452 | 456 | |
| 453 | 457 | wp_set_object_terms($last_post_id, $post_category, $taxonomy);  | 
                                                        
@@ -465,11 +469,13 @@ discard block  | 
                                                    ||
| 465 | 469 |          if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
 | 
                                                        
| 466 | 470 |              $post_tags = explode(",", $request_info['post_tags']);
 | 
                                                        
| 467 | 471 |          } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
 | 
                                                        
| 468 | - if ($dummy)  | 
                                                        |
| 469 | - $post_tags = $request_info['post_tags'];  | 
                                                        |
| 472 | +            if ($dummy) { | 
                                                        |
| 473 | + $post_tags = $request_info['post_tags'];  | 
                                                        |
| 474 | + }  | 
                                                        |
| 470 | 475 |          } else {
 | 
                                                        
| 471 | - if ($dummy)  | 
                                                        |
| 472 | - $post_tags = array($request_info['post_title']);  | 
                                                        |
| 476 | +            if ($dummy) { | 
                                                        |
| 477 | + $post_tags = array($request_info['post_title']);  | 
                                                        |
| 478 | + }  | 
                                                        |
| 473 | 479 | }  | 
                                                        
| 474 | 480 | |
| 475 | 481 |          if (is_array($post_tags)) {
 | 
                                                        
@@ -556,15 +562,17 @@ discard block  | 
                                                    ||
| 556 | 562 | |
| 557 | 563 | global $wpdb, $plugin_prefix, $post, $post_info;  | 
                                                        
| 558 | 564 | |
| 559 | - if ($post_id == '' && !empty($post))  | 
                                                        |
| 560 | - $post_id = $post->ID;  | 
                                                        |
| 565 | +    if ($post_id == '' && !empty($post)) { | 
                                                        |
| 566 | + $post_id = $post->ID;  | 
                                                        |
| 567 | + }  | 
                                                        |
| 561 | 568 | |
| 562 | 569 | $post_type = get_post_type($post_id);  | 
                                                        
| 563 | 570 | |
| 564 | 571 | $all_postypes = geodir_get_posttypes();  | 
                                                        
| 565 | 572 | |
| 566 | - if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 567 | - return false;  | 
                                                        |
| 573 | +    if (!in_array($post_type, $all_postypes)) { | 
                                                        |
| 574 | + return false;  | 
                                                        |
| 575 | + }  | 
                                                        |
| 568 | 576 | |
| 569 | 577 | $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        
| 570 | 578 | |
@@ -714,8 +722,9 @@ discard block  | 
                                                    ||
| 714 | 722 |              do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
 | 
                                                        
| 715 | 723 | |
| 716 | 724 | return true;  | 
                                                        
| 717 | - } else  | 
                                                        |
| 718 | - return false;  | 
                                                        |
| 725 | +        } else { | 
                                                        |
| 726 | + return false;  | 
                                                        |
| 727 | + }  | 
                                                        |
| 719 | 728 | |
| 720 | 729 | }  | 
                                                        
| 721 | 730 | }  | 
                                                        
@@ -769,8 +778,9 @@ discard block  | 
                                                    ||
| 769 | 778 | }  | 
                                                        
| 770 | 779 | |
| 771 | 780 | |
| 772 | - } else  | 
                                                        |
| 773 | - return false;  | 
                                                        |
| 781 | +        } else { | 
                                                        |
| 782 | + return false;  | 
                                                        |
| 783 | + }  | 
                                                        |
| 774 | 784 | }  | 
                                                        
| 775 | 785 | }  | 
                                                        
| 776 | 786 | |
@@ -801,8 +811,9 @@ discard block  | 
                                                    ||
| 801 | 811 | $post_meta_set_query = '';  | 
                                                        
| 802 | 812 | |
| 803 | 813 |              foreach ($postmeta as $mkey) {
 | 
                                                        
| 804 | - if ($mval != '')  | 
                                                        |
| 805 | - $post_meta_set_query .= $mkey . " = '', ";  | 
                                                        |
| 814 | +                if ($mval != '') { | 
                                                        |
| 815 | + $post_meta_set_query .= $mkey . " = '', ";  | 
                                                        |
| 816 | + }  | 
                                                        |
| 806 | 817 | }  | 
                                                        
| 807 | 818 | |
| 808 | 819 | $post_meta_set_query = trim($post_meta_set_query, ", ");  | 
                                                        
@@ -832,8 +843,9 @@ discard block  | 
                                                    ||
| 832 | 843 | return true;  | 
                                                        
| 833 | 844 | }  | 
                                                        
| 834 | 845 | |
| 835 | - } else  | 
                                                        |
| 836 | - return false;  | 
                                                        |
| 846 | +        } else { | 
                                                        |
| 847 | + return false;  | 
                                                        |
| 848 | + }  | 
                                                        |
| 837 | 849 | }  | 
                                                        
| 838 | 850 | }  | 
                                                        
| 839 | 851 | |
@@ -863,8 +875,9 @@ discard block  | 
                                                    ||
| 863 | 875 | |
| 864 | 876 | $post_type = get_post_type($post_id);  | 
                                                        
| 865 | 877 | |
| 866 | - if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 867 | - return false;  | 
                                                        |
| 878 | +        if (!in_array($post_type, $all_postypes)) { | 
                                                        |
| 879 | + return false;  | 
                                                        |
| 880 | + }  | 
                                                        |
| 868 | 881 | |
| 869 | 882 | $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        
| 870 | 883 | |
@@ -873,8 +886,9 @@ discard block  | 
                                                    ||
| 873 | 886 | |
| 874 | 887 |              if ($meta_value && $meta_value !== '') {
 | 
                                                        
| 875 | 888 | return maybe_serialize($meta_value);  | 
                                                        
| 876 | - } else  | 
                                                        |
| 877 | - return $meta_value;  | 
                                                        |
| 889 | +            } else { | 
                                                        |
| 890 | + return $meta_value;  | 
                                                        |
| 891 | + }  | 
                                                        |
| 878 | 892 |          } else {
 | 
                                                        
| 879 | 893 | return false;  | 
                                                        
| 880 | 894 | }  | 
                                                        
@@ -1008,7 +1022,7 @@ discard block  | 
                                                    ||
| 1008 | 1022 |                              if (isset($uploaded['error']) && empty($uploaded['error'])) {
 | 
                                                        
| 1009 | 1023 | $new_name = basename($uploaded['file']);  | 
                                                        
| 1010 | 1024 | $uploaded_file = $uploaded;  | 
                                                        
| 1011 | -                            }else{
 | 
                                                        |
| 1025 | +                            } else{
 | 
                                                        |
| 1012 | 1026 | print_r($uploaded);exit;  | 
                                                        
| 1013 | 1027 | }  | 
                                                        
| 1014 | 1028 | $external_img = false;  | 
                                                        
@@ -1033,8 +1047,9 @@ discard block  | 
                                                    ||
| 1033 | 1047 | $file_path = $curr_img_dir . '/' . $filename;  | 
                                                        
| 1034 | 1048 | }  | 
                                                        
| 1035 | 1049 | |
| 1036 | - if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))  | 
                                                        |
| 1037 | - unlink($img_path);  | 
                                                        |
| 1050 | +                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) { | 
                                                        |
| 1051 | + unlink($img_path);  | 
                                                        |
| 1052 | + }  | 
                                                        |
| 1038 | 1053 | }  | 
                                                        
| 1039 | 1054 | |
| 1040 | 1055 |                          if (!empty($uploaded_file)) {
 | 
                                                        
@@ -1063,8 +1078,9 @@ discard block  | 
                                                    ||
| 1063 | 1078 | $attachment_set = '';  | 
                                                        
| 1064 | 1079 | |
| 1065 | 1080 |                              foreach ($attachment as $key => $val) {
 | 
                                                        
| 1066 | - if ($val != '')  | 
                                                        |
| 1067 | - $attachment_set .= $key . " = '" . $val . "', ";  | 
                                                        |
| 1081 | +                                if ($val != '') { | 
                                                        |
| 1082 | + $attachment_set .= $key . " = '" . $val . "', ";  | 
                                                        |
| 1083 | + }  | 
                                                        |
| 1068 | 1084 | }  | 
                                                        
| 1069 | 1085 | |
| 1070 | 1086 | $attachment_set = trim($attachment_set, ", ");  | 
                                                        
@@ -1089,8 +1105,9 @@ discard block  | 
                                                    ||
| 1089 | 1105 | )  | 
                                                        
| 1090 | 1106 | );  | 
                                                        
| 1091 | 1107 | |
| 1092 | - if ($menu_order == 1)  | 
                                                        |
| 1093 | -                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
 | 
                                                        |
| 1108 | +                    if ($menu_order == 1) { | 
                                                        |
| 1109 | +                                            $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id))); | 
                                                        |
| 1110 | + }  | 
                                                        |
| 1094 | 1111 | |
| 1095 | 1112 | }  | 
                                                        
| 1096 | 1113 | |
@@ -1131,8 +1148,9 @@ discard block  | 
                                                    ||
| 1131 | 1148 | |
| 1132 | 1149 |          $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
 | 
                                                        
| 1133 | 1150 | |
| 1134 | - if (!empty($invalid_files))  | 
                                                        |
| 1135 | - geodir_remove_attachments($invalid_files);  | 
                                                        |
| 1151 | +        if (!empty($invalid_files)) { | 
                                                        |
| 1152 | + geodir_remove_attachments($invalid_files);  | 
                                                        |
| 1153 | + }  | 
                                                        |
| 1136 | 1154 | }  | 
                                                        
| 1137 | 1155 | |
| 1138 | 1156 | }  | 
                                                        
@@ -1185,16 +1203,19 @@ discard block  | 
                                                    ||
| 1185 | 1203 | function geodir_delete_directory($dirname)  | 
                                                        
| 1186 | 1204 |  {
 | 
                                                        
| 1187 | 1205 | $dir_handle = '';  | 
                                                        
| 1188 | - if (is_dir($dirname))  | 
                                                        |
| 1189 | - $dir_handle = opendir($dirname);  | 
                                                        |
| 1190 | - if (!$dir_handle)  | 
                                                        |
| 1191 | - return false;  | 
                                                        |
| 1206 | +    if (is_dir($dirname)) { | 
                                                        |
| 1207 | + $dir_handle = opendir($dirname);  | 
                                                        |
| 1208 | + }  | 
                                                        |
| 1209 | +    if (!$dir_handle) { | 
                                                        |
| 1210 | + return false;  | 
                                                        |
| 1211 | + }  | 
                                                        |
| 1192 | 1212 |      while ($file = readdir($dir_handle)) {
 | 
                                                        
| 1193 | 1213 |          if ($file != "." && $file != "..") {
 | 
                                                        
| 1194 | - if (!is_dir($dirname . "/" . $file))  | 
                                                        |
| 1195 | - unlink($dirname . "/" . $file);  | 
                                                        |
| 1196 | - else  | 
                                                        |
| 1197 | - geodir_delete_directory($dirname . '/' . $file);  | 
                                                        |
| 1214 | +            if (!is_dir($dirname . "/" . $file)) { | 
                                                        |
| 1215 | + unlink($dirname . "/" . $file);  | 
                                                        |
| 1216 | +            } else { | 
                                                        |
| 1217 | + geodir_delete_directory($dirname . '/' . $file);  | 
                                                        |
| 1218 | + }  | 
                                                        |
| 1198 | 1219 | }  | 
                                                        
| 1199 | 1220 | }  | 
                                                        
| 1200 | 1221 | closedir($dir_handle);  | 
                                                        
@@ -1223,8 +1244,9 @@ discard block  | 
                                                    ||
| 1223 | 1244 |              foreach ($postcurr_images as $postimg) {
 | 
                                                        
| 1224 | 1245 |                  $image_name_arr = explode('/', $postimg->src);
 | 
                                                        
| 1225 | 1246 | $filename = end($image_name_arr);  | 
                                                        
| 1226 | - if (file_exists($uploads_dir . '/' . $filename))  | 
                                                        |
| 1227 | - unlink($uploads_dir . '/' . $filename);  | 
                                                        |
| 1247 | +                if (file_exists($uploads_dir . '/' . $filename)) { | 
                                                        |
| 1248 | + unlink($uploads_dir . '/' . $filename);  | 
                                                        |
| 1249 | + }  | 
                                                        |
| 1228 | 1250 | }  | 
                                                        
| 1229 | 1251 | |
| 1230 | 1252 | } // endif  | 
                                                        
@@ -1283,8 +1305,9 @@ discard block  | 
                                                    ||
| 1283 | 1305 | |
| 1284 | 1306 | $file_info = pathinfo($file);  | 
                                                        
| 1285 | 1307 | $sub_dir = '';  | 
                                                        
| 1286 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 1287 | - $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 1308 | +            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { | 
                                                        |
| 1309 | + $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 1310 | + }  | 
                                                        |
| 1288 | 1311 | |
| 1289 | 1312 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        
| 1290 | 1313 | $uploads_baseurl = $uploads['baseurl'];  | 
                                                        
@@ -1328,9 +1351,9 @@ discard block  | 
                                                    ||
| 1328 | 1351 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        
| 1329 | 1352 | }  | 
                                                        
| 1330 | 1353 | |
| 1331 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))  | 
                                                        |
| 1332 | - $default_img = $default_catimg['src'];  | 
                                                        |
| 1333 | -            elseif ($no_image) {
 | 
                                                        |
| 1354 | +            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { | 
                                                        |
| 1355 | + $default_img = $default_catimg['src'];  | 
                                                        |
| 1356 | +            } elseif ($no_image) {
 | 
                                                        |
| 1334 | 1357 |                  $default_img = get_option('geodir_listing_no_img');
 | 
                                                        
| 1335 | 1358 | }  | 
                                                        
| 1336 | 1359 | |
@@ -1362,10 +1385,13 @@ discard block  | 
                                                    ||
| 1362 | 1385 | }  | 
                                                        
| 1363 | 1386 | }  | 
                                                        
| 1364 | 1387 | |
| 1365 | - if (!empty($img_arr))  | 
                                                        |
| 1366 | - return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );  | 
                                                        |
| 1367 | - else  | 
                                                        |
| 1368 | - return false;  | 
                                                        |
| 1388 | +        if (!empty($img_arr)) { | 
                                                        |
| 1389 | + return (object)$img_arr;  | 
                                                        |
| 1390 | + }  | 
                                                        |
| 1391 | + //return (object)array( 'src' => $file_url, 'path' => $file_path );  | 
                                                        |
| 1392 | +        else { | 
                                                        |
| 1393 | + return false;  | 
                                                        |
| 1394 | + }  | 
                                                        |
| 1369 | 1395 | }  | 
                                                        
| 1370 | 1396 | }  | 
                                                        
| 1371 | 1397 | |
@@ -1392,8 +1418,9 @@ discard block  | 
                                                    ||
| 1392 | 1418 | echo $html;  | 
                                                        
| 1393 | 1419 |          } elseif (!empty($html)) {
 | 
                                                        
| 1394 | 1420 | return $html;  | 
                                                        
| 1395 | - } else  | 
                                                        |
| 1396 | - return false;  | 
                                                        |
| 1421 | +        } else { | 
                                                        |
| 1422 | + return false;  | 
                                                        |
| 1423 | + }  | 
                                                        |
| 1397 | 1424 | }  | 
                                                        
| 1398 | 1425 | }  | 
                                                        
| 1399 | 1426 | |
@@ -1421,8 +1448,9 @@ discard block  | 
                                                    ||
| 1421 | 1448 | }  | 
                                                        
| 1422 | 1449 | $not_featured = '';  | 
                                                        
| 1423 | 1450 | $sub_dir = '';  | 
                                                        
| 1424 | - if (!$add_featured)  | 
                                                        |
| 1425 | - $not_featured = " AND is_featured = 0 ";  | 
                                                        |
| 1451 | +        if (!$add_featured) { | 
                                                        |
| 1452 | + $not_featured = " AND is_featured = 0 ";  | 
                                                        |
| 1453 | + }  | 
                                                        |
| 1426 | 1454 | |
| 1427 | 1455 | $arrImages = $wpdb->get_results(  | 
                                                        
| 1428 | 1456 | $wpdb->prepare(  | 
                                                        
@@ -1443,8 +1471,9 @@ discard block  | 
                                                    ||
| 1443 | 1471 | |
| 1444 | 1472 | $file_info = pathinfo($attechment->file);  | 
                                                        
| 1445 | 1473 | |
| 1446 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 1447 | - $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 1474 | +                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { | 
                                                        |
| 1475 | + $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 1476 | + }  | 
                                                        |
| 1448 | 1477 | |
| 1449 | 1478 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        
| 1450 | 1479 | $uploads_baseurl = $uploads['baseurl'];  | 
                                                        
@@ -1489,9 +1518,9 @@ discard block  | 
                                                    ||
| 1489 | 1518 | $default_img = '';  | 
                                                        
| 1490 | 1519 | $default_cat = geodir_get_post_meta($post_id, 'default_category', true);  | 
                                                        
| 1491 | 1520 | $post_type = get_post_type($post_id);  | 
                                                        
| 1492 | - if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))  | 
                                                        |
| 1493 | - $default_img = $default_catimg['src'];  | 
                                                        |
| 1494 | -            elseif ($no_images) {
 | 
                                                        |
| 1521 | +            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) { | 
                                                        |
| 1522 | + $default_img = $default_catimg['src'];  | 
                                                        |
| 1523 | +            } elseif ($no_images) {
 | 
                                                        |
| 1495 | 1524 |                  $default_img = get_option('geodir_listing_no_img');
 | 
                                                        
| 1496 | 1525 | }  | 
                                                        
| 1497 | 1526 | |
@@ -1526,8 +1555,9 @@ discard block  | 
                                                    ||
| 1526 | 1555 | $return_arr[] = (object)$img_arr;  | 
                                                        
| 1527 | 1556 | |
| 1528 | 1557 | return $return_arr;  | 
                                                        
| 1529 | - } else  | 
                                                        |
| 1530 | - return false;  | 
                                                        |
| 1558 | +            } else { | 
                                                        |
| 1559 | + return false;  | 
                                                        |
| 1560 | + }  | 
                                                        |
| 1531 | 1561 | }  | 
                                                        
| 1532 | 1562 | }  | 
                                                        
| 1533 | 1563 | }  | 
                                                        
@@ -1588,8 +1618,9 @@ discard block  | 
                                                    ||
| 1588 | 1618 | $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);  | 
                                                        
| 1589 | 1619 |                      } else if ($image->width < ($max_size->h)) {
 | 
                                                        
| 1590 | 1620 | $width_per = round((($image->width / $max_size->w) * 100), 2);  | 
                                                        
| 1591 | - } else  | 
                                                        |
| 1592 | - $width_per = 100;  | 
                                                        |
| 1621 | +                    } else { | 
                                                        |
| 1622 | + $width_per = 100;  | 
                                                        |
| 1623 | + }  | 
                                                        |
| 1593 | 1624 | }  | 
                                                        
| 1594 | 1625 | |
| 1595 | 1626 |                  if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
 | 
                                                        
@@ -1597,7 +1628,7 @@ discard block  | 
                                                    ||
| 1597 | 1628 |                  } else {
 | 
                                                        
| 1598 | 1629 |                      if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
 | 
                                                        
| 1599 | 1630 | $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';  | 
                                                        
| 1600 | -                    }else{
 | 
                                                        |
| 1631 | +                    } else{
 | 
                                                        |
| 1601 | 1632 | //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';  | 
                                                        
| 1602 | 1633 | //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';  | 
                                                        
| 1603 | 1634 | $html = '<div data-src="'.$image->src.'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';  | 
                                                        
@@ -1612,8 +1643,9 @@ discard block  | 
                                                    ||
| 1612 | 1643 | echo $html;  | 
                                                        
| 1613 | 1644 |          } elseif (!empty($html)) {
 | 
                                                        
| 1614 | 1645 | return $html;  | 
                                                        
| 1615 | - } else  | 
                                                        |
| 1616 | - return false;  | 
                                                        |
| 1646 | +        } else { | 
                                                        |
| 1647 | + return false;  | 
                                                        |
| 1648 | + }  | 
                                                        |
| 1617 | 1649 | }  | 
                                                        
| 1618 | 1650 | }  | 
                                                        
| 1619 | 1651 | |
@@ -1651,8 +1683,9 @@ discard block  | 
                                                    ||
| 1651 | 1683 | $post_obj = get_post($post_id);  | 
                                                        
| 1652 | 1684 | |
| 1653 | 1685 |                  $cat_ids = array('0');
 | 
                                                        
| 1654 | - if (is_array($tt_ids))  | 
                                                        |
| 1655 | - $cat_ids = $tt_ids;  | 
                                                        |
| 1686 | +                if (is_array($tt_ids)) { | 
                                                        |
| 1687 | + $cat_ids = $tt_ids;  | 
                                                        |
| 1688 | + }  | 
                                                        |
| 1656 | 1689 | |
| 1657 | 1690 | |
| 1658 | 1691 |                  if (!empty($cat_ids)) {
 | 
                                                        
@@ -1709,8 +1742,9 @@ discard block  | 
                                                    ||
| 1709 | 1742 | $json .= '}';  | 
                                                        
| 1710 | 1743 | |
| 1711 | 1744 | |
| 1712 | - if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))  | 
                                                        |
| 1713 | - $post_marker_json = $json;  | 
                                                        |
| 1745 | +                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) { | 
                                                        |
| 1746 | + $post_marker_json = $json;  | 
                                                        |
| 1747 | + }  | 
                                                        |
| 1714 | 1748 | |
| 1715 | 1749 | |
| 1716 | 1750 |                          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)))) {
 | 
                                                        
@@ -1741,10 +1775,13 @@ discard block  | 
                                                    ||
| 1741 | 1775 |                  if (!empty($post_term) && is_array($post_term)) {
 | 
                                                        
| 1742 | 1776 |                      $categories = implode(',', $post_term);
 | 
                                                        
| 1743 | 1777 | |
| 1744 | - if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';  | 
                                                        |
| 1778 | +                    if ($categories != '' && $categories != 0) { | 
                                                        |
| 1779 | + $categories = ',' . $categories . ',';  | 
                                                        |
| 1780 | + }  | 
                                                        |
| 1745 | 1781 | |
| 1746 | - if (empty($post_marker_json))  | 
                                                        |
| 1747 | - $post_marker_json = isset($json) ? $json : '';  | 
                                                        |
| 1782 | +                    if (empty($post_marker_json)) { | 
                                                        |
| 1783 | + $post_marker_json = isset($json) ? $json : '';  | 
                                                        |
| 1784 | + }  | 
                                                        |
| 1748 | 1785 | |
| 1749 | 1786 |                      if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
 | 
                                                        
| 1750 | 1787 | |
@@ -1783,8 +1820,9 @@ discard block  | 
                                                    ||
| 1783 | 1820 | |
| 1784 | 1821 | }  | 
                                                        
| 1785 | 1822 | |
| 1786 | - if ($default_category == '')  | 
                                                        |
| 1787 | - $default_category = $categories[0];  | 
                                                        |
| 1823 | +                                if ($default_category == '') { | 
                                                        |
| 1824 | + $default_category = $categories[0];  | 
                                                        |
| 1825 | + }  | 
                                                        |
| 1788 | 1826 | |
| 1789 | 1827 | geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');  | 
                                                        
| 1790 | 1828 | |
@@ -1928,7 +1966,7 @@ discard block  | 
                                                    ||
| 1928 | 1966 | } ?>"><img alt="bubble image" style="max-height:50px;"  | 
                                                        
| 1929 | 1967 | src="<?php echo $post_images[0]; ?>"/></a></div>  | 
                                                        
| 1930 | 1968 | <?php  | 
                                                        
| 1931 | -                            }else{
 | 
                                                        |
| 1969 | +                            } else{
 | 
                                                        |
| 1932 | 1970 | echo '<div class="geodir-bubble_image"></div>';  | 
                                                        
| 1933 | 1971 | }  | 
                                                        
| 1934 | 1972 |                          } else {
 | 
                                                        
@@ -1936,7 +1974,7 @@ discard block  | 
                                                    ||
| 1936 | 1974 | ?>  | 
                                                        
| 1937 | 1975 | <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>  | 
                                                        
| 1938 | 1976 | <?php  | 
                                                        
| 1939 | -                            }else{
 | 
                                                        |
| 1977 | +                            } else{
 | 
                                                        |
| 1940 | 1978 | echo '<div class="geodir-bubble_image"></div>';  | 
                                                        
| 1941 | 1979 | }  | 
                                                        
| 1942 | 1980 | }  | 
                                                        
@@ -2038,10 +2076,11 @@ discard block  | 
                                                    ||
| 2038 | 2076 | */  | 
                                                        
| 2039 | 2077 | function geodir_new_post_default_status()  | 
                                                        
| 2040 | 2078 |      {
 | 
                                                        
| 2041 | -        if (get_option('geodir_new_post_default_status'))
 | 
                                                        |
| 2042 | -            return get_option('geodir_new_post_default_status');
 | 
                                                        |
| 2043 | - else  | 
                                                        |
| 2044 | - return 'publish';  | 
                                                        |
| 2079 | +        if (get_option('geodir_new_post_default_status')) { | 
                                                        |
| 2080 | +                    return get_option('geodir_new_post_default_status'); | 
                                                        |
| 2081 | +        } else { | 
                                                        |
| 2082 | + return 'publish';  | 
                                                        |
| 2083 | + }  | 
                                                        |
| 2045 | 2084 | |
| 2046 | 2085 | }  | 
                                                        
| 2047 | 2086 | }  | 
                                                        
@@ -2192,8 +2231,9 @@ discard block  | 
                                                    ||
| 2192 | 2231 | |
| 2193 | 2232 | $all_postypes = geodir_get_posttypes();  | 
                                                        
| 2194 | 2233 | |
| 2195 | - if (!in_array($post_type, $all_postypes))  | 
                                                        |
| 2196 | - return false;  | 
                                                        |
| 2234 | +        if (!in_array($post_type, $all_postypes)) { | 
                                                        |
| 2235 | + return false;  | 
                                                        |
| 2236 | + }  | 
                                                        |
| 2197 | 2237 | |
| 2198 | 2238 | $table = $plugin_prefix . $post_type . '_detail';  | 
                                                        
| 2199 | 2239 | |
@@ -2461,8 +2501,9 @@ discard block  | 
                                                    ||
| 2461 | 2501 |          $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
 | 
                                                        
| 2462 | 2502 | |
| 2463 | 2503 | $user_meta_data = '';  | 
                                                        
| 2464 | - if (isset($current_user->data->ID))  | 
                                                        |
| 2465 | - $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        |
| 2504 | +        if (isset($current_user->data->ID)) { | 
                                                        |
| 2505 | + $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);  | 
                                                        |
| 2506 | + }  | 
                                                        |
| 2466 | 2507 | |
| 2467 | 2508 |          if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
 | 
                                                        
| 2468 | 2509 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>" ><a  | 
                                                        
@@ -2475,8 +2516,9 @@ discard block  | 
                                                    ||
| 2475 | 2516 | |
| 2476 | 2517 |              if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
 | 
                                                        
| 2477 | 2518 | $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';  | 
                                                        
| 2478 | - } else  | 
                                                        |
| 2479 | -                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
 | 
                                                        |
| 2519 | +            } else { | 
                                                        |
| 2520 | +                            $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')'; | 
                                                        |
| 2521 | + }  | 
                                                        |
| 2480 | 2522 | |
| 2481 | 2523 | ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"  | 
                                                        
| 2482 | 2524 | href="javascript:void(0);"  | 
                                                        
@@ -2539,14 +2581,16 @@ discard block  | 
                                                    ||
| 2539 | 2581 |  							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
 | 
                                                        
| 2540 | 2582 | |
| 2541 | 2583 | $cat_post_count = $wpdb->get_var($count_query);  | 
                                                        
| 2542 | - if (empty($cat_post_count) || is_wp_error($cat_post_count))  | 
                                                        |
| 2543 | - $cat_post_count = 0;  | 
                                                        |
| 2584 | +            if (empty($cat_post_count) || is_wp_error($cat_post_count)) { | 
                                                        |
| 2585 | + $cat_post_count = 0;  | 
                                                        |
| 2586 | + }  | 
                                                        |
| 2544 | 2587 | |
| 2545 | 2588 | return $cat_post_count;  | 
                                                        
| 2546 | 2589 | |
| 2547 | - } else  | 
                                                        |
| 2548 | -  | 
                                                        |
| 2549 | - return $term->count;  | 
                                                        |
| 2590 | +        } else { | 
                                                        |
| 2591 | +  | 
                                                        |
| 2592 | + return $term->count;  | 
                                                        |
| 2593 | + }  | 
                                                        |
| 2550 | 2594 | }  | 
                                                        
| 2551 | 2595 | return false;  | 
                                                        
| 2552 | 2596 | |
@@ -2593,13 +2637,15 @@ discard block  | 
                                                    ||
| 2593 | 2637 | return $length;  | 
                                                        
| 2594 | 2638 | }  | 
                                                        
| 2595 | 2639 | |
| 2596 | -    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
 | 
                                                        |
| 2597 | -        $length = get_option('geodir_desc_word_limit');
 | 
                                                        |
| 2598 | -    elseif (get_query_var('excerpt_length'))
 | 
                                                        |
| 2599 | -        $length = get_query_var('excerpt_length');
 | 
                                                        |
| 2640 | +    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) { | 
                                                        |
| 2641 | +            $length = get_option('geodir_desc_word_limit'); | 
                                                        |
| 2642 | +    } elseif (get_query_var('excerpt_length')) { | 
                                                        |
| 2643 | +            $length = get_query_var('excerpt_length'); | 
                                                        |
| 2644 | + }  | 
                                                        |
| 2600 | 2645 | |
| 2601 | -    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
 | 
                                                        |
| 2602 | -        $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 | + }  | 
                                                        |
| 2603 | 2649 | |
| 2604 | 2650 | return $length;  | 
                                                        
| 2605 | 2651 | }  | 
                                                        
@@ -2732,10 +2778,11 @@ discard block  | 
                                                    ||
| 2732 | 2778 | function geodir_lisiting_belong_to_user($listing_id, $user_id)  | 
                                                        
| 2733 | 2779 |  {
 | 
                                                        
| 2734 | 2780 | $listing_author_id = geodir_get_listing_author($listing_id);  | 
                                                        
| 2735 | - if ($listing_author_id == $user_id)  | 
                                                        |
| 2736 | - return true;  | 
                                                        |
| 2737 | - else  | 
                                                        |
| 2738 | - return false;  | 
                                                        |
| 2781 | +    if ($listing_author_id == $user_id) { | 
                                                        |
| 2782 | + return true;  | 
                                                        |
| 2783 | +    } else { | 
                                                        |
| 2784 | + return false;  | 
                                                        |
| 2785 | + }  | 
                                                        |
| 2739 | 2786 | |
| 2740 | 2787 | }  | 
                                                        
| 2741 | 2788 | |
@@ -2784,10 +2831,11 @@ discard block  | 
                                                    ||
| 2784 | 2831 | $pattern = '/-\d+x\d+\./';  | 
                                                        
| 2785 | 2832 | preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);  | 
                                                        
| 2786 | 2833 | |
| 2787 | - if (empty($matches))  | 
                                                        |
| 2788 | - return '';  | 
                                                        |
| 2789 | - else  | 
                                                        |
| 2790 | - return $file;  | 
                                                        |
| 2834 | +    if (empty($matches)) { | 
                                                        |
| 2835 | + return '';  | 
                                                        |
| 2836 | +    } else { | 
                                                        |
| 2837 | + return $file;  | 
                                                        |
| 2838 | + }  | 
                                                        |
| 2791 | 2839 | |
| 2792 | 2840 | }  | 
                                                        
| 2793 | 2841 | |
@@ -2872,8 +2920,9 @@ discard block  | 
                                                    ||
| 2872 | 2920 |      } else {
 | 
                                                        
| 2873 | 2921 | //set_post_thumbnail($post_id,-1);  | 
                                                        
| 2874 | 2922 | |
| 2875 | - if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))  | 
                                                        |
| 2876 | - wp_delete_attachment($post_thumbnail_id);  | 
                                                        |
| 2923 | +        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) { | 
                                                        |
| 2924 | + wp_delete_attachment($post_thumbnail_id);  | 
                                                        |
| 2925 | + }  | 
                                                        |
| 2877 | 2926 | |
| 2878 | 2927 | }  | 
                                                        
| 2879 | 2928 | }  | 
                                                        
@@ -2958,8 +3007,9 @@ discard block  | 
                                                    ||
| 2958 | 3007 | |
| 2959 | 3008 | global $wpdb;  | 
                                                        
| 2960 | 3009 | |
| 2961 | - if ($listing_type == '')  | 
                                                        |
| 2962 | - $listing_type = 'gd_place';  | 
                                                        |
| 3010 | +    if ($listing_type == '') { | 
                                                        |
| 3011 | + $listing_type = 'gd_place';  | 
                                                        |
| 3012 | + }  | 
                                                        |
| 2963 | 3013 | |
| 2964 | 3014 | $fields_info = array();  | 
                                                        
| 2965 | 3015 | |
@@ -2982,8 +3032,9 @@ discard block  | 
                                                    ||
| 2982 | 3032 | |
| 2983 | 3033 | $fields_info[$prefix . 'address'] = $data->field_type;  | 
                                                        
| 2984 | 3034 | |
| 2985 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])  | 
                                                        |
| 2986 | - $fields_info[$prefix . 'zip'] = $data->field_type;  | 
                                                        |
| 3035 | +                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { | 
                                                        |
| 3036 | + $fields_info[$prefix . 'zip'] = $data->field_type;  | 
                                                        |
| 3037 | + }  | 
                                                        |
| 2987 | 3038 | |
| 2988 | 3039 |              } else {
 | 
                                                        
| 2989 | 3040 | |
@@ -14,13 +14,13 @@ discard block  | 
                                                    ||
| 14 | 14 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 15 | 15 | */  | 
                                                        
| 16 | 16 |  function geodir_add_listing_page_id(){ | 
                                                        
| 17 | -    $gd_page_id = get_option('geodir_add_listing_page'); | 
                                                        |
| 17 | +	$gd_page_id = get_option('geodir_add_listing_page'); | 
                                                        |
| 18 | 18 | |
| 19 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 21 | - }  | 
                                                        |
| 19 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 21 | + }  | 
                                                        |
| 22 | 22 | |
| 23 | - return $gd_page_id;  | 
                                                        |
| 23 | + return $gd_page_id;  | 
                                                        |
| 24 | 24 | }  | 
                                                        
| 25 | 25 | |
| 26 | 26 | /**  | 
                                                        
@@ -31,13 +31,13 @@ discard block  | 
                                                    ||
| 31 | 31 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 32 | 32 | */  | 
                                                        
| 33 | 33 |  function geodir_preview_page_id(){ | 
                                                        
| 34 | -    $gd_page_id = get_option('geodir_preview_page'); | 
                                                        |
| 34 | +	$gd_page_id = get_option('geodir_preview_page'); | 
                                                        |
| 35 | 35 | |
| 36 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 38 | - }  | 
                                                        |
| 36 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - return $gd_page_id;  | 
                                                        |
| 40 | + return $gd_page_id;  | 
                                                        |
| 41 | 41 | }  | 
                                                        
| 42 | 42 | |
| 43 | 43 | /**  | 
                                                        
@@ -48,13 +48,13 @@ discard block  | 
                                                    ||
| 48 | 48 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 49 | 49 | */  | 
                                                        
| 50 | 50 |  function geodir_success_page_id(){ | 
                                                        
| 51 | -    $gd_page_id = get_option('geodir_success_page'); | 
                                                        |
| 51 | +	$gd_page_id = get_option('geodir_success_page'); | 
                                                        |
| 52 | 52 | |
| 53 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 55 | - }  | 
                                                        |
| 53 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 55 | + }  | 
                                                        |
| 56 | 56 | |
| 57 | - return $gd_page_id;  | 
                                                        |
| 57 | + return $gd_page_id;  | 
                                                        |
| 58 | 58 | }  | 
                                                        
| 59 | 59 | |
| 60 | 60 | /**  | 
                                                        
@@ -65,13 +65,13 @@ discard block  | 
                                                    ||
| 65 | 65 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 66 | 66 | */  | 
                                                        
| 67 | 67 |  function geodir_location_page_id(){ | 
                                                        
| 68 | -    $gd_page_id = get_option('geodir_location_page'); | 
                                                        |
| 68 | +	$gd_page_id = get_option('geodir_location_page'); | 
                                                        |
| 69 | 69 | |
| 70 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 72 | - }  | 
                                                        |
| 70 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | 73 | |
| 74 | - return $gd_page_id;  | 
                                                        |
| 74 | + return $gd_page_id;  | 
                                                        |
| 75 | 75 | }  | 
                                                        
| 76 | 76 | |
| 77 | 77 | /**  | 
                                                        
@@ -82,13 +82,13 @@ discard block  | 
                                                    ||
| 82 | 82 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 83 | 83 | */  | 
                                                        
| 84 | 84 |  function geodir_home_page_id(){ | 
                                                        
| 85 | -    $gd_page_id = get_option('geodir_home_page'); | 
                                                        |
| 85 | +	$gd_page_id = get_option('geodir_home_page'); | 
                                                        |
| 86 | 86 | |
| 87 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 89 | - }  | 
                                                        |
| 87 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 89 | + }  | 
                                                        |
| 90 | 90 | |
| 91 | - return $gd_page_id;  | 
                                                        |
| 91 | + return $gd_page_id;  | 
                                                        |
| 92 | 92 | }  | 
                                                        
| 93 | 93 | |
| 94 | 94 | /**  | 
                                                        
@@ -99,13 +99,13 @@ discard block  | 
                                                    ||
| 99 | 99 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 100 | 100 | */  | 
                                                        
| 101 | 101 |  function geodir_info_page_id(){ | 
                                                        
| 102 | -    $gd_page_id = get_option('geodir_info_page'); | 
                                                        |
| 102 | +	$gd_page_id = get_option('geodir_info_page'); | 
                                                        |
| 103 | 103 | |
| 104 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 106 | - }  | 
                                                        |
| 104 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 106 | + }  | 
                                                        |
| 107 | 107 | |
| 108 | - return $gd_page_id;  | 
                                                        |
| 108 | + return $gd_page_id;  | 
                                                        |
| 109 | 109 | }  | 
                                                        
| 110 | 110 | |
| 111 | 111 | /**  | 
                                                        
@@ -116,13 +116,13 @@ discard block  | 
                                                    ||
| 116 | 116 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 117 | 117 | */  | 
                                                        
| 118 | 118 |  function geodir_login_page_id(){ | 
                                                        
| 119 | -    $gd_page_id = get_option('geodir_login_page'); | 
                                                        |
| 119 | +	$gd_page_id = get_option('geodir_login_page'); | 
                                                        |
| 120 | 120 | |
| 121 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 123 | - }  | 
                                                        |
| 121 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 123 | + }  | 
                                                        |
| 124 | 124 | |
| 125 | - return $gd_page_id;  | 
                                                        |
| 125 | + return $gd_page_id;  | 
                                                        |
| 126 | 126 | }  | 
                                                        
| 127 | 127 | |
| 128 | 128 | |
@@ -134,45 +134,45 @@ discard block  | 
                                                    ||
| 134 | 134 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 135 | 135 | */  | 
                                                        
| 136 | 136 |  function geodir_login_url($args=array()){ | 
                                                        
| 137 | -    $gd_page_id = get_option('geodir_login_page'); | 
                                                        |
| 138 | -  | 
                                                        |
| 139 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 141 | - }  | 
                                                        |
| 142 | -  | 
                                                        |
| 143 | -    if (function_exists('geodir_location_geo_home_link')) { | 
                                                        |
| 144 | -        remove_filter('home_url', 'geodir_location_geo_home_link', 100000); | 
                                                        |
| 145 | - }  | 
                                                        |
| 146 | - $home_url = get_home_url();  | 
                                                        |
| 147 | -    if (function_exists('geodir_location_geo_home_link')) { | 
                                                        |
| 148 | -        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); | 
                                                        |
| 149 | - }  | 
                                                        |
| 150 | -  | 
                                                        |
| 151 | -    if($gd_page_id){ | 
                                                        |
| 152 | - $post = get_post($gd_page_id);  | 
                                                        |
| 153 | - $slug = $post->post_name;  | 
                                                        |
| 154 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors  | 
                                                        |
| 155 | - $login_url = trailingslashit($home_url)."$slug/";  | 
                                                        |
| 156 | -    }else{ | 
                                                        |
| 157 | - $login_url = trailingslashit($home_url)."?geodir_signup=true";  | 
                                                        |
| 158 | - }  | 
                                                        |
| 159 | -  | 
                                                        |
| 160 | -    if($args){ | 
                                                        |
| 161 | - $login_url = add_query_arg($args,$login_url );  | 
                                                        |
| 162 | - }  | 
                                                        |
| 163 | -  | 
                                                        |
| 164 | - /**  | 
                                                        |
| 165 | - * Filter the GeoDirectory login page url.  | 
                                                        |
| 166 | - *  | 
                                                        |
| 167 | - * This filter can be used to change the GeoDirectory page url.  | 
                                                        |
| 168 | - *  | 
                                                        |
| 169 | - * @since 1.5.3  | 
                                                        |
| 170 | - * @package GeoDirectory  | 
                                                        |
| 171 | - * @param string $login_url The url of the login page.  | 
                                                        |
| 172 | - * @param array $args The array of query args used.  | 
                                                        |
| 173 | - * @param int $gd_page_id The page id of the GD login page.  | 
                                                        |
| 174 | - */  | 
                                                        |
| 175 | -    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); | 
                                                        |
| 137 | +	$gd_page_id = get_option('geodir_login_page'); | 
                                                        |
| 138 | +  | 
                                                        |
| 139 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 141 | + }  | 
                                                        |
| 142 | +  | 
                                                        |
| 143 | +	if (function_exists('geodir_location_geo_home_link')) { | 
                                                        |
| 144 | +		remove_filter('home_url', 'geodir_location_geo_home_link', 100000); | 
                                                        |
| 145 | + }  | 
                                                        |
| 146 | + $home_url = get_home_url();  | 
                                                        |
| 147 | +	if (function_exists('geodir_location_geo_home_link')) { | 
                                                        |
| 148 | +		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); | 
                                                        |
| 149 | + }  | 
                                                        |
| 150 | +  | 
                                                        |
| 151 | +	if($gd_page_id){ | 
                                                        |
| 152 | + $post = get_post($gd_page_id);  | 
                                                        |
| 153 | + $slug = $post->post_name;  | 
                                                        |
| 154 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors  | 
                                                        |
| 155 | + $login_url = trailingslashit($home_url)."$slug/";  | 
                                                        |
| 156 | +	}else{ | 
                                                        |
| 157 | + $login_url = trailingslashit($home_url)."?geodir_signup=true";  | 
                                                        |
| 158 | + }  | 
                                                        |
| 159 | +  | 
                                                        |
| 160 | +	if($args){ | 
                                                        |
| 161 | + $login_url = add_query_arg($args,$login_url );  | 
                                                        |
| 162 | + }  | 
                                                        |
| 163 | +  | 
                                                        |
| 164 | + /**  | 
                                                        |
| 165 | + * Filter the GeoDirectory login page url.  | 
                                                        |
| 166 | + *  | 
                                                        |
| 167 | + * This filter can be used to change the GeoDirectory page url.  | 
                                                        |
| 168 | + *  | 
                                                        |
| 169 | + * @since 1.5.3  | 
                                                        |
| 170 | + * @package GeoDirectory  | 
                                                        |
| 171 | + * @param string $login_url The url of the login page.  | 
                                                        |
| 172 | + * @param array $args The array of query args used.  | 
                                                        |
| 173 | + * @param int $gd_page_id The page id of the GD login page.  | 
                                                        |
| 174 | + */  | 
                                                        |
| 175 | +	return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); | 
                                                        |
| 176 | 176 | }  | 
                                                        
| 177 | 177 | |
| 178 | 178 | /**  | 
                                                        
@@ -183,34 +183,34 @@ discard block  | 
                                                    ||
| 183 | 183 | * @return string Info page url.  | 
                                                        
| 184 | 184 | */  | 
                                                        
| 185 | 185 |  function geodir_info_url($args=array()){ | 
                                                        
| 186 | -    $gd_page_id = get_option('geodir_info_page'); | 
                                                        |
| 187 | -  | 
                                                        |
| 188 | -    if (function_exists('icl_object_id')) { | 
                                                        |
| 189 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 190 | - }  | 
                                                        |
| 191 | -  | 
                                                        |
| 192 | -    if (function_exists('geodir_location_geo_home_link')) { | 
                                                        |
| 193 | -        remove_filter('home_url', 'geodir_location_geo_home_link', 100000); | 
                                                        |
| 194 | - }  | 
                                                        |
| 195 | - $home_url = get_home_url();  | 
                                                        |
| 196 | -    if (function_exists('geodir_location_geo_home_link')) { | 
                                                        |
| 197 | -        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); | 
                                                        |
| 198 | - }  | 
                                                        |
| 199 | -  | 
                                                        |
| 200 | -    if($gd_page_id){ | 
                                                        |
| 201 | - $post = get_post($gd_page_id);  | 
                                                        |
| 202 | - $slug = $post->post_name;  | 
                                                        |
| 203 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors  | 
                                                        |
| 204 | - $info_url = trailingslashit($home_url)."$slug/";  | 
                                                        |
| 205 | -    }else{ | 
                                                        |
| 206 | - $info_url = trailingslashit($home_url);  | 
                                                        |
| 207 | - }  | 
                                                        |
| 208 | -  | 
                                                        |
| 209 | -    if($args){ | 
                                                        |
| 210 | - $info_url = add_query_arg($args,$info_url );  | 
                                                        |
| 211 | - }  | 
                                                        |
| 212 | -  | 
                                                        |
| 213 | - return $info_url;  | 
                                                        |
| 186 | +	$gd_page_id = get_option('geodir_info_page'); | 
                                                        |
| 187 | +  | 
                                                        |
| 188 | +	if (function_exists('icl_object_id')) { | 
                                                        |
| 189 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 190 | + }  | 
                                                        |
| 191 | +  | 
                                                        |
| 192 | +	if (function_exists('geodir_location_geo_home_link')) { | 
                                                        |
| 193 | +		remove_filter('home_url', 'geodir_location_geo_home_link', 100000); | 
                                                        |
| 194 | + }  | 
                                                        |
| 195 | + $home_url = get_home_url();  | 
                                                        |
| 196 | +	if (function_exists('geodir_location_geo_home_link')) { | 
                                                        |
| 197 | +		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); | 
                                                        |
| 198 | + }  | 
                                                        |
| 199 | +  | 
                                                        |
| 200 | +	if($gd_page_id){ | 
                                                        |
| 201 | + $post = get_post($gd_page_id);  | 
                                                        |
| 202 | + $slug = $post->post_name;  | 
                                                        |
| 203 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors  | 
                                                        |
| 204 | + $info_url = trailingslashit($home_url)."$slug/";  | 
                                                        |
| 205 | +	}else{ | 
                                                        |
| 206 | + $info_url = trailingslashit($home_url);  | 
                                                        |
| 207 | + }  | 
                                                        |
| 208 | +  | 
                                                        |
| 209 | +	if($args){ | 
                                                        |
| 210 | + $info_url = add_query_arg($args,$info_url );  | 
                                                        |
| 211 | + }  | 
                                                        |
| 212 | +  | 
                                                        |
| 213 | + return $info_url;  | 
                                                        |
| 214 | 214 | }  | 
                                                        
| 215 | 215 | |
| 216 | 216 | /**  | 
                                                        
@@ -226,11 +226,11 @@ discard block  | 
                                                    ||
| 226 | 226 | * @return string Returns converted string.  | 
                                                        
| 227 | 227 | */  | 
                                                        
| 228 | 228 |  function geodir_ucwords($string, $charset='UTF-8') { | 
                                                        
| 229 | -    if (function_exists('mb_convert_case')) { | 
                                                        |
| 230 | - return mb_convert_case($string, MB_CASE_TITLE, $charset);  | 
                                                        |
| 231 | -    } else { | 
                                                        |
| 232 | - return ucwords($string);  | 
                                                        |
| 233 | - }  | 
                                                        |
| 229 | +	if (function_exists('mb_convert_case')) { | 
                                                        |
| 230 | + return mb_convert_case($string, MB_CASE_TITLE, $charset);  | 
                                                        |
| 231 | +	} else { | 
                                                        |
| 232 | + return ucwords($string);  | 
                                                        |
| 233 | + }  | 
                                                        |
| 234 | 234 | }  | 
                                                        
| 235 | 235 | |
| 236 | 236 | /**  | 
                                                        
@@ -246,11 +246,11 @@ discard block  | 
                                                    ||
| 246 | 246 | * @return string Returns converted string.  | 
                                                        
| 247 | 247 | */  | 
                                                        
| 248 | 248 |  function geodir_strtolower($string, $charset='UTF-8') { | 
                                                        
| 249 | -    if (function_exists('mb_convert_case')) { | 
                                                        |
| 250 | - return mb_convert_case($string, MB_CASE_LOWER, $charset);  | 
                                                        |
| 251 | -    } else { | 
                                                        |
| 252 | - return strtolower($string);  | 
                                                        |
| 253 | - }  | 
                                                        |
| 249 | +	if (function_exists('mb_convert_case')) { | 
                                                        |
| 250 | + return mb_convert_case($string, MB_CASE_LOWER, $charset);  | 
                                                        |
| 251 | +	} else { | 
                                                        |
| 252 | + return strtolower($string);  | 
                                                        |
| 253 | + }  | 
                                                        |
| 254 | 254 | }  | 
                                                        
| 255 | 255 | |
| 256 | 256 | /**  | 
                                                        
@@ -266,11 +266,11 @@ discard block  | 
                                                    ||
| 266 | 266 | * @return string Returns converted string.  | 
                                                        
| 267 | 267 | */  | 
                                                        
| 268 | 268 |  function geodir_strtoupper($string, $charset='UTF-8') { | 
                                                        
| 269 | -    if (function_exists('mb_convert_case')) { | 
                                                        |
| 270 | - return mb_convert_case($string, MB_CASE_UPPER, $charset);  | 
                                                        |
| 271 | -    } else { | 
                                                        |
| 272 | - return strtoupper($string);  | 
                                                        |
| 273 | - }  | 
                                                        |
| 269 | +	if (function_exists('mb_convert_case')) { | 
                                                        |
| 270 | + return mb_convert_case($string, MB_CASE_UPPER, $charset);  | 
                                                        |
| 271 | +	} else { | 
                                                        |
| 272 | + return strtoupper($string);  | 
                                                        |
| 273 | + }  | 
                                                        |
| 274 | 274 | }  | 
                                                        
| 275 | 275 | |
| 276 | 276 | /**  | 
                                                        
@@ -449,11 +449,11 @@ discard block  | 
                                                    ||
| 449 | 449 | * @package GeoDirectory  | 
                                                        
| 450 | 450 | */  | 
                                                        
| 451 | 451 |  function _gd_die_handler() { | 
                                                        
| 452 | -    if ( defined( 'GD_TESTING_MODE' ) ) { | 
                                                        |
| 453 | - return '_gd_die_handler';  | 
                                                        |
| 454 | -    } else { | 
                                                        |
| 455 | - die();  | 
                                                        |
| 456 | - }  | 
                                                        |
| 452 | +	if ( defined( 'GD_TESTING_MODE' ) ) { | 
                                                        |
| 453 | + return '_gd_die_handler';  | 
                                                        |
| 454 | +	} else { | 
                                                        |
| 455 | + die();  | 
                                                        |
| 456 | + }  | 
                                                        |
| 457 | 457 | }  | 
                                                        
| 458 | 458 | |
| 459 | 459 | /**  | 
                                                        
@@ -468,9 +468,9 @@ discard block  | 
                                                    ||
| 468 | 468 | * @param int $status Optional. Status code.  | 
                                                        
| 469 | 469 | */  | 
                                                        
| 470 | 470 |  function gd_die( $message = '', $title = '', $status = 400 ) { | 
                                                        
| 471 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );  | 
                                                        |
| 472 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );  | 
                                                        |
| 473 | - wp_die( $message, $title, array( 'response' => $status ));  | 
                                                        |
| 471 | + add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );  | 
                                                        |
| 472 | + add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );  | 
                                                        |
| 473 | + wp_die( $message, $title, array( 'response' => $status ));  | 
                                                        |
| 474 | 474 | }  | 
                                                        
| 475 | 475 | |
| 476 | 476 | /*  | 
                                                        
@@ -13,11 +13,11 @@ discard block  | 
                                                    ||
| 13 | 13 | * @since 1.4.6  | 
                                                        
| 14 | 14 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 15 | 15 | */  | 
                                                        
| 16 | -function geodir_add_listing_page_id(){ | 
                                                        |
| 16 | +function geodir_add_listing_page_id() { | 
                                                        |
| 17 | 17 |      $gd_page_id = get_option('geodir_add_listing_page'); | 
                                                        
| 18 | 18 | |
| 19 | 19 |      if (function_exists('icl_object_id')) { | 
                                                        
| 20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 21 | 21 | }  | 
                                                        
| 22 | 22 | |
| 23 | 23 | return $gd_page_id;  | 
                                                        
@@ -30,11 +30,11 @@ discard block  | 
                                                    ||
| 30 | 30 | * @since 1.4.6  | 
                                                        
| 31 | 31 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 32 | 32 | */  | 
                                                        
| 33 | -function geodir_preview_page_id(){ | 
                                                        |
| 33 | +function geodir_preview_page_id() { | 
                                                        |
| 34 | 34 |      $gd_page_id = get_option('geodir_preview_page'); | 
                                                        
| 35 | 35 | |
| 36 | 36 |      if (function_exists('icl_object_id')) { | 
                                                        
| 37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 38 | 38 | }  | 
                                                        
| 39 | 39 | |
| 40 | 40 | return $gd_page_id;  | 
                                                        
@@ -47,11 +47,11 @@ discard block  | 
                                                    ||
| 47 | 47 | * @since 1.4.6  | 
                                                        
| 48 | 48 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 49 | 49 | */  | 
                                                        
| 50 | -function geodir_success_page_id(){ | 
                                                        |
| 50 | +function geodir_success_page_id() { | 
                                                        |
| 51 | 51 |      $gd_page_id = get_option('geodir_success_page'); | 
                                                        
| 52 | 52 | |
| 53 | 53 |      if (function_exists('icl_object_id')) { | 
                                                        
| 54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 55 | 55 | }  | 
                                                        
| 56 | 56 | |
| 57 | 57 | return $gd_page_id;  | 
                                                        
@@ -64,11 +64,11 @@ discard block  | 
                                                    ||
| 64 | 64 | * @since 1.4.6  | 
                                                        
| 65 | 65 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 66 | 66 | */  | 
                                                        
| 67 | -function geodir_location_page_id(){ | 
                                                        |
| 67 | +function geodir_location_page_id() { | 
                                                        |
| 68 | 68 |      $gd_page_id = get_option('geodir_location_page'); | 
                                                        
| 69 | 69 | |
| 70 | 70 |      if (function_exists('icl_object_id')) { | 
                                                        
| 71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 72 | 72 | }  | 
                                                        
| 73 | 73 | |
| 74 | 74 | return $gd_page_id;  | 
                                                        
@@ -81,11 +81,11 @@ discard block  | 
                                                    ||
| 81 | 81 | * @since 1.5.4  | 
                                                        
| 82 | 82 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 83 | 83 | */  | 
                                                        
| 84 | -function geodir_home_page_id(){ | 
                                                        |
| 84 | +function geodir_home_page_id() { | 
                                                        |
| 85 | 85 |      $gd_page_id = get_option('geodir_home_page'); | 
                                                        
| 86 | 86 | |
| 87 | 87 |      if (function_exists('icl_object_id')) { | 
                                                        
| 88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 89 | 89 | }  | 
                                                        
| 90 | 90 | |
| 91 | 91 | return $gd_page_id;  | 
                                                        
@@ -98,11 +98,11 @@ discard block  | 
                                                    ||
| 98 | 98 | * @since 1.5.3  | 
                                                        
| 99 | 99 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 100 | 100 | */  | 
                                                        
| 101 | -function geodir_info_page_id(){ | 
                                                        |
| 101 | +function geodir_info_page_id() { | 
                                                        |
| 102 | 102 |      $gd_page_id = get_option('geodir_info_page'); | 
                                                        
| 103 | 103 | |
| 104 | 104 |      if (function_exists('icl_object_id')) { | 
                                                        
| 105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 106 | 106 | }  | 
                                                        
| 107 | 107 | |
| 108 | 108 | return $gd_page_id;  | 
                                                        
@@ -115,11 +115,11 @@ discard block  | 
                                                    ||
| 115 | 115 | * @since 1.5.3  | 
                                                        
| 116 | 116 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 117 | 117 | */  | 
                                                        
| 118 | -function geodir_login_page_id(){ | 
                                                        |
| 118 | +function geodir_login_page_id() { | 
                                                        |
| 119 | 119 |      $gd_page_id = get_option('geodir_login_page'); | 
                                                        
| 120 | 120 | |
| 121 | 121 |      if (function_exists('icl_object_id')) { | 
                                                        
| 122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 123 | 123 | }  | 
                                                        
| 124 | 124 | |
| 125 | 125 | return $gd_page_id;  | 
                                                        
@@ -133,11 +133,11 @@ discard block  | 
                                                    ||
| 133 | 133 | * @since 1.5.3  | 
                                                        
| 134 | 134 | * @return int|null Return the page ID if present or null if not.  | 
                                                        
| 135 | 135 | */  | 
                                                        
| 136 | -function geodir_login_url($args=array()){ | 
                                                        |
| 136 | +function geodir_login_url($args = array()) { | 
                                                        |
| 137 | 137 |      $gd_page_id = get_option('geodir_login_page'); | 
                                                        
| 138 | 138 | |
| 139 | 139 |      if (function_exists('icl_object_id')) { | 
                                                        
| 140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 141 | 141 | }  | 
                                                        
| 142 | 142 | |
| 143 | 143 |      if (function_exists('geodir_location_geo_home_link')) { | 
                                                        
@@ -148,17 +148,17 @@ discard block  | 
                                                    ||
| 148 | 148 |          add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); | 
                                                        
| 149 | 149 | }  | 
                                                        
| 150 | 150 | |
| 151 | -    if($gd_page_id){ | 
                                                        |
| 151 | +    if ($gd_page_id) { | 
                                                        |
| 152 | 152 | $post = get_post($gd_page_id);  | 
                                                        
| 153 | 153 | $slug = $post->post_name;  | 
                                                        
| 154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors  | 
                                                        
| 155 | 155 | $login_url = trailingslashit($home_url)."$slug/";  | 
                                                        
| 156 | -    }else{ | 
                                                        |
| 156 | +    } else { | 
                                                        |
| 157 | 157 | $login_url = trailingslashit($home_url)."?geodir_signup=true";  | 
                                                        
| 158 | 158 | }  | 
                                                        
| 159 | 159 | |
| 160 | -    if($args){ | 
                                                        |
| 161 | - $login_url = add_query_arg($args,$login_url );  | 
                                                        |
| 160 | +    if ($args) { | 
                                                        |
| 161 | + $login_url = add_query_arg($args, $login_url);  | 
                                                        |
| 162 | 162 | }  | 
                                                        
| 163 | 163 | |
| 164 | 164 | /**  | 
                                                        
@@ -172,7 +172,7 @@ discard block  | 
                                                    ||
| 172 | 172 | * @param array $args The array of query args used.  | 
                                                        
| 173 | 173 | * @param int $gd_page_id The page id of the GD login page.  | 
                                                        
| 174 | 174 | */  | 
                                                        
| 175 | -    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); | 
                                                        |
| 175 | +    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id); | 
                                                        |
| 176 | 176 | }  | 
                                                        
| 177 | 177 | |
| 178 | 178 | /**  | 
                                                        
@@ -182,11 +182,11 @@ discard block  | 
                                                    ||
| 182 | 182 | * @since 1.5.4  | 
                                                        
| 183 | 183 | * @return string Info page url.  | 
                                                        
| 184 | 184 | */  | 
                                                        
| 185 | -function geodir_info_url($args=array()){ | 
                                                        |
| 185 | +function geodir_info_url($args = array()) { | 
                                                        |
| 186 | 186 |      $gd_page_id = get_option('geodir_info_page'); | 
                                                        
| 187 | 187 | |
| 188 | 188 |      if (function_exists('icl_object_id')) { | 
                                                        
| 189 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 189 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true);  | 
                                                        |
| 190 | 190 | }  | 
                                                        
| 191 | 191 | |
| 192 | 192 |      if (function_exists('geodir_location_geo_home_link')) { | 
                                                        
@@ -197,17 +197,17 @@ discard block  | 
                                                    ||
| 197 | 197 |          add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); | 
                                                        
| 198 | 198 | }  | 
                                                        
| 199 | 199 | |
| 200 | -    if($gd_page_id){ | 
                                                        |
| 200 | +    if ($gd_page_id) { | 
                                                        |
| 201 | 201 | $post = get_post($gd_page_id);  | 
                                                        
| 202 | 202 | $slug = $post->post_name;  | 
                                                        
| 203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors  | 
                                                        
| 204 | 204 | $info_url = trailingslashit($home_url)."$slug/";  | 
                                                        
| 205 | -    }else{ | 
                                                        |
| 205 | +    } else { | 
                                                        |
| 206 | 206 | $info_url = trailingslashit($home_url);  | 
                                                        
| 207 | 207 | }  | 
                                                        
| 208 | 208 | |
| 209 | -    if($args){ | 
                                                        |
| 210 | - $info_url = add_query_arg($args,$info_url );  | 
                                                        |
| 209 | +    if ($args) { | 
                                                        |
| 210 | + $info_url = add_query_arg($args, $info_url);  | 
                                                        |
| 211 | 211 | }  | 
                                                        
| 212 | 212 | |
| 213 | 213 | return $info_url;  | 
                                                        
@@ -225,7 +225,7 @@ discard block  | 
                                                    ||
| 225 | 225 | * @param string $charset Character set to use for conversion.  | 
                                                        
| 226 | 226 | * @return string Returns converted string.  | 
                                                        
| 227 | 227 | */  | 
                                                        
| 228 | -function geodir_ucwords($string, $charset='UTF-8') { | 
                                                        |
| 228 | +function geodir_ucwords($string, $charset = 'UTF-8') { | 
                                                        |
| 229 | 229 |      if (function_exists('mb_convert_case')) { | 
                                                        
| 230 | 230 | return mb_convert_case($string, MB_CASE_TITLE, $charset);  | 
                                                        
| 231 | 231 |      } else { | 
                                                        
@@ -245,7 +245,7 @@ discard block  | 
                                                    ||
| 245 | 245 | * @param string $charset Character set to use for conversion.  | 
                                                        
| 246 | 246 | * @return string Returns converted string.  | 
                                                        
| 247 | 247 | */  | 
                                                        
| 248 | -function geodir_strtolower($string, $charset='UTF-8') { | 
                                                        |
| 248 | +function geodir_strtolower($string, $charset = 'UTF-8') { | 
                                                        |
| 249 | 249 |      if (function_exists('mb_convert_case')) { | 
                                                        
| 250 | 250 | return mb_convert_case($string, MB_CASE_LOWER, $charset);  | 
                                                        
| 251 | 251 |      } else { | 
                                                        
@@ -265,7 +265,7 @@ discard block  | 
                                                    ||
| 265 | 265 | * @param string $charset Character set to use for conversion.  | 
                                                        
| 266 | 266 | * @return string Returns converted string.  | 
                                                        
| 267 | 267 | */  | 
                                                        
| 268 | -function geodir_strtoupper($string, $charset='UTF-8') { | 
                                                        |
| 268 | +function geodir_strtoupper($string, $charset = 'UTF-8') { | 
                                                        |
| 269 | 269 |      if (function_exists('mb_convert_case')) { | 
                                                        
| 270 | 270 | return mb_convert_case($string, MB_CASE_UPPER, $charset);  | 
                                                        
| 271 | 271 |      } else { | 
                                                        
@@ -296,7 +296,7 @@ discard block  | 
                                                    ||
| 296 | 296 | |
| 297 | 297 | $url = trim($parts[0]);  | 
                                                        
| 298 | 298 |  	if ($formatted && $url != '') { | 
                                                        
| 299 | - $url = str_replace( ' ', '%20', $url );  | 
                                                        |
| 299 | +		$url = str_replace(' ', '%20', $url); | 
                                                        |
| 300 | 300 |  		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); | 
                                                        
| 301 | 301 | |
| 302 | 302 |  		if (0 !== stripos($url, 'mailto:')) { | 
                                                        
@@ -306,8 +306,8 @@ discard block  | 
                                                    ||
| 306 | 306 | |
| 307 | 307 |  		$url = str_replace(';//', '://', $url); | 
                                                        
| 308 | 308 | |
| 309 | -		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { | 
                                                        |
| 310 | - $url = 'http://' . $url;  | 
                                                        |
| 309 | +		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { | 
                                                        |
| 310 | + $url = 'http://'.$url;  | 
                                                        |
| 311 | 311 | }  | 
                                                        
| 312 | 312 | |
| 313 | 313 | $url = wp_kses_normalize_entities($url);  | 
                                                        
@@ -449,7 +449,7 @@ discard block  | 
                                                    ||
| 449 | 449 | * @package GeoDirectory  | 
                                                        
| 450 | 450 | */  | 
                                                        
| 451 | 451 |  function _gd_die_handler() { | 
                                                        
| 452 | -    if ( defined( 'GD_TESTING_MODE' ) ) { | 
                                                        |
| 452 | +    if (defined('GD_TESTING_MODE')) { | 
                                                        |
| 453 | 453 | return '_gd_die_handler';  | 
                                                        
| 454 | 454 |      } else { | 
                                                        
| 455 | 455 | die();  | 
                                                        
@@ -467,10 +467,10 @@ discard block  | 
                                                    ||
| 467 | 467 | * @param string $title Optional. Error title.  | 
                                                        
| 468 | 468 | * @param int $status Optional. Status code.  | 
                                                        
| 469 | 469 | */  | 
                                                        
| 470 | -function gd_die( $message = '', $title = '', $status = 400 ) { | 
                                                        |
| 471 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );  | 
                                                        |
| 472 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );  | 
                                                        |
| 473 | - wp_die( $message, $title, array( 'response' => $status ));  | 
                                                        |
| 470 | +function gd_die($message = '', $title = '', $status = 400) { | 
                                                        |
| 471 | +    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3); | 
                                                        |
| 472 | +    add_filter('wp_die_handler', '_gd_die_handler', 10, 3); | 
                                                        |
| 473 | +    wp_die($message, $title, array('response' => $status)); | 
                                                        |
| 474 | 474 | }  | 
                                                        
| 475 | 475 | |
| 476 | 476 | /*  | 
                                                        
@@ -480,7 +480,7 @@ discard block  | 
                                                    ||
| 480 | 480 | * @param string $php_format The PHP date format.  | 
                                                        
| 481 | 481 | * @return string The jQuery format date string.  | 
                                                        
| 482 | 482 | */  | 
                                                        
| 483 | -function geodir_date_format_php_to_jqueryui( $php_format ) { | 
                                                        |
| 483 | +function geodir_date_format_php_to_jqueryui($php_format) { | 
                                                        |
| 484 | 484 | $symbols = array(  | 
                                                        
| 485 | 485 | // Day  | 
                                                        
| 486 | 486 | 'd' => 'dd',  | 
                                                        
@@ -520,27 +520,27 @@ discard block  | 
                                                    ||
| 520 | 520 | $jqueryui_format = "";  | 
                                                        
| 521 | 521 | $escaping = false;  | 
                                                        
| 522 | 522 | |
| 523 | -	for ( $i = 0; $i < strlen( $php_format ); $i++ ) { | 
                                                        |
| 523 | +	for ($i = 0; $i < strlen($php_format); $i++) { | 
                                                        |
| 524 | 524 | $char = $php_format[$i];  | 
                                                        
| 525 | 525 | |
| 526 | 526 | // PHP date format escaping character  | 
                                                        
| 527 | -		if ( $char === '\\' ) { | 
                                                        |
| 527 | +		if ($char === '\\') { | 
                                                        |
| 528 | 528 | $i++;  | 
                                                        
| 529 | 529 | |
| 530 | -			if ( $escaping ) { | 
                                                        |
| 530 | +			if ($escaping) { | 
                                                        |
| 531 | 531 | $jqueryui_format .= $php_format[$i];  | 
                                                        
| 532 | 532 |  			} else { | 
                                                        
| 533 | - $jqueryui_format .= '\'' . $php_format[$i];  | 
                                                        |
| 533 | + $jqueryui_format .= '\''.$php_format[$i];  | 
                                                        |
| 534 | 534 | }  | 
                                                        
| 535 | 535 | |
| 536 | 536 | $escaping = true;  | 
                                                        
| 537 | 537 |  		} else { | 
                                                        
| 538 | -			if ( $escaping ) { | 
                                                        |
| 538 | +			if ($escaping) { | 
                                                        |
| 539 | 539 | $jqueryui_format .= "'";  | 
                                                        
| 540 | 540 | $escaping = false;  | 
                                                        
| 541 | 541 | }  | 
                                                        
| 542 | 542 | |
| 543 | -			if ( isset( $symbols[$char] ) ) { | 
                                                        |
| 543 | +			if (isset($symbols[$char])) { | 
                                                        |
| 544 | 544 | $jqueryui_format .= $symbols[$char];  | 
                                                        
| 545 | 545 |  			} else { | 
                                                        
| 546 | 546 | $jqueryui_format .= $char;  | 
                                                        
@@ -559,7 +559,7 @@ discard block  | 
                                                    ||
| 559 | 559 | * @return string The untranslated date string.  | 
                                                        
| 560 | 560 | * @since 1.6.5  | 
                                                        
| 561 | 561 | */  | 
                                                        
| 562 | -function geodir_maybe_untranslate_date($date){ | 
                                                        |
| 562 | +function geodir_maybe_untranslate_date($date) { | 
                                                        |
| 563 | 563 | $english_long_months = array(  | 
                                                        
| 564 | 564 | 'January',  | 
                                                        
| 565 | 565 | 'February',  | 
                                                        
@@ -575,7 +575,7 @@ discard block  | 
                                                    ||
| 575 | 575 | 'December',  | 
                                                        
| 576 | 576 | );  | 
                                                        
| 577 | 577 | |
| 578 | - $non_english_long_months = array(  | 
                                                        |
| 578 | + $non_english_long_months = array(  | 
                                                        |
| 579 | 579 |  		__('January'), | 
                                                        
| 580 | 580 |  		__('February'), | 
                                                        
| 581 | 581 |  		__('March'), | 
                                                        
@@ -589,7 +589,7 @@ discard block  | 
                                                    ||
| 589 | 589 |  		__('November'), | 
                                                        
| 590 | 590 |  		__('December'), | 
                                                        
| 591 | 591 | );  | 
                                                        
| 592 | - $date = str_replace($non_english_long_months,$english_long_months,$date);  | 
                                                        |
| 592 | + $date = str_replace($non_english_long_months, $english_long_months, $date);  | 
                                                        |
| 593 | 593 | |
| 594 | 594 | |
| 595 | 595 | $english_short_months = array(  | 
                                                        
@@ -608,21 +608,21 @@ discard block  | 
                                                    ||
| 608 | 608 | );  | 
                                                        
| 609 | 609 | |
| 610 | 610 | $non_english_short_months = array(  | 
                                                        
| 611 | - ' '._x( 'Jan', 'January abbreviation' ).' ',  | 
                                                        |
| 612 | - ' '._x( 'Feb', 'February abbreviation' ).' ',  | 
                                                        |
| 613 | - ' '._x( 'Mar', 'March abbreviation' ).' ',  | 
                                                        |
| 614 | - ' '._x( 'Apr', 'April abbreviation' ).' ',  | 
                                                        |
| 615 | - ' '._x( 'May', 'May abbreviation' ).' ',  | 
                                                        |
| 616 | - ' '._x( 'Jun', 'June abbreviation' ).' ',  | 
                                                        |
| 617 | - ' '._x( 'Jul', 'July abbreviation' ).' ',  | 
                                                        |
| 618 | - ' '._x( 'Aug', 'August abbreviation' ).' ',  | 
                                                        |
| 619 | - ' '._x( 'Sep', 'September abbreviation' ).' ',  | 
                                                        |
| 620 | - ' '._x( 'Oct', 'October abbreviation' ).' ',  | 
                                                        |
| 621 | - ' '._x( 'Nov', 'November abbreviation' ).' ',  | 
                                                        |
| 622 | - ' '._x( 'Dec', 'December abbreviation' ).' ',  | 
                                                        |
| 611 | +		' '._x('Jan', 'January abbreviation').' ', | 
                                                        |
| 612 | +		' '._x('Feb', 'February abbreviation').' ', | 
                                                        |
| 613 | +		' '._x('Mar', 'March abbreviation').' ', | 
                                                        |
| 614 | +		' '._x('Apr', 'April abbreviation').' ', | 
                                                        |
| 615 | +		' '._x('May', 'May abbreviation').' ', | 
                                                        |
| 616 | +		' '._x('Jun', 'June abbreviation').' ', | 
                                                        |
| 617 | +		' '._x('Jul', 'July abbreviation').' ', | 
                                                        |
| 618 | +		' '._x('Aug', 'August abbreviation').' ', | 
                                                        |
| 619 | +		' '._x('Sep', 'September abbreviation').' ', | 
                                                        |
| 620 | +		' '._x('Oct', 'October abbreviation').' ', | 
                                                        |
| 621 | +		' '._x('Nov', 'November abbreviation').' ', | 
                                                        |
| 622 | +		' '._x('Dec', 'December abbreviation').' ', | 
                                                        |
| 623 | 623 | );  | 
                                                        
| 624 | 624 | |
| 625 | - $date = str_replace($non_english_short_months,$english_short_months,$date);  | 
                                                        |
| 625 | + $date = str_replace($non_english_short_months, $english_short_months, $date);  | 
                                                        |
| 626 | 626 | |
| 627 | 627 | |
| 628 | 628 | return $date;  | 
                                                        
@@ -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 virtural 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 virtural 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 | |
@@ -222,12 +222,12 @@ discard block  | 
                                                    ||
| 222 | 222 | */  | 
                                                        
| 223 | 223 | function geodir_unset_prev_theme_nav_location($newname)  | 
                                                        
| 224 | 224 |  {
 | 
                                                        
| 225 | -    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
 | 
                                                        |
| 226 | -    if ($geodir_theme_location) {
 | 
                                                        |
| 227 | -        update_option('geodir_theme_location_nav', $geodir_theme_location);
 | 
                                                        |
| 228 | -    } else {
 | 
                                                        |
| 229 | -        update_option('geodir_theme_location_nav', '');
 | 
                                                        |
| 230 | - }  | 
                                                        |
| 225 | +	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
 | 
                                                        |
| 226 | +	if ($geodir_theme_location) {
 | 
                                                        |
| 227 | +		update_option('geodir_theme_location_nav', $geodir_theme_location);
 | 
                                                        |
| 228 | +	} else {
 | 
                                                        |
| 229 | +		update_option('geodir_theme_location_nav', '');
 | 
                                                        |
| 230 | + }  | 
                                                        |
| 231 | 231 | }  | 
                                                        
| 232 | 232 | |
| 233 | 233 | /// add action for theme switch to blank previous theme navigation location setting  | 
                                                        
@@ -248,32 +248,32 @@ discard block  | 
                                                    ||
| 248 | 248 | */  | 
                                                        
| 249 | 249 | function geodir_add_post_filters()  | 
                                                        
| 250 | 250 |  {
 | 
                                                        
| 251 | - /**  | 
                                                        |
| 252 | - * Contains all function for filtering listing.  | 
                                                        |
| 253 | - *  | 
                                                        |
| 254 | - * @since 1.0.0  | 
                                                        |
| 255 | - * @package GeoDirectory  | 
                                                        |
| 256 | - */  | 
                                                        |
| 257 | -    include_once('geodirectory-functions/listing_filters.php');
 | 
                                                        |
| 251 | + /**  | 
                                                        |
| 252 | + * Contains all function for filtering listing.  | 
                                                        |
| 253 | + *  | 
                                                        |
| 254 | + * @since 1.0.0  | 
                                                        |
| 255 | + * @package GeoDirectory  | 
                                                        |
| 256 | + */  | 
                                                        |
| 257 | +	include_once('geodirectory-functions/listing_filters.php');
 | 
                                                        |
| 258 | 258 | }  | 
                                                        
| 259 | 259 | |
| 260 | 260 | |
| 261 | 261 |  if (!function_exists('geodir_init_defaults')) {
 | 
                                                        
| 262 | - /**  | 
                                                        |
| 263 | - * Calls the function to register the GeoDirectory default CPT and taxonomies.  | 
                                                        |
| 264 | - *  | 
                                                        |
| 265 | - * @since 1.0.0  | 
                                                        |
| 266 | - * @package GeoDirectory  | 
                                                        |
| 267 | - */  | 
                                                        |
| 268 | - function geodir_init_defaults()  | 
                                                        |
| 269 | -    {
 | 
                                                        |
| 270 | -        if (function_exists('geodir_register_defaults')) {
 | 
                                                        |
| 262 | + /**  | 
                                                        |
| 263 | + * Calls the function to register the GeoDirectory default CPT and taxonomies.  | 
                                                        |
| 264 | + *  | 
                                                        |
| 265 | + * @since 1.0.0  | 
                                                        |
| 266 | + * @package GeoDirectory  | 
                                                        |
| 267 | + */  | 
                                                        |
| 268 | + function geodir_init_defaults()  | 
                                                        |
| 269 | +	{
 | 
                                                        |
| 270 | +		if (function_exists('geodir_register_defaults')) {
 | 
                                                        |
| 271 | 271 | |
| 272 | - geodir_register_defaults();  | 
                                                        |
| 272 | + geodir_register_defaults();  | 
                                                        |
| 273 | 273 | |
| 274 | - }  | 
                                                        |
| 274 | + }  | 
                                                        |
| 275 | 275 | |
| 276 | - }  | 
                                                        |
| 276 | + }  | 
                                                        |
| 277 | 277 | }  | 
                                                        
| 278 | 278 | |
| 279 | 279 | |
@@ -295,26 +295,26 @@ discard block  | 
                                                    ||
| 295 | 295 | // CALLED ON 'sidebars_widgets' FILTER  | 
                                                        
| 296 | 296 | |
| 297 | 297 |  if (!function_exists('geodir_restrict_widget')) {
 | 
                                                        
| 298 | - /**  | 
                                                        |
| 299 | - * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.  | 
                                                        |
| 300 | - *  | 
                                                        |
| 301 | - * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.  | 
                                                        |
| 302 | - * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.  | 
                                                        |
| 303 | - * @since 1.0.0  | 
                                                        |
| 304 | - * @package GeoDirectory  | 
                                                        |
| 305 | - */  | 
                                                        |
| 306 | - function geodir_restrict_widget()  | 
                                                        |
| 307 | -    {
 | 
                                                        |
| 308 | - global $is_listing, $is_single_place;  | 
                                                        |
| 298 | + /**  | 
                                                        |
| 299 | + * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.  | 
                                                        |
| 300 | + *  | 
                                                        |
| 301 | + * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.  | 
                                                        |
| 302 | + * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.  | 
                                                        |
| 303 | + * @since 1.0.0  | 
                                                        |
| 304 | + * @package GeoDirectory  | 
                                                        |
| 305 | + */  | 
                                                        |
| 306 | + function geodir_restrict_widget()  | 
                                                        |
| 307 | +	{
 | 
                                                        |
| 308 | + global $is_listing, $is_single_place;  | 
                                                        |
| 309 | 309 | |
| 310 | - // set is listing  | 
                                                        |
| 311 | -        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
 | 
                                                        |
| 310 | + // set is listing  | 
                                                        |
| 311 | +		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
 | 
                                                        |
| 312 | 312 | |
| 313 | - // set is single place  | 
                                                        |
| 314 | -        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
 | 
                                                        |
| 313 | + // set is single place  | 
                                                        |
| 314 | +		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
 | 
                                                        |
| 315 | 315 | |
| 316 | 316 | |
| 317 | - }  | 
                                                        |
| 317 | + }  | 
                                                        |
| 318 | 318 | }  | 
                                                        
| 319 | 319 | |
| 320 | 320 | |
@@ -335,32 +335,32 @@ discard block  | 
                                                    ||
| 335 | 335 | */  | 
                                                        
| 336 | 336 | function geodir_detail_page_sidebar_content_sorting()  | 
                                                        
| 337 | 337 |  {
 | 
                                                        
| 338 | - $arr_detail_page_sidebar_content =  | 
                                                        |
| 339 | - /**  | 
                                                        |
| 340 | - * An array of functions to be called to be displayed on the details (post) page sidebar.  | 
                                                        |
| 341 | - *  | 
                                                        |
| 342 | - * This filter can be used to remove sections of the details page sidebar,  | 
                                                        |
| 343 | - * add new sections or rearrange the order of the sections.  | 
                                                        |
| 344 | - *  | 
                                                        |
| 345 | -         * @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.
 | 
                                                        |
| 346 | - * @since 1.0.0  | 
                                                        |
| 347 | - */  | 
                                                        |
| 348 | -        apply_filters('geodir_detail_page_sidebar_content',
 | 
                                                        |
| 349 | -            array('geodir_social_sharing_buttons',
 | 
                                                        |
| 350 | - 'geodir_share_this_button',  | 
                                                        |
| 351 | - 'geodir_detail_page_google_analytics',  | 
                                                        |
| 352 | - 'geodir_edit_post_link',  | 
                                                        |
| 353 | - 'geodir_detail_page_review_rating',  | 
                                                        |
| 354 | - 'geodir_detail_page_more_info'  | 
                                                        |
| 355 | - ) // end of array  | 
                                                        |
| 356 | - ); // end of apply filter  | 
                                                        |
| 357 | -    if (!empty($arr_detail_page_sidebar_content)) {
 | 
                                                        |
| 358 | -        foreach ($arr_detail_page_sidebar_content as $content_function) {
 | 
                                                        |
| 359 | -            if (function_exists($content_function)) {
 | 
                                                        |
| 360 | -                add_action('geodir_detail_page_sidebar', $content_function);
 | 
                                                        |
| 361 | - }  | 
                                                        |
| 362 | - }  | 
                                                        |
| 363 | - }  | 
                                                        |
| 338 | + $arr_detail_page_sidebar_content =  | 
                                                        |
| 339 | + /**  | 
                                                        |
| 340 | + * An array of functions to be called to be displayed on the details (post) page sidebar.  | 
                                                        |
| 341 | + *  | 
                                                        |
| 342 | + * This filter can be used to remove sections of the details page sidebar,  | 
                                                        |
| 343 | + * add new sections or rearrange the order of the sections.  | 
                                                        |
| 344 | + *  | 
                                                        |
| 345 | +		 * @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.
 | 
                                                        |
| 346 | + * @since 1.0.0  | 
                                                        |
| 347 | + */  | 
                                                        |
| 348 | +		apply_filters('geodir_detail_page_sidebar_content',
 | 
                                                        |
| 349 | +			array('geodir_social_sharing_buttons',
 | 
                                                        |
| 350 | + 'geodir_share_this_button',  | 
                                                        |
| 351 | + 'geodir_detail_page_google_analytics',  | 
                                                        |
| 352 | + 'geodir_edit_post_link',  | 
                                                        |
| 353 | + 'geodir_detail_page_review_rating',  | 
                                                        |
| 354 | + 'geodir_detail_page_more_info'  | 
                                                        |
| 355 | + ) // end of array  | 
                                                        |
| 356 | + ); // end of apply filter  | 
                                                        |
| 357 | +	if (!empty($arr_detail_page_sidebar_content)) {
 | 
                                                        |
| 358 | +		foreach ($arr_detail_page_sidebar_content as $content_function) {
 | 
                                                        |
| 359 | +			if (function_exists($content_function)) {
 | 
                                                        |
| 360 | +				add_action('geodir_detail_page_sidebar', $content_function);
 | 
                                                        |
| 361 | + }  | 
                                                        |
| 362 | + }  | 
                                                        |
| 363 | + }  | 
                                                        |
| 364 | 364 | }  | 
                                                        
| 365 | 365 | |
| 366 | 366 |  add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
 | 
                                                        
@@ -375,14 +375,14 @@ discard block  | 
                                                    ||
| 375 | 375 | */  | 
                                                        
| 376 | 376 | function geodir_add_to_favourite_link()  | 
                                                        
| 377 | 377 |  {
 | 
                                                        
| 378 | - global $post, $preview;  | 
                                                        |
| 379 | -    if (!$preview && geodir_is_page('detail')) {
 | 
                                                        |
| 380 | - ?>  | 
                                                        |
| 378 | + global $post, $preview;  | 
                                                        |
| 379 | +	if (!$preview && geodir_is_page('detail')) {
 | 
                                                        |
| 380 | + ?>  | 
                                                        |
| 381 | 381 | <p class="edit_link">  | 
                                                        
| 382 | 382 | <?php geodir_favourite_html($post->post_author, $post->ID); ?>  | 
                                                        
| 383 | 383 | </p>  | 
                                                        
| 384 | 384 | <?php  | 
                                                        
| 385 | - }  | 
                                                        |
| 385 | + }  | 
                                                        |
| 386 | 386 | }  | 
                                                        
| 387 | 387 | |
| 388 | 388 | /**  | 
                                                        
@@ -396,41 +396,41 @@ discard block  | 
                                                    ||
| 396 | 396 | */  | 
                                                        
| 397 | 397 | function geodir_social_sharing_buttons()  | 
                                                        
| 398 | 398 |  {
 | 
                                                        
| 399 | - global $preview;  | 
                                                        |
| 400 | - ob_start(); // Start buffering;  | 
                                                        |
| 401 | - /**  | 
                                                        |
| 402 | - * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.  | 
                                                        |
| 403 | - *  | 
                                                        |
| 404 | - * @since 1.0.0  | 
                                                        |
| 405 | - */  | 
                                                        |
| 406 | -    do_action('geodir_before_social_sharing_buttons');
 | 
                                                        |
| 407 | -    if (!$preview) {
 | 
                                                        |
| 408 | - ?>  | 
                                                        |
| 399 | + global $preview;  | 
                                                        |
| 400 | + ob_start(); // Start buffering;  | 
                                                        |
| 401 | + /**  | 
                                                        |
| 402 | + * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.  | 
                                                        |
| 403 | + *  | 
                                                        |
| 404 | + * @since 1.0.0  | 
                                                        |
| 405 | + */  | 
                                                        |
| 406 | +	do_action('geodir_before_social_sharing_buttons');
 | 
                                                        |
| 407 | +	if (!$preview) {
 | 
                                                        |
| 408 | + ?>  | 
                                                        |
| 409 | 409 | <div class="likethis">  | 
                                                        
| 410 | 410 | <?php geodir_twitter_tweet_button(); ?>  | 
                                                        
| 411 | 411 | <?php geodir_fb_like_button(); ?>  | 
                                                        
| 412 | 412 | <?php geodir_google_plus_button(); ?>  | 
                                                        
| 413 | 413 | </div>  | 
                                                        
| 414 | 414 | <?php  | 
                                                        
| 415 | - }// end of if, if its a preview or not  | 
                                                        |
| 416 | -  | 
                                                        |
| 417 | - /**  | 
                                                        |
| 418 | - * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.  | 
                                                        |
| 419 | - *  | 
                                                        |
| 420 | - * @since 1.0.0  | 
                                                        |
| 421 | - */  | 
                                                        |
| 422 | -    do_action('geodir_after_social_sharing_buttons');
 | 
                                                        |
| 423 | - $content_html = ob_get_clean();  | 
                                                        |
| 424 | - if (trim($content_html) != '')  | 
                                                        |
| 425 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';  | 
                                                        |
| 426 | -    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
 | 
                                                        |
| 427 | - /**  | 
                                                        |
| 428 | - * Filter the geodir_social_sharing_buttons() function content.  | 
                                                        |
| 429 | - *  | 
                                                        |
| 430 | - * @param string $content_html The output html of the geodir_social_sharing_buttons() function.  | 
                                                        |
| 431 | - */  | 
                                                        |
| 432 | -        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
 | 
                                                        |
| 433 | - }  | 
                                                        |
| 415 | + }// end of if, if its a preview or not  | 
                                                        |
| 416 | +  | 
                                                        |
| 417 | + /**  | 
                                                        |
| 418 | + * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.  | 
                                                        |
| 419 | + *  | 
                                                        |
| 420 | + * @since 1.0.0  | 
                                                        |
| 421 | + */  | 
                                                        |
| 422 | +	do_action('geodir_after_social_sharing_buttons');
 | 
                                                        |
| 423 | + $content_html = ob_get_clean();  | 
                                                        |
| 424 | + if (trim($content_html) != '')  | 
                                                        |
| 425 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';  | 
                                                        |
| 426 | +	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
 | 
                                                        |
| 427 | + /**  | 
                                                        |
| 428 | + * Filter the geodir_social_sharing_buttons() function content.  | 
                                                        |
| 429 | + *  | 
                                                        |
| 430 | + * @param string $content_html The output html of the geodir_social_sharing_buttons() function.  | 
                                                        |
| 431 | + */  | 
                                                        |
| 432 | +		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
 | 
                                                        |
| 433 | + }  | 
                                                        |
| 434 | 434 | |
| 435 | 435 | |
| 436 | 436 | }  | 
                                                        
@@ -446,39 +446,39 @@ discard block  | 
                                                    ||
| 446 | 446 | */  | 
                                                        
| 447 | 447 | function geodir_share_this_button()  | 
                                                        
| 448 | 448 |  {
 | 
                                                        
| 449 | - global $preview;  | 
                                                        |
| 450 | - ob_start(); // Start buffering;  | 
                                                        |
| 451 | - /**  | 
                                                        |
| 452 | - * This is called before the share this html in the function geodir_share_this_button()  | 
                                                        |
| 453 | - *  | 
                                                        |
| 454 | - * @since 1.0.0  | 
                                                        |
| 455 | - */  | 
                                                        |
| 456 | -    do_action('geodir_before_share_this_button');
 | 
                                                        |
| 457 | -    if (!$preview) {
 | 
                                                        |
| 458 | - ?>  | 
                                                        |
| 449 | + global $preview;  | 
                                                        |
| 450 | + ob_start(); // Start buffering;  | 
                                                        |
| 451 | + /**  | 
                                                        |
| 452 | + * This is called before the share this html in the function geodir_share_this_button()  | 
                                                        |
| 453 | + *  | 
                                                        |
| 454 | + * @since 1.0.0  | 
                                                        |
| 455 | + */  | 
                                                        |
| 456 | +	do_action('geodir_before_share_this_button');
 | 
                                                        |
| 457 | +	if (!$preview) {
 | 
                                                        |
| 458 | + ?>  | 
                                                        |
| 459 | 459 | <div class="share clearfix">  | 
                                                        
| 460 | 460 | <?php geodir_share_this_button_code(); ?>  | 
                                                        
| 461 | 461 | </div>  | 
                                                        
| 462 | 462 | <?php  | 
                                                        
| 463 | - }// end of if, if its a preview or not  | 
                                                        |
| 464 | - /**  | 
                                                        |
| 465 | - * This is called after the share this html in the function geodir_share_this_button()  | 
                                                        |
| 466 | - *  | 
                                                        |
| 467 | - * @since 1.0.0  | 
                                                        |
| 468 | - */  | 
                                                        |
| 469 | -    do_action('geodir_after_share_this_button');
 | 
                                                        |
| 470 | - $content_html = ob_get_clean();  | 
                                                        |
| 471 | - if (trim($content_html) != '')  | 
                                                        |
| 472 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';  | 
                                                        |
| 473 | -    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
 | 
                                                        |
| 474 | - /**  | 
                                                        |
| 475 | - * Filter the geodir_share_this_button() function content.  | 
                                                        |
| 476 | - *  | 
                                                        |
| 477 | - * @param string $content_html The output html of the geodir_share_this_button() function.  | 
                                                        |
| 478 | - * @since 1.0.0  | 
                                                        |
| 479 | - */  | 
                                                        |
| 480 | -        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
 | 
                                                        |
| 481 | - }  | 
                                                        |
| 463 | + }// end of if, if its a preview or not  | 
                                                        |
| 464 | + /**  | 
                                                        |
| 465 | + * This is called after the share this html in the function geodir_share_this_button()  | 
                                                        |
| 466 | + *  | 
                                                        |
| 467 | + * @since 1.0.0  | 
                                                        |
| 468 | + */  | 
                                                        |
| 469 | +	do_action('geodir_after_share_this_button');
 | 
                                                        |
| 470 | + $content_html = ob_get_clean();  | 
                                                        |
| 471 | + if (trim($content_html) != '')  | 
                                                        |
| 472 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';  | 
                                                        |
| 473 | +	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
 | 
                                                        |
| 474 | + /**  | 
                                                        |
| 475 | + * Filter the geodir_share_this_button() function content.  | 
                                                        |
| 476 | + *  | 
                                                        |
| 477 | + * @param string $content_html The output html of the geodir_share_this_button() function.  | 
                                                        |
| 478 | + * @since 1.0.0  | 
                                                        |
| 479 | + */  | 
                                                        |
| 480 | +		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
 | 
                                                        |
| 481 | + }  | 
                                                        |
| 482 | 482 | |
| 483 | 483 | }  | 
                                                        
| 484 | 484 | |
@@ -494,46 +494,46 @@ discard block  | 
                                                    ||
| 494 | 494 | */  | 
                                                        
| 495 | 495 | function geodir_edit_post_link()  | 
                                                        
| 496 | 496 |  {
 | 
                                                        
| 497 | - global $post, $preview;  | 
                                                        |
| 498 | - ob_start(); // Start buffering;  | 
                                                        |
| 499 | - /**  | 
                                                        |
| 500 | - * This is called before the edit post link html in the function geodir_edit_post_link()  | 
                                                        |
| 501 | - *  | 
                                                        |
| 502 | - * @since 1.0.0  | 
                                                        |
| 503 | - */  | 
                                                        |
| 504 | -    do_action('geodir_before_edit_post_link');
 | 
                                                        |
| 505 | -    if (!$preview) {
 | 
                                                        |
| 506 | - $is_current_user_owner = geodir_listing_belong_to_current_user();  | 
                                                        |
| 497 | + global $post, $preview;  | 
                                                        |
| 498 | + ob_start(); // Start buffering;  | 
                                                        |
| 499 | + /**  | 
                                                        |
| 500 | + * This is called before the edit post link html in the function geodir_edit_post_link()  | 
                                                        |
| 501 | + *  | 
                                                        |
| 502 | + * @since 1.0.0  | 
                                                        |
| 503 | + */  | 
                                                        |
| 504 | +	do_action('geodir_before_edit_post_link');
 | 
                                                        |
| 505 | +	if (!$preview) {
 | 
                                                        |
| 506 | + $is_current_user_owner = geodir_listing_belong_to_current_user();  | 
                                                        |
| 507 | 507 | |
| 508 | -        if ($is_current_user_owner) {
 | 
                                                        |
| 509 | - $post_id = $post->ID;  | 
                                                        |
| 508 | +		if ($is_current_user_owner) {
 | 
                                                        |
| 509 | + $post_id = $post->ID;  | 
                                                        |
| 510 | 510 | |
| 511 | -            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        |
| 512 | - $post_id = (int)$_REQUEST['pid'];  | 
                                                        |
| 513 | - }  | 
                                                        |
| 511 | +			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        |
| 512 | + $post_id = (int)$_REQUEST['pid'];  | 
                                                        |
| 513 | + }  | 
                                                        |
| 514 | 514 | |
| 515 | - $postlink = get_permalink(geodir_add_listing_page_id());  | 
                                                        |
| 516 | -            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
 | 
                                                        |
| 517 | -            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
 | 
                                                        |
| 518 | - }  | 
                                                        |
| 519 | - }// end of if, if its a preview or not  | 
                                                        |
| 520 | - /**  | 
                                                        |
| 521 | - * This is called after the edit post link html in the function geodir_edit_post_link()  | 
                                                        |
| 522 | - *  | 
                                                        |
| 523 | - * @since 1.0.0  | 
                                                        |
| 524 | - */  | 
                                                        |
| 525 | -    do_action('geodir_after_edit_post_link');
 | 
                                                        |
| 526 | - $content_html = ob_get_clean();  | 
                                                        |
| 527 | - if (trim($content_html) != '')  | 
                                                        |
| 528 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';  | 
                                                        |
| 529 | -    if ((int)get_option('geodir_disable_user_links_section') != 1) {
 | 
                                                        |
| 530 | - /**  | 
                                                        |
| 531 | - * Filter the geodir_edit_post_link() function content.  | 
                                                        |
| 532 | - *  | 
                                                        |
| 533 | - * @param string $content_html The output html of the geodir_edit_post_link() function.  | 
                                                        |
| 534 | - */  | 
                                                        |
| 535 | -        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
 | 
                                                        |
| 536 | - }  | 
                                                        |
| 515 | + $postlink = get_permalink(geodir_add_listing_page_id());  | 
                                                        |
| 516 | +			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
 | 
                                                        |
| 517 | +			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
 | 
                                                        |
| 518 | + }  | 
                                                        |
| 519 | + }// end of if, if its a preview or not  | 
                                                        |
| 520 | + /**  | 
                                                        |
| 521 | + * This is called after the edit post link html in the function geodir_edit_post_link()  | 
                                                        |
| 522 | + *  | 
                                                        |
| 523 | + * @since 1.0.0  | 
                                                        |
| 524 | + */  | 
                                                        |
| 525 | +	do_action('geodir_after_edit_post_link');
 | 
                                                        |
| 526 | + $content_html = ob_get_clean();  | 
                                                        |
| 527 | + if (trim($content_html) != '')  | 
                                                        |
| 528 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';  | 
                                                        |
| 529 | +	if ((int)get_option('geodir_disable_user_links_section') != 1) {
 | 
                                                        |
| 530 | + /**  | 
                                                        |
| 531 | + * Filter the geodir_edit_post_link() function content.  | 
                                                        |
| 532 | + *  | 
                                                        |
| 533 | + * @param string $content_html The output html of the geodir_edit_post_link() function.  | 
                                                        |
| 534 | + */  | 
                                                        |
| 535 | +		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
 | 
                                                        |
| 536 | + }  | 
                                                        |
| 537 | 537 | }  | 
                                                        
| 538 | 538 | |
| 539 | 539 | /**  | 
                                                        
@@ -547,41 +547,41 @@ discard block  | 
                                                    ||
| 547 | 547 | */  | 
                                                        
| 548 | 548 | function geodir_detail_page_google_analytics()  | 
                                                        
| 549 | 549 |  {
 | 
                                                        
| 550 | - global $post;  | 
                                                        |
| 551 | - $package_info = array();  | 
                                                        |
| 552 | - $package_info = geodir_post_package_info($package_info, $post);  | 
                                                        |
| 550 | + global $post;  | 
                                                        |
| 551 | + $package_info = array();  | 
                                                        |
| 552 | + $package_info = geodir_post_package_info($package_info, $post);  | 
                                                        |
| 553 | 553 | |
| 554 | -    $id = trim(get_option('geodir_ga_id'));
 | 
                                                        |
| 554 | +	$id = trim(get_option('geodir_ga_id'));
 | 
                                                        |
| 555 | 555 | |
| 556 | -    if (!$id) {
 | 
                                                        |
| 557 | - return; //if no Google Analytics ID then bail.  | 
                                                        |
| 558 | - }  | 
                                                        |
| 556 | +	if (!$id) {
 | 
                                                        |
| 557 | + return; //if no Google Analytics ID then bail.  | 
                                                        |
| 558 | + }  | 
                                                        |
| 559 | 559 | |
| 560 | - ob_start(); // Start buffering;  | 
                                                        |
| 561 | - /**  | 
                                                        |
| 562 | - * This is called before the edit post link html in the function geodir_detail_page_google_analytics()  | 
                                                        |
| 563 | - *  | 
                                                        |
| 564 | - * @since 1.0.0  | 
                                                        |
| 565 | - */  | 
                                                        |
| 566 | -    do_action('geodir_before_google_analytics');
 | 
                                                        |
| 560 | + ob_start(); // Start buffering;  | 
                                                        |
| 561 | + /**  | 
                                                        |
| 562 | + * This is called before the edit post link html in the function geodir_detail_page_google_analytics()  | 
                                                        |
| 563 | + *  | 
                                                        |
| 564 | + * @since 1.0.0  | 
                                                        |
| 565 | + */  | 
                                                        |
| 566 | +	do_action('geodir_before_google_analytics');
 | 
                                                        |
| 567 | 567 | |
| 568 | -    $refresh_time = get_option('geodir_ga_refresh_time', 5);
 | 
                                                        |
| 569 | - /**  | 
                                                        |
| 570 | - * Filter the time interval to check & refresh new users results.  | 
                                                        |
| 571 | - *  | 
                                                        |
| 572 | - * @since 1.5.9  | 
                                                        |
| 573 | - *  | 
                                                        |
| 574 | - * @param int $refresh_time Time interval to check & refresh new users results.  | 
                                                        |
| 575 | - */  | 
                                                        |
| 576 | -    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
 | 
                                                        |
| 577 | - $refresh_time = absint($refresh_time * 1000);  | 
                                                        |
| 568 | +	$refresh_time = get_option('geodir_ga_refresh_time', 5);
 | 
                                                        |
| 569 | + /**  | 
                                                        |
| 570 | + * Filter the time interval to check & refresh new users results.  | 
                                                        |
| 571 | + *  | 
                                                        |
| 572 | + * @since 1.5.9  | 
                                                        |
| 573 | + *  | 
                                                        |
| 574 | + * @param int $refresh_time Time interval to check & refresh new users results.  | 
                                                        |
| 575 | + */  | 
                                                        |
| 576 | +	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
 | 
                                                        |
| 577 | + $refresh_time = absint($refresh_time * 1000);  | 
                                                        |
| 578 | 578 | |
| 579 | -    $hide_refresh = get_option('geodir_ga_auto_refresh');
 | 
                                                        |
| 579 | +	$hide_refresh = get_option('geodir_ga_auto_refresh');
 | 
                                                        |
| 580 | 580 | |
| 581 | - $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;  | 
                                                        |
| 582 | -    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' )) ) {
 | 
                                                        |
| 583 | - $page_url = urlencode($_SERVER['REQUEST_URI']);  | 
                                                        |
| 584 | - ?>  | 
                                                        |
| 581 | + $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;  | 
                                                        |
| 582 | +	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' )) ) {
 | 
                                                        |
| 583 | + $page_url = urlencode($_SERVER['REQUEST_URI']);  | 
                                                        |
| 584 | + ?>  | 
                                                        |
| 585 | 585 | <script type="text/javascript">  | 
                                                        
| 586 | 586 | var gd_gaTimeOut;  | 
                                                        
| 587 | 587 |              var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
 | 
                                                        
@@ -833,15 +833,15 @@ discard block  | 
                                                    ||
| 833 | 833 |                      var labels = results[1].rows.map(function(row) { return +row[0]; });
 | 
                                                        
| 834 | 834 | |
| 835 | 835 | <?php  | 
                                                        
| 836 | - // Here we list the shorthand days of the week so it can be used in translation.  | 
                                                        |
| 837 | -                    __("Mon",'geodirectory');
 | 
                                                        |
| 838 | -                    __("Tue",'geodirectory');
 | 
                                                        |
| 839 | -                    __("Wed",'geodirectory');
 | 
                                                        |
| 840 | -                    __("Thu",'geodirectory');
 | 
                                                        |
| 841 | -                    __("Fri",'geodirectory');
 | 
                                                        |
| 842 | -                    __("Sat",'geodirectory');
 | 
                                                        |
| 843 | -                    __("Sun",'geodirectory');
 | 
                                                        |
| 844 | - ?>  | 
                                                        |
| 836 | + // Here we list the shorthand days of the week so it can be used in translation.  | 
                                                        |
| 837 | +					__("Mon",'geodirectory');
 | 
                                                        |
| 838 | +					__("Tue",'geodirectory');
 | 
                                                        |
| 839 | +					__("Wed",'geodirectory');
 | 
                                                        |
| 840 | +					__("Thu",'geodirectory');
 | 
                                                        |
| 841 | +					__("Fri",'geodirectory');
 | 
                                                        |
| 842 | +					__("Sat",'geodirectory');
 | 
                                                        |
| 843 | +					__("Sun",'geodirectory');
 | 
                                                        |
| 844 | + ?>  | 
                                                        |
| 845 | 845 | |
| 846 | 846 | labels = [  | 
                                                        
| 847 | 847 |                          "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
 | 
                                                        
@@ -1090,24 +1090,24 @@ discard block  | 
                                                    ||
| 1090 | 1090 | </span>  | 
                                                        
| 1091 | 1091 | |
| 1092 | 1092 | <?php  | 
                                                        
| 1093 | - }  | 
                                                        |
| 1094 | - /**  | 
                                                        |
| 1095 | - * This is called after the edit post link html in the function geodir_detail_page_google_analytics()  | 
                                                        |
| 1096 | - *  | 
                                                        |
| 1097 | - * @since 1.0.0  | 
                                                        |
| 1098 | - */  | 
                                                        |
| 1099 | -    do_action('geodir_after_google_analytics');
 | 
                                                        |
| 1100 | - $content_html = ob_get_clean();  | 
                                                        |
| 1101 | - if (trim($content_html) != '')  | 
                                                        |
| 1102 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';  | 
                                                        |
| 1103 | -    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
 | 
                                                        |
| 1104 | - /**  | 
                                                        |
| 1105 | - * Filter the geodir_edit_post_link() function content.  | 
                                                        |
| 1106 | - *  | 
                                                        |
| 1107 | - * @param string $content_html The output html of the geodir_edit_post_link() function.  | 
                                                        |
| 1108 | - */  | 
                                                        |
| 1109 | -        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
 | 
                                                        |
| 1110 | - }  | 
                                                        |
| 1093 | + }  | 
                                                        |
| 1094 | + /**  | 
                                                        |
| 1095 | + * This is called after the edit post link html in the function geodir_detail_page_google_analytics()  | 
                                                        |
| 1096 | + *  | 
                                                        |
| 1097 | + * @since 1.0.0  | 
                                                        |
| 1098 | + */  | 
                                                        |
| 1099 | +	do_action('geodir_after_google_analytics');
 | 
                                                        |
| 1100 | + $content_html = ob_get_clean();  | 
                                                        |
| 1101 | + if (trim($content_html) != '')  | 
                                                        |
| 1102 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';  | 
                                                        |
| 1103 | +	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
 | 
                                                        |
| 1104 | + /**  | 
                                                        |
| 1105 | + * Filter the geodir_edit_post_link() function content.  | 
                                                        |
| 1106 | + *  | 
                                                        |
| 1107 | + * @param string $content_html The output html of the geodir_edit_post_link() function.  | 
                                                        |
| 1108 | + */  | 
                                                        |
| 1109 | +		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
 | 
                                                        |
| 1110 | + }  | 
                                                        |
| 1111 | 1111 | }  | 
                                                        
| 1112 | 1112 | |
| 1113 | 1113 | /**  | 
                                                        
@@ -1123,90 +1123,90 @@ discard block  | 
                                                    ||
| 1123 | 1123 | */  | 
                                                        
| 1124 | 1124 | function geodir_detail_page_review_rating()  | 
                                                        
| 1125 | 1125 |  {
 | 
                                                        
| 1126 | - global $post, $preview, $post_images;  | 
                                                        |
| 1127 | - ob_start(); // Start buffering;  | 
                                                        |
| 1128 | - /**  | 
                                                        |
| 1129 | - * This is called before the rating html in the function geodir_detail_page_review_rating().  | 
                                                        |
| 1130 | - *  | 
                                                        |
| 1131 | - * This is called outside the check for an actual rating and the check for preview page.  | 
                                                        |
| 1132 | - *  | 
                                                        |
| 1133 | - * @since 1.0.0  | 
                                                        |
| 1134 | - */  | 
                                                        |
| 1135 | -    do_action('geodir_before_detail_page_review_rating');
 | 
                                                        |
| 1136 | -  | 
                                                        |
| 1137 | - $comment_count = geodir_get_review_count_total($post->ID);  | 
                                                        |
| 1138 | - $post_avgratings = geodir_get_post_rating($post->ID);  | 
                                                        |
| 1139 | -  | 
                                                        |
| 1140 | -    if ($post_avgratings != 0 && !$preview) {
 | 
                                                        |
| 1141 | - /**  | 
                                                        |
| 1142 | - * This is called before the rating html in the function geodir_detail_page_review_rating().  | 
                                                        |
| 1143 | - *  | 
                                                        |
| 1144 | - * This is called inside the check for an actual rating and the check for preview page.  | 
                                                        |
| 1145 | - *  | 
                                                        |
| 1146 | - * @since 1.0.0  | 
                                                        |
| 1147 | - * @param float $post_avgratings Average rating for the surrent post.  | 
                                                        |
| 1148 | - * @param int $post->ID Current post ID.  | 
                                                        |
| 1149 | - */  | 
                                                        |
| 1150 | -        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
 | 
                                                        |
| 1151 | -  | 
                                                        |
| 1152 | - $html = '<p style=" float:left;">';  | 
                                                        |
| 1153 | - $html .= geodir_get_rating_stars($post_avgratings, $post->ID);  | 
                                                        |
| 1154 | - $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';  | 
                                                        |
| 1155 | - $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;  | 
                                                        |
| 1126 | + global $post, $preview, $post_images;  | 
                                                        |
| 1127 | + ob_start(); // Start buffering;  | 
                                                        |
| 1128 | + /**  | 
                                                        |
| 1129 | + * This is called before the rating html in the function geodir_detail_page_review_rating().  | 
                                                        |
| 1130 | + *  | 
                                                        |
| 1131 | + * This is called outside the check for an actual rating and the check for preview page.  | 
                                                        |
| 1132 | + *  | 
                                                        |
| 1133 | + * @since 1.0.0  | 
                                                        |
| 1134 | + */  | 
                                                        |
| 1135 | +	do_action('geodir_before_detail_page_review_rating');
 | 
                                                        |
| 1136 | +  | 
                                                        |
| 1137 | + $comment_count = geodir_get_review_count_total($post->ID);  | 
                                                        |
| 1138 | + $post_avgratings = geodir_get_post_rating($post->ID);  | 
                                                        |
| 1139 | +  | 
                                                        |
| 1140 | +	if ($post_avgratings != 0 && !$preview) {
 | 
                                                        |
| 1141 | + /**  | 
                                                        |
| 1142 | + * This is called before the rating html in the function geodir_detail_page_review_rating().  | 
                                                        |
| 1143 | + *  | 
                                                        |
| 1144 | + * This is called inside the check for an actual rating and the check for preview page.  | 
                                                        |
| 1145 | + *  | 
                                                        |
| 1146 | + * @since 1.0.0  | 
                                                        |
| 1147 | + * @param float $post_avgratings Average rating for the surrent post.  | 
                                                        |
| 1148 | + * @param int $post->ID Current post ID.  | 
                                                        |
| 1149 | + */  | 
                                                        |
| 1150 | +		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
 | 
                                                        |
| 1151 | +  | 
                                                        |
| 1152 | + $html = '<p style=" float:left;">';  | 
                                                        |
| 1153 | + $html .= geodir_get_rating_stars($post_avgratings, $post->ID);  | 
                                                        |
| 1154 | + $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';  | 
                                                        |
| 1155 | + $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;  | 
                                                        |
| 1156 | 1156 | |
| 1157 | 1157 |  	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
 | 
                                                        
| 1158 | 1158 | |
| 1159 | 1159 |  	   $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 />';
 | 
                                                        
| 1160 | 1160 | |
| 1161 | - $html .= '<span class="item">';  | 
                                                        |
| 1162 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';  | 
                                                        |
| 1161 | + $html .= '<span class="item">';  | 
                                                        |
| 1162 | + $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';  | 
                                                        |
| 1163 | 1163 | |
| 1164 | -        if ($post_images) {
 | 
                                                        |
| 1165 | -            foreach ($post_images as $img) {
 | 
                                                        |
| 1166 | - $post_img = $img->src;  | 
                                                        |
| 1167 | - break;  | 
                                                        |
| 1168 | - }  | 
                                                        |
| 1169 | - }  | 
                                                        |
| 1170 | -  | 
                                                        |
| 1171 | -        if (isset($post_img) && $post_img) {
 | 
                                                        |
| 1172 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';  | 
                                                        |
| 1173 | - }  | 
                                                        |
| 1174 | -  | 
                                                        |
| 1175 | - $html .= '</span>';  | 
                                                        |
| 1176 | -  | 
                                                        |
| 1177 | - echo $html .= '</div>';  | 
                                                        |
| 1178 | - /**  | 
                                                        |
| 1179 | - * This is called after the rating html in the function geodir_detail_page_review_rating().  | 
                                                        |
| 1180 | - *  | 
                                                        |
| 1181 | - * This is called inside the check for an actual rating and the check for preview page.  | 
                                                        |
| 1182 | - *  | 
                                                        |
| 1183 | - * @since 1.0.0  | 
                                                        |
| 1184 | - * @param float $post_avgratings Average rating for the surrent post.  | 
                                                        |
| 1185 | - * @param int $post->ID Current post ID.  | 
                                                        |
| 1186 | - */  | 
                                                        |
| 1187 | -        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
 | 
                                                        |
| 1188 | - }  | 
                                                        |
| 1189 | - /**  | 
                                                        |
| 1190 | - * This is called before the rating html in the function geodir_detail_page_review_rating().  | 
                                                        |
| 1191 | - *  | 
                                                        |
| 1192 | - * This is called outside the check for an actual rating and the check for preview page.  | 
                                                        |
| 1193 | - *  | 
                                                        |
| 1194 | - * @since 1.0.0  | 
                                                        |
| 1195 | - */  | 
                                                        |
| 1196 | -    do_action('geodir_after_detail_page_review_rating');
 | 
                                                        |
| 1197 | - $content_html = ob_get_clean();  | 
                                                        |
| 1198 | -    if (trim($content_html) != '') {
 | 
                                                        |
| 1199 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';  | 
                                                        |
| 1200 | - }  | 
                                                        |
| 1201 | -    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
 | 
                                                        |
| 1202 | - /**  | 
                                                        |
| 1203 | - * Filter the geodir_detail_page_review_rating() function content.  | 
                                                        |
| 1204 | - *  | 
                                                        |
| 1205 | - * @since 1.0.0  | 
                                                        |
| 1206 | - * @param string $content_html The output html of the geodir_detail_page_review_rating() function.  | 
                                                        |
| 1207 | - */  | 
                                                        |
| 1208 | -        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
 | 
                                                        |
| 1209 | - }  | 
                                                        |
| 1164 | +		if ($post_images) {
 | 
                                                        |
| 1165 | +			foreach ($post_images as $img) {
 | 
                                                        |
| 1166 | + $post_img = $img->src;  | 
                                                        |
| 1167 | + break;  | 
                                                        |
| 1168 | + }  | 
                                                        |
| 1169 | + }  | 
                                                        |
| 1170 | +  | 
                                                        |
| 1171 | +		if (isset($post_img) && $post_img) {
 | 
                                                        |
| 1172 | + $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';  | 
                                                        |
| 1173 | + }  | 
                                                        |
| 1174 | +  | 
                                                        |
| 1175 | + $html .= '</span>';  | 
                                                        |
| 1176 | +  | 
                                                        |
| 1177 | + echo $html .= '</div>';  | 
                                                        |
| 1178 | + /**  | 
                                                        |
| 1179 | + * This is called after the rating html in the function geodir_detail_page_review_rating().  | 
                                                        |
| 1180 | + *  | 
                                                        |
| 1181 | + * This is called inside the check for an actual rating and the check for preview page.  | 
                                                        |
| 1182 | + *  | 
                                                        |
| 1183 | + * @since 1.0.0  | 
                                                        |
| 1184 | + * @param float $post_avgratings Average rating for the surrent post.  | 
                                                        |
| 1185 | + * @param int $post->ID Current post ID.  | 
                                                        |
| 1186 | + */  | 
                                                        |
| 1187 | +		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
 | 
                                                        |
| 1188 | + }  | 
                                                        |
| 1189 | + /**  | 
                                                        |
| 1190 | + * This is called before the rating html in the function geodir_detail_page_review_rating().  | 
                                                        |
| 1191 | + *  | 
                                                        |
| 1192 | + * This is called outside the check for an actual rating and the check for preview page.  | 
                                                        |
| 1193 | + *  | 
                                                        |
| 1194 | + * @since 1.0.0  | 
                                                        |
| 1195 | + */  | 
                                                        |
| 1196 | +	do_action('geodir_after_detail_page_review_rating');
 | 
                                                        |
| 1197 | + $content_html = ob_get_clean();  | 
                                                        |
| 1198 | +	if (trim($content_html) != '') {
 | 
                                                        |
| 1199 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';  | 
                                                        |
| 1200 | + }  | 
                                                        |
| 1201 | +	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
 | 
                                                        |
| 1202 | + /**  | 
                                                        |
| 1203 | + * Filter the geodir_detail_page_review_rating() function content.  | 
                                                        |
| 1204 | + *  | 
                                                        |
| 1205 | + * @since 1.0.0  | 
                                                        |
| 1206 | + * @param string $content_html The output html of the geodir_detail_page_review_rating() function.  | 
                                                        |
| 1207 | + */  | 
                                                        |
| 1208 | +		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
 | 
                                                        |
| 1209 | + }  | 
                                                        |
| 1210 | 1210 | }  | 
                                                        
| 1211 | 1211 | |
| 1212 | 1212 | /**  | 
                                                        
@@ -1218,35 +1218,35 @@ discard block  | 
                                                    ||
| 1218 | 1218 | */  | 
                                                        
| 1219 | 1219 | function geodir_detail_page_more_info()  | 
                                                        
| 1220 | 1220 |  {
 | 
                                                        
| 1221 | - ob_start(); // Start buffering;  | 
                                                        |
| 1222 | - /**  | 
                                                        |
| 1223 | - * This is called before the info section html.  | 
                                                        |
| 1224 | - *  | 
                                                        |
| 1225 | - * @since 1.0.0  | 
                                                        |
| 1226 | - */  | 
                                                        |
| 1227 | -    do_action('geodir_before_detail_page_more_info');
 | 
                                                        |
| 1228 | -    if ($geodir_post_detail_fields = geodir_show_listing_info()) {
 | 
                                                        |
| 1229 | - echo $geodir_post_detail_fields;  | 
                                                        |
| 1230 | - }  | 
                                                        |
| 1231 | - /**  | 
                                                        |
| 1232 | - * This is called after the info section html.  | 
                                                        |
| 1233 | - *  | 
                                                        |
| 1234 | - * @since 1.0.0  | 
                                                        |
| 1235 | - */  | 
                                                        |
| 1236 | -    do_action('geodir_after_detail_page_more_info');
 | 
                                                        |
| 1237 | -  | 
                                                        |
| 1238 | - $content_html = ob_get_clean();  | 
                                                        |
| 1239 | - if (trim($content_html) != '')  | 
                                                        |
| 1240 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';  | 
                                                        |
| 1241 | -    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
 | 
                                                        |
| 1242 | - /**  | 
                                                        |
| 1243 | - * Filter the output html for function geodir_detail_page_more_info().  | 
                                                        |
| 1244 | - *  | 
                                                        |
| 1245 | - * @since 1.0.0  | 
                                                        |
| 1246 | - * @param string $content_html The output html of the geodir_detail_page_more_info() function.  | 
                                                        |
| 1247 | - */  | 
                                                        |
| 1248 | -        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
 | 
                                                        |
| 1249 | - }  | 
                                                        |
| 1221 | + ob_start(); // Start buffering;  | 
                                                        |
| 1222 | + /**  | 
                                                        |
| 1223 | + * This is called before the info section html.  | 
                                                        |
| 1224 | + *  | 
                                                        |
| 1225 | + * @since 1.0.0  | 
                                                        |
| 1226 | + */  | 
                                                        |
| 1227 | +	do_action('geodir_before_detail_page_more_info');
 | 
                                                        |
| 1228 | +	if ($geodir_post_detail_fields = geodir_show_listing_info()) {
 | 
                                                        |
| 1229 | + echo $geodir_post_detail_fields;  | 
                                                        |
| 1230 | + }  | 
                                                        |
| 1231 | + /**  | 
                                                        |
| 1232 | + * This is called after the info section html.  | 
                                                        |
| 1233 | + *  | 
                                                        |
| 1234 | + * @since 1.0.0  | 
                                                        |
| 1235 | + */  | 
                                                        |
| 1236 | +	do_action('geodir_after_detail_page_more_info');
 | 
                                                        |
| 1237 | +  | 
                                                        |
| 1238 | + $content_html = ob_get_clean();  | 
                                                        |
| 1239 | + if (trim($content_html) != '')  | 
                                                        |
| 1240 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';  | 
                                                        |
| 1241 | +	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
 | 
                                                        |
| 1242 | + /**  | 
                                                        |
| 1243 | + * Filter the output html for function geodir_detail_page_more_info().  | 
                                                        |
| 1244 | + *  | 
                                                        |
| 1245 | + * @since 1.0.0  | 
                                                        |
| 1246 | + * @param string $content_html The output html of the geodir_detail_page_more_info() function.  | 
                                                        |
| 1247 | + */  | 
                                                        |
| 1248 | +		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
 | 
                                                        |
| 1249 | + }  | 
                                                        |
| 1250 | 1250 | }  | 
                                                        
| 1251 | 1251 | |
| 1252 | 1252 | |
@@ -1260,15 +1260,15 @@ discard block  | 
                                                    ||
| 1260 | 1260 | */  | 
                                                        
| 1261 | 1261 | function geodir_localize_all_js_msg()  | 
                                                        
| 1262 | 1262 |  {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
 | 
                                                        
| 1263 | -    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
 | 
                                                        |
| 1264 | -        $ajax_url = admin_url('admin-ajax.php');
 | 
                                                        |
| 1265 | -    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
 | 
                                                        |
| 1266 | -        $ajax_url = admin_url('admin-ajax.php');
 | 
                                                        |
| 1267 | -    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
 | 
                                                        |
| 1268 | -        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
 | 
                                                        |
| 1269 | -    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
 | 
                                                        |
| 1270 | -        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
 | 
                                                        |
| 1271 | - }  | 
                                                        |
| 1263 | +	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
 | 
                                                        |
| 1264 | +		$ajax_url = admin_url('admin-ajax.php');
 | 
                                                        |
| 1265 | +	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
 | 
                                                        |
| 1266 | +		$ajax_url = admin_url('admin-ajax.php');
 | 
                                                        |
| 1267 | +	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
 | 
                                                        |
| 1268 | +		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
 | 
                                                        |
| 1269 | +	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
 | 
                                                        |
| 1270 | +		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
 | 
                                                        |
| 1271 | + }  | 
                                                        |
| 1272 | 1272 | |
| 1273 | 1273 | /**  | 
                                                        
| 1274 | 1274 | * Filter the allowed image type extensions for post images.  | 
                                                        
@@ -1278,59 +1278,59 @@ discard block  | 
                                                    ||
| 1278 | 1278 | */  | 
                                                        
| 1279 | 1279 |  	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
 | 
                                                        
| 1280 | 1280 | |
| 1281 | -    $default_marker_icon = get_option('geodir_default_marker_icon');
 | 
                                                        |
| 1282 | -    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
 | 
                                                        |
| 1283 | - $default_marker_width = $default_marker_size['w'];  | 
                                                        |
| 1284 | - $default_marker_height = $default_marker_size['h'];  | 
                                                        |
| 1281 | +	$default_marker_icon = get_option('geodir_default_marker_icon');
 | 
                                                        |
| 1282 | +	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
 | 
                                                        |
| 1283 | + $default_marker_width = $default_marker_size['w'];  | 
                                                        |
| 1284 | + $default_marker_height = $default_marker_size['h'];  | 
                                                        |
| 1285 | 1285 | |
| 1286 | - $arr_alert_msg = array(  | 
                                                        |
| 1287 | - 'geodir_plugin_url' => geodir_plugin_url(),  | 
                                                        |
| 1288 | - 'geodir_admin_ajax_url' => $ajax_url,  | 
                                                        |
| 1289 | -        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
 | 
                                                        |
| 1290 | -        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
 | 
                                                        |
| 1291 | -        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
 | 
                                                        |
| 1292 | -        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
 | 
                                                        |
| 1293 | - //start not show alert msg  | 
                                                        |
| 1294 | -        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
 | 
                                                        |
| 1295 | -        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
 | 
                                                        |
| 1296 | -        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
 | 
                                                        |
| 1297 | -        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
 | 
                                                        |
| 1298 | -        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
 | 
                                                        |
| 1299 | - // end not show alert msg  | 
                                                        |
| 1300 | -        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
 | 
                                                        |
| 1301 | - //start not show alert msg  | 
                                                        |
| 1302 | -        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
 | 
                                                        |
| 1303 | -        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
 | 
                                                        |
| 1304 | -        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
 | 
                                                        |
| 1305 | -        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
 | 
                                                        |
| 1306 | -        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
 | 
                                                        |
| 1307 | -        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
 | 
                                                        |
| 1308 | -        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
 | 
                                                        |
| 1309 | -        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
 | 
                                                        |
| 1310 | -        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
 | 
                                                        |
| 1311 | -        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
 | 
                                                        |
| 1312 | -        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
 | 
                                                        |
| 1313 | -        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
 | 
                                                        |
| 1314 | - 'geodir_default_marker_icon' => $default_marker_icon,  | 
                                                        |
| 1315 | - 'geodir_default_marker_w' => $default_marker_width,  | 
                                                        |
| 1316 | - 'geodir_default_marker_h' => $default_marker_height,  | 
                                                        |
| 1317 | - 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,  | 
                                                        |
| 1318 | - 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,  | 
                                                        |
| 1319 | -        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
 | 
                                                        |
| 1320 | -        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
 | 
                                                        |
| 1321 | -        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
 | 
                                                        |
| 1322 | -        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
 | 
                                                        |
| 1323 | -        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
 | 
                                                        |
| 1324 | -        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
 | 
                                                        |
| 1325 | - /* on/off dragging for phone devices */  | 
                                                        |
| 1326 | -        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
 | 
                                                        |
| 1327 | - 'geodir_is_mobile' => wp_is_mobile() ? true : false,  | 
                                                        |
| 1328 | -        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
 | 
                                                        |
| 1329 | -        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
 | 
                                                        |
| 1330 | -        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
 | 
                                                        |
| 1331 | -        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
 | 
                                                        |
| 1332 | -        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
 | 
                                                        |
| 1333 | -        'geodir_action_remove' => __('Remove', 'geodirectory'),
 | 
                                                        |
| 1286 | + $arr_alert_msg = array(  | 
                                                        |
| 1287 | + 'geodir_plugin_url' => geodir_plugin_url(),  | 
                                                        |
| 1288 | + 'geodir_admin_ajax_url' => $ajax_url,  | 
                                                        |
| 1289 | +		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
 | 
                                                        |
| 1290 | +		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
 | 
                                                        |
| 1291 | +		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
 | 
                                                        |
| 1292 | +		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
 | 
                                                        |
| 1293 | + //start not show alert msg  | 
                                                        |
| 1294 | +		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
 | 
                                                        |
| 1295 | +		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
 | 
                                                        |
| 1296 | +		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
 | 
                                                        |
| 1297 | +		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
 | 
                                                        |
| 1298 | +		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
 | 
                                                        |
| 1299 | + // end not show alert msg  | 
                                                        |
| 1300 | +		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
 | 
                                                        |
| 1301 | + //start not show alert msg  | 
                                                        |
| 1302 | +		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
 | 
                                                        |
| 1303 | +		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
 | 
                                                        |
| 1304 | +		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
 | 
                                                        |
| 1305 | +		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
 | 
                                                        |
| 1306 | +		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
 | 
                                                        |
| 1307 | +		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
 | 
                                                        |
| 1308 | +		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
 | 
                                                        |
| 1309 | +		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
 | 
                                                        |
| 1310 | +		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
 | 
                                                        |
| 1311 | +		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
 | 
                                                        |
| 1312 | +		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
 | 
                                                        |
| 1313 | +		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
 | 
                                                        |
| 1314 | + 'geodir_default_marker_icon' => $default_marker_icon,  | 
                                                        |
| 1315 | + 'geodir_default_marker_w' => $default_marker_width,  | 
                                                        |
| 1316 | + 'geodir_default_marker_h' => $default_marker_height,  | 
                                                        |
| 1317 | + 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,  | 
                                                        |
| 1318 | + 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,  | 
                                                        |
| 1319 | +		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
 | 
                                                        |
| 1320 | +		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
 | 
                                                        |
| 1321 | +		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
 | 
                                                        |
| 1322 | +		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
 | 
                                                        |
| 1323 | +		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
 | 
                                                        |
| 1324 | +		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
 | 
                                                        |
| 1325 | + /* on/off dragging for phone devices */  | 
                                                        |
| 1326 | +		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
 | 
                                                        |
| 1327 | + 'geodir_is_mobile' => wp_is_mobile() ? true : false,  | 
                                                        |
| 1328 | +		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
 | 
                                                        |
| 1329 | +		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
 | 
                                                        |
| 1330 | +		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
 | 
                                                        |
| 1331 | +		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
 | 
                                                        |
| 1332 | +		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
 | 
                                                        |
| 1333 | +		'geodir_action_remove' => __('Remove', 'geodirectory'),
 | 
                                                        |
| 1334 | 1334 |  		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
 | 
                                                        
| 1335 | 1335 |  		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
 | 
                                                        
| 1336 | 1336 |  		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
 | 
                                                        
@@ -1338,29 +1338,29 @@ discard block  | 
                                                    ||
| 1338 | 1338 |  		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
 | 
                                                        
| 1339 | 1339 |  		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
 | 
                                                        
| 1340 | 1340 |  		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
 | 
                                                        
| 1341 | - 'geodir_map_name' => geodir_map_name(),  | 
                                                        |
| 1342 | - );  | 
                                                        |
| 1343 | -  | 
                                                        |
| 1344 | - /**  | 
                                                        |
| 1345 | - * Filters the translated JS strings from function geodir_localize_all_js_msg().  | 
                                                        |
| 1346 | - *  | 
                                                        |
| 1347 | - * With this filter you can add, remove or change translated JS strings.  | 
                                                        |
| 1348 | - * You should add your own translations to this if you are building an addon rather than adding another script block.  | 
                                                        |
| 1349 | - *  | 
                                                        |
| 1350 | - * @since 1.0.0  | 
                                                        |
| 1351 | - */  | 
                                                        |
| 1352 | -    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
 | 
                                                        |
| 1353 | -  | 
                                                        |
| 1354 | -    foreach ($arr_alert_msg as $key => $value) {
 | 
                                                        |
| 1355 | - if (!is_scalar($value))  | 
                                                        |
| 1356 | - continue;  | 
                                                        |
| 1357 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');  | 
                                                        |
| 1358 | - }  | 
                                                        |
| 1341 | + 'geodir_map_name' => geodir_map_name(),  | 
                                                        |
| 1342 | + );  | 
                                                        |
| 1343 | +  | 
                                                        |
| 1344 | + /**  | 
                                                        |
| 1345 | + * Filters the translated JS strings from function geodir_localize_all_js_msg().  | 
                                                        |
| 1346 | + *  | 
                                                        |
| 1347 | + * With this filter you can add, remove or change translated JS strings.  | 
                                                        |
| 1348 | + * You should add your own translations to this if you are building an addon rather than adding another script block.  | 
                                                        |
| 1349 | + *  | 
                                                        |
| 1350 | + * @since 1.0.0  | 
                                                        |
| 1351 | + */  | 
                                                        |
| 1352 | +	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
 | 
                                                        |
| 1353 | +  | 
                                                        |
| 1354 | +	foreach ($arr_alert_msg as $key => $value) {
 | 
                                                        |
| 1355 | + if (!is_scalar($value))  | 
                                                        |
| 1356 | + continue;  | 
                                                        |
| 1357 | + $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');  | 
                                                        |
| 1358 | + }  | 
                                                        |
| 1359 | 1359 | |
| 1360 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';  | 
                                                        |
| 1361 | - echo '<script>';  | 
                                                        |
| 1362 | - echo $script;  | 
                                                        |
| 1363 | - echo '</script>';  | 
                                                        |
| 1360 | + $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';  | 
                                                        |
| 1361 | + echo '<script>';  | 
                                                        |
| 1362 | + echo $script;  | 
                                                        |
| 1363 | + echo '</script>';  | 
                                                        |
| 1364 | 1364 | }  | 
                                                        
| 1365 | 1365 | |
| 1366 | 1366 |  add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
 | 
                                                        
@@ -1376,9 +1376,9 @@ discard block  | 
                                                    ||
| 1376 | 1376 | */  | 
                                                        
| 1377 | 1377 | function geodir_admin_bar_site_menu($wp_admin_bar)  | 
                                                        
| 1378 | 1378 |  {
 | 
                                                        
| 1379 | -    if (get_option("geodir_installed")) {
 | 
                                                        |
| 1380 | -        $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
 | 
                                                        |
| 1381 | - }  | 
                                                        |
| 1379 | +	if (get_option("geodir_installed")) {
 | 
                                                        |
| 1380 | +		$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
 | 
                                                        |
| 1381 | + }  | 
                                                        |
| 1382 | 1382 | }  | 
                                                        
| 1383 | 1383 | |
| 1384 | 1384 |  add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
 | 
                                                        
@@ -1404,25 +1404,25 @@ discard block  | 
                                                    ||
| 1404 | 1404 | */  | 
                                                        
| 1405 | 1405 | function geodir_store_sidebars()  | 
                                                        
| 1406 | 1406 |  {
 | 
                                                        
| 1407 | - global $geodir_sidebars;  | 
                                                        |
| 1408 | - global $sidebars_widgets;  | 
                                                        |
| 1409 | -  | 
                                                        |
| 1410 | - if (!is_array($sidebars_widgets))  | 
                                                        |
| 1411 | - $sidebars_widgets = wp_get_sidebars_widgets();  | 
                                                        |
| 1412 | - $geodir_old_sidebars = array();  | 
                                                        |
| 1413 | -  | 
                                                        |
| 1414 | -    if (is_array($geodir_sidebars)) {
 | 
                                                        |
| 1415 | -        foreach ($geodir_sidebars as $val) {
 | 
                                                        |
| 1416 | -            if (is_array($sidebars_widgets)) {
 | 
                                                        |
| 1417 | - if (array_key_exists($val, $sidebars_widgets))  | 
                                                        |
| 1418 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val];  | 
                                                        |
| 1419 | - else  | 
                                                        |
| 1420 | - $geodir_old_sidebars[$val] = array();  | 
                                                        |
| 1421 | - }  | 
                                                        |
| 1422 | - }  | 
                                                        |
| 1423 | - }  | 
                                                        |
| 1424 | -    update_option('geodir_sidebars', $geodir_old_sidebars);
 | 
                                                        |
| 1425 | -    geodir_option_version_backup('geodir_sidebars');
 | 
                                                        |
| 1407 | + global $geodir_sidebars;  | 
                                                        |
| 1408 | + global $sidebars_widgets;  | 
                                                        |
| 1409 | +  | 
                                                        |
| 1410 | + if (!is_array($sidebars_widgets))  | 
                                                        |
| 1411 | + $sidebars_widgets = wp_get_sidebars_widgets();  | 
                                                        |
| 1412 | + $geodir_old_sidebars = array();  | 
                                                        |
| 1413 | +  | 
                                                        |
| 1414 | +	if (is_array($geodir_sidebars)) {
 | 
                                                        |
| 1415 | +		foreach ($geodir_sidebars as $val) {
 | 
                                                        |
| 1416 | +			if (is_array($sidebars_widgets)) {
 | 
                                                        |
| 1417 | + if (array_key_exists($val, $sidebars_widgets))  | 
                                                        |
| 1418 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val];  | 
                                                        |
| 1419 | + else  | 
                                                        |
| 1420 | + $geodir_old_sidebars[$val] = array();  | 
                                                        |
| 1421 | + }  | 
                                                        |
| 1422 | + }  | 
                                                        |
| 1423 | + }  | 
                                                        |
| 1424 | +	update_option('geodir_sidebars', $geodir_old_sidebars);
 | 
                                                        |
| 1425 | +	geodir_option_version_backup('geodir_sidebars');
 | 
                                                        |
| 1426 | 1426 | |
| 1427 | 1427 | }  | 
                                                        
| 1428 | 1428 | |
@@ -1436,28 +1436,28 @@ discard block  | 
                                                    ||
| 1436 | 1436 | */  | 
                                                        
| 1437 | 1437 | function geodir_restore_sidebars()  | 
                                                        
| 1438 | 1438 |  {
 | 
                                                        
| 1439 | - global $sidebars_widgets;  | 
                                                        |
| 1440 | -  | 
                                                        |
| 1441 | - if (!is_array($sidebars_widgets))  | 
                                                        |
| 1442 | - $sidebars_widgets = wp_get_sidebars_widgets();  | 
                                                        |
| 1443 | -  | 
                                                        |
| 1444 | -    if (is_array($sidebars_widgets)) {
 | 
                                                        |
| 1445 | -        $geodir_old_sidebars = get_option('geodir_sidebars');
 | 
                                                        |
| 1446 | -        if (is_array($geodir_old_sidebars)) {
 | 
                                                        |
| 1447 | -            foreach ($geodir_old_sidebars as $key => $val) {
 | 
                                                        |
| 1448 | - if(0 === strpos($key, 'geodir_'))// if gd widget  | 
                                                        |
| 1449 | -                {
 | 
                                                        |
| 1450 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key];  | 
                                                        |
| 1451 | - }  | 
                                                        |
| 1439 | + global $sidebars_widgets;  | 
                                                        |
| 1452 | 1440 | |
| 1441 | + if (!is_array($sidebars_widgets))  | 
                                                        |
| 1442 | + $sidebars_widgets = wp_get_sidebars_widgets();  | 
                                                        |
| 1453 | 1443 | |
| 1454 | - }  | 
                                                        |
| 1455 | - }  | 
                                                        |
| 1444 | +	if (is_array($sidebars_widgets)) {
 | 
                                                        |
| 1445 | +		$geodir_old_sidebars = get_option('geodir_sidebars');
 | 
                                                        |
| 1446 | +		if (is_array($geodir_old_sidebars)) {
 | 
                                                        |
| 1447 | +			foreach ($geodir_old_sidebars as $key => $val) {
 | 
                                                        |
| 1448 | + if(0 === strpos($key, 'geodir_'))// if gd widget  | 
                                                        |
| 1449 | +				{
 | 
                                                        |
| 1450 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key];  | 
                                                        |
| 1451 | + }  | 
                                                        |
| 1456 | 1452 | |
| 1457 | - }  | 
                                                        |
| 1458 | 1453 | |
| 1459 | -    update_option('sidebars_widgets', $sidebars_widgets);
 | 
                                                        |
| 1460 | -    update_option('geodir_sidebars', '');
 | 
                                                        |
| 1454 | + }  | 
                                                        |
| 1455 | + }  | 
                                                        |
| 1456 | +  | 
                                                        |
| 1457 | + }  | 
                                                        |
| 1458 | +  | 
                                                        |
| 1459 | +	update_option('sidebars_widgets', $sidebars_widgets);
 | 
                                                        |
| 1460 | +	update_option('geodir_sidebars', '');
 | 
                                                        |
| 1461 | 1461 | }  | 
                                                        
| 1462 | 1462 | |
| 1463 | 1463 |  add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
 | 
                                                        
@@ -1470,9 +1470,9 @@ discard block  | 
                                                    ||
| 1470 | 1470 | */  | 
                                                        
| 1471 | 1471 | function geodir_after_listing_post_gridview()  | 
                                                        
| 1472 | 1472 |  {
 | 
                                                        
| 1473 | - global $gridview_columns;  | 
                                                        |
| 1473 | + global $gridview_columns;  | 
                                                        |
| 1474 | 1474 | |
| 1475 | - $gridview_columns = '';  | 
                                                        |
| 1475 | + $gridview_columns = '';  | 
                                                        |
| 1476 | 1476 | |
| 1477 | 1477 | }  | 
                                                        
| 1478 | 1478 | |
@@ -1500,11 +1500,11 @@ discard block  | 
                                                    ||
| 1500 | 1500 | */  | 
                                                        
| 1501 | 1501 | function so_handle_038($url, $original_url, $_context)  | 
                                                        
| 1502 | 1502 |  {
 | 
                                                        
| 1503 | -    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
 | 
                                                        |
| 1504 | -        $url = str_replace("&", "&", $url); // or $url = $original_url
 | 
                                                        |
| 1505 | - }  | 
                                                        |
| 1503 | +	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
 | 
                                                        |
| 1504 | +		$url = str_replace("&", "&", $url); // or $url = $original_url
 | 
                                                        |
| 1505 | + }  | 
                                                        |
| 1506 | 1506 | |
| 1507 | - return $url;  | 
                                                        |
| 1507 | + return $url;  | 
                                                        |
| 1508 | 1508 | }  | 
                                                        
| 1509 | 1509 | |
| 1510 | 1510 | |
@@ -1520,34 +1520,34 @@ discard block  | 
                                                    ||
| 1520 | 1520 |  function geodir_after_main_form_fields() {
 | 
                                                        
| 1521 | 1521 | global $gd_session;  | 
                                                        
| 1522 | 1522 | |
| 1523 | -    if (get_option('geodir_accept_term_condition')) {
 | 
                                                        |
| 1524 | - global $post;  | 
                                                        |
| 1525 | - $term_condition = '';  | 
                                                        |
| 1526 | -        if (isset($_REQUEST['backandedit'])) {
 | 
                                                        |
| 1527 | -            $post = (object)$gd_session->get('listing');
 | 
                                                        |
| 1528 | - $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';  | 
                                                        |
| 1529 | - }  | 
                                                        |
| 1530 | -  | 
                                                        |
| 1531 | - ?>  | 
                                                        |
| 1523 | +	if (get_option('geodir_accept_term_condition')) {
 | 
                                                        |
| 1524 | + global $post;  | 
                                                        |
| 1525 | + $term_condition = '';  | 
                                                        |
| 1526 | +		if (isset($_REQUEST['backandedit'])) {
 | 
                                                        |
| 1527 | +			$post = (object)$gd_session->get('listing');
 | 
                                                        |
| 1528 | + $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';  | 
                                                        |
| 1529 | + }  | 
                                                        |
| 1530 | +  | 
                                                        |
| 1531 | + ?>  | 
                                                        |
| 1532 | 1532 | <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">  | 
                                                        
| 1533 | 1533 | <label> </label>  | 
                                                        
| 1534 | 1534 | |
| 1535 | 1535 | <div class="geodir_taxonomy_field" style="float:left; width:70%;">  | 
                                                        
| 1536 | 1536 | <span style="display:block">  | 
                                                        
| 1537 | 1537 |  				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
 | 
                                                        
| 1538 | - echo 'checked="checked"';  | 
                                                        |
| 1539 | - } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"  | 
                                                        |
| 1538 | + echo 'checked="checked"';  | 
                                                        |
| 1539 | + } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"  | 
                                                        |
| 1540 | 1540 | class="geodir_textfield" value="1"  | 
                                                        
| 1541 | 1541 |                         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>
 | 
                                                        
| 1542 | 1542 | </span>  | 
                                                        
| 1543 | 1543 | </div>  | 
                                                        
| 1544 | 1544 |              <span class="geodir_message_error"><?php if (isset($required_msg)) {
 | 
                                                        
| 1545 | - _e($required_msg, 'geodirectory');  | 
                                                        |
| 1546 | - } ?></span>  | 
                                                        |
| 1545 | + _e($required_msg, 'geodirectory');  | 
                                                        |
| 1546 | + } ?></span>  | 
                                                        |
| 1547 | 1547 | </div>  | 
                                                        
| 1548 | 1548 | <?php  | 
                                                        
| 1549 | 1549 | |
| 1550 | - }  | 
                                                        |
| 1550 | + }  | 
                                                        |
| 1551 | 1551 | }  | 
                                                        
| 1552 | 1552 | |
| 1553 | 1553 | |
@@ -1572,42 +1572,42 @@ discard block  | 
                                                    ||
| 1572 | 1572 | */  | 
                                                        
| 1573 | 1573 | function geodir_detail_page_tab_is_display($is_display, $tab)  | 
                                                        
| 1574 | 1574 |  {
 | 
                                                        
| 1575 | - global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;  | 
                                                        |
| 1575 | + global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;  | 
                                                        |
| 1576 | 1576 | |
| 1577 | -    if ($tab == 'post_profile') {
 | 
                                                        |
| 1578 | - /** This action is documented in geodirectory_template_actions.php */  | 
                                                        |
| 1579 | -        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
 | 
                                                        |
| 1577 | +	if ($tab == 'post_profile') {
 | 
                                                        |
| 1578 | + /** This action is documented in geodirectory_template_actions.php */  | 
                                                        |
| 1579 | +		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
 | 
                                                        |
| 1580 | 1580 | |
| 1581 | -        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
 | 
                                                        |
| 1582 | - $is_display = false;  | 
                                                        |
| 1583 | - }  | 
                                                        |
| 1584 | - }  | 
                                                        |
| 1581 | +		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
 | 
                                                        |
| 1582 | + $is_display = false;  | 
                                                        |
| 1583 | + }  | 
                                                        |
| 1584 | + }  | 
                                                        |
| 1585 | 1585 | |
| 1586 | - if ($tab == 'post_info')  | 
                                                        |
| 1587 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false;  | 
                                                        |
| 1586 | + if ($tab == 'post_info')  | 
                                                        |
| 1587 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false;  | 
                                                        |
| 1588 | 1588 | |
| 1589 | - if ($tab == 'post_images')  | 
                                                        |
| 1590 | - $is_display = (!empty($post_images)) ? true : false;  | 
                                                        |
| 1589 | + if ($tab == 'post_images')  | 
                                                        |
| 1590 | + $is_display = (!empty($post_images)) ? true : false;  | 
                                                        |
| 1591 | 1591 | |
| 1592 | - if ($tab == 'post_video')  | 
                                                        |
| 1593 | - $is_display = (!empty($video)) ? true : false;  | 
                                                        |
| 1592 | + if ($tab == 'post_video')  | 
                                                        |
| 1593 | + $is_display = (!empty($video)) ? true : false;  | 
                                                        |
| 1594 | 1594 | |
| 1595 | - if ($tab == 'special_offers')  | 
                                                        |
| 1596 | - $is_display = (!empty($special_offers)) ? true : false;  | 
                                                        |
| 1595 | + if ($tab == 'special_offers')  | 
                                                        |
| 1596 | + $is_display = (!empty($special_offers)) ? true : false;  | 
                                                        |
| 1597 | 1597 | |
| 1598 | - if ($tab == 'reviews')  | 
                                                        |
| 1599 | -        $is_display = (geodir_is_page('detail')) ? true : false;
 | 
                                                        |
| 1598 | + if ($tab == 'reviews')  | 
                                                        |
| 1599 | +		$is_display = (geodir_is_page('detail')) ? true : false;
 | 
                                                        |
| 1600 | 1600 | |
| 1601 | -    if ($tab == 'related_listing') {
 | 
                                                        |
| 1602 | -       $message = __('No listings found which match your selection.', 'geodirectory');
 | 
                                                        |
| 1601 | +	if ($tab == 'related_listing') {
 | 
                                                        |
| 1602 | +	   $message = __('No listings found which match your selection.', 'geodirectory');
 | 
                                                        |
| 1603 | 1603 | |
| 1604 | - /** This action is documented in geodirectory-functions/template_functions.php */  | 
                                                        |
| 1605 | -       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
 | 
                                                        |
| 1604 | + /** This action is documented in geodirectory-functions/template_functions.php */  | 
                                                        |
| 1605 | +	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
 | 
                                                        |
| 1606 | 1606 | |
| 1607 | -       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
 | 
                                                        |
| 1608 | - }  | 
                                                        |
| 1607 | +	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
 | 
                                                        |
| 1608 | + }  | 
                                                        |
| 1609 | 1609 | |
| 1610 | - return $is_display;  | 
                                                        |
| 1610 | + return $is_display;  | 
                                                        |
| 1611 | 1611 | }  | 
                                                        
| 1612 | 1612 | |
| 1613 | 1613 | |
@@ -1623,69 +1623,69 @@ discard block  | 
                                                    ||
| 1623 | 1623 | * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        
| 1624 | 1624 | */  | 
                                                        
| 1625 | 1625 |  function geodir_changes_in_custom_fields_table() {
 | 
                                                        
| 1626 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 1626 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 1627 | 1627 | |
| 1628 | 1628 | // Remove unused virtual page  | 
                                                        
| 1629 | 1629 |  	$listings_page_id = (int)get_option('geodir_listing_page');
 | 
                                                        
| 1630 | 1630 |  	if ($listings_page_id) {
 | 
                                                        
| 1631 | 1631 |  		$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')));
 | 
                                                        
| 1632 | -        delete_option('geodir_listing_page');
 | 
                                                        |
| 1632 | +		delete_option('geodir_listing_page');
 | 
                                                        |
| 1633 | 1633 | }  | 
                                                        
| 1634 | 1634 | |
| 1635 | -    if (!get_option('geodir_changes_in_custom_fields_table')) {
 | 
                                                        |
| 1636 | - $wpdb->query(  | 
                                                        |
| 1637 | - $wpdb->prepare(  | 
                                                        |
| 1638 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",  | 
                                                        |
| 1639 | -                array('1', '1', 'admin')
 | 
                                                        |
| 1640 | - )  | 
                                                        |
| 1641 | - );  | 
                                                        |
| 1635 | +	if (!get_option('geodir_changes_in_custom_fields_table')) {
 | 
                                                        |
| 1636 | + $wpdb->query(  | 
                                                        |
| 1637 | + $wpdb->prepare(  | 
                                                        |
| 1638 | + "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",  | 
                                                        |
| 1639 | +				array('1', '1', 'admin')
 | 
                                                        |
| 1640 | + )  | 
                                                        |
| 1641 | + );  | 
                                                        |
| 1642 | 1642 | |
| 1643 | 1643 | |
| 1644 | - /* --- terms meta value set --- */  | 
                                                        |
| 1644 | + /* --- terms meta value set --- */  | 
                                                        |
| 1645 | 1645 | |
| 1646 | -        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
 | 
                                                        |
| 1646 | +		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
 | 
                                                        |
| 1647 | 1647 | |
| 1648 | -        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
 | 
                                                        |
| 1648 | +		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
 | 
                                                        |
| 1649 | 1649 | |
| 1650 | -        if (!empty($options_data)) {
 | 
                                                        |
| 1650 | +		if (!empty($options_data)) {
 | 
                                                        |
| 1651 | 1651 | |
| 1652 | -            foreach ($options_data as $optobj) {
 | 
                                                        |
| 1652 | +			foreach ($options_data as $optobj) {
 | 
                                                        |
| 1653 | 1653 | |
| 1654 | -                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
 | 
                                                        |
| 1654 | +				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
 | 
                                                        |
| 1655 | 1655 | |
| 1656 | -                $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)));
 | 
                                                        |
| 1656 | +				$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)));
 | 
                                                        |
| 1657 | 1657 | |
| 1658 | -                if (!empty($taxonomies_data)) {
 | 
                                                        |
| 1658 | +				if (!empty($taxonomies_data)) {
 | 
                                                        |
| 1659 | 1659 | |
| 1660 | -                    foreach ($taxonomies_data as $taxobj) {
 | 
                                                        |
| 1660 | +					foreach ($taxonomies_data as $taxobj) {
 | 
                                                        |
| 1661 | 1661 | |
| 1662 | - $taxObject = get_taxonomy($taxobj->taxonomy);  | 
                                                        |
| 1663 | - $post_type = $taxObject->object_type[0];  | 
                                                        |
| 1662 | + $taxObject = get_taxonomy($taxobj->taxonomy);  | 
                                                        |
| 1663 | + $post_type = $taxObject->object_type[0];  | 
                                                        |
| 1664 | 1664 | |
| 1665 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;  | 
                                                        |
| 1665 | + $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;  | 
                                                        |
| 1666 | 1666 | |
| 1667 | -                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
 | 
                                                        |
| 1667 | +						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
 | 
                                                        |
| 1668 | 1668 | |
| 1669 | -                        if ($duplicate_data) {
 | 
                                                        |
| 1669 | +						if ($duplicate_data) {
 | 
                                                        |
| 1670 | 1670 | |
| 1671 | -                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
 | 
                                                        |
| 1671 | +							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
 | 
                                                        |
| 1672 | 1672 | |
| 1673 | -                        } else {
 | 
                                                        |
| 1673 | +						} else {
 | 
                                                        |
| 1674 | 1674 | |
| 1675 | -                            $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)));
 | 
                                                        |
| 1675 | +							$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)));
 | 
                                                        |
| 1676 | 1676 | |
| 1677 | - }  | 
                                                        |
| 1677 | + }  | 
                                                        |
| 1678 | 1678 | |
| 1679 | - }  | 
                                                        |
| 1679 | + }  | 
                                                        |
| 1680 | 1680 | |
| 1681 | - }  | 
                                                        |
| 1681 | + }  | 
                                                        |
| 1682 | 1682 | |
| 1683 | - }  | 
                                                        |
| 1684 | - }  | 
                                                        |
| 1683 | + }  | 
                                                        |
| 1684 | + }  | 
                                                        |
| 1685 | 1685 | |
| 1686 | -        update_option('geodir_changes_in_custom_fields_table', '1');
 | 
                                                        |
| 1686 | +		update_option('geodir_changes_in_custom_fields_table', '1');
 | 
                                                        |
| 1687 | 1687 | |
| 1688 | - }  | 
                                                        |
| 1688 | + }  | 
                                                        |
| 1689 | 1689 | |
| 1690 | 1690 | }  | 
                                                        
| 1691 | 1691 | |
@@ -1704,24 +1704,24 @@ discard block  | 
                                                    ||
| 1704 | 1704 | function geodir_location_slug_check($slug)  | 
                                                        
| 1705 | 1705 |  {
 | 
                                                        
| 1706 | 1706 | |
| 1707 | - global $wpdb, $table_prefix;  | 
                                                        |
| 1707 | + global $wpdb, $table_prefix;  | 
                                                        |
| 1708 | 1708 | |
| 1709 | -    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
 | 
                                                        |
| 1709 | +	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
 | 
                                                        |
| 1710 | 1710 | |
| 1711 | -    if ($slug_exists) {
 | 
                                                        |
| 1711 | +	if ($slug_exists) {
 | 
                                                        |
| 1712 | 1712 | |
| 1713 | - $suffix = 1;  | 
                                                        |
| 1714 | -        do {
 | 
                                                        |
| 1715 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";  | 
                                                        |
| 1716 | -            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
 | 
                                                        |
| 1717 | - $suffix++;  | 
                                                        |
| 1718 | - } while ($location_slug_check && $suffix < 100);  | 
                                                        |
| 1713 | + $suffix = 1;  | 
                                                        |
| 1714 | +		do {
 | 
                                                        |
| 1715 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";  | 
                                                        |
| 1716 | +			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
 | 
                                                        |
| 1717 | + $suffix++;  | 
                                                        |
| 1718 | + } while ($location_slug_check && $suffix < 100);  | 
                                                        |
| 1719 | 1719 | |
| 1720 | - $slug = $alt_location_name;  | 
                                                        |
| 1720 | + $slug = $alt_location_name;  | 
                                                        |
| 1721 | 1721 | |
| 1722 | - }  | 
                                                        |
| 1722 | + }  | 
                                                        |
| 1723 | 1723 | |
| 1724 | - return $slug;  | 
                                                        |
| 1724 | + return $slug;  | 
                                                        |
| 1725 | 1725 | |
| 1726 | 1726 | }  | 
                                                        
| 1727 | 1727 | |
@@ -1746,42 +1746,42 @@ discard block  | 
                                                    ||
| 1746 | 1746 | function geodir_update_term_slug($term_id, $tt_id, $taxonomy)  | 
                                                        
| 1747 | 1747 |  {
 | 
                                                        
| 1748 | 1748 | |
| 1749 | - global $wpdb, $plugin_prefix, $table_prefix;  | 
                                                        |
| 1749 | + global $wpdb, $plugin_prefix, $table_prefix;  | 
                                                        |
| 1750 | 1750 | |
| 1751 | -    $tern_data = get_term_by('id', $term_id, $taxonomy);
 | 
                                                        |
| 1751 | +	$tern_data = get_term_by('id', $term_id, $taxonomy);
 | 
                                                        |
| 1752 | 1752 | |
| 1753 | - $slug = $tern_data->slug;  | 
                                                        |
| 1753 | + $slug = $tern_data->slug;  | 
                                                        |
| 1754 | 1754 | |
| 1755 | - /**  | 
                                                        |
| 1756 | - * Filter if a term slug exists.  | 
                                                        |
| 1757 | - *  | 
                                                        |
| 1758 | - * @since 1.0.0  | 
                                                        |
| 1759 | - * @package GeoDirectory  | 
                                                        |
| 1760 | - * @param bool $bool Default: false.  | 
                                                        |
| 1761 | - * @param string $slug The term slug.  | 
                                                        |
| 1762 | - * @param int $term_id The term ID.  | 
                                                        |
| 1763 | - */  | 
                                                        |
| 1764 | -    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
 | 
                                                        |
| 1755 | + /**  | 
                                                        |
| 1756 | + * Filter if a term slug exists.  | 
                                                        |
| 1757 | + *  | 
                                                        |
| 1758 | + * @since 1.0.0  | 
                                                        |
| 1759 | + * @package GeoDirectory  | 
                                                        |
| 1760 | + * @param bool $bool Default: false.  | 
                                                        |
| 1761 | + * @param string $slug The term slug.  | 
                                                        |
| 1762 | + * @param int $term_id The term ID.  | 
                                                        |
| 1763 | + */  | 
                                                        |
| 1764 | +	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
 | 
                                                        |
| 1765 | 1765 | |
| 1766 | -    if ($slug_exists) {
 | 
                                                        |
| 1766 | +	if ($slug_exists) {
 | 
                                                        |
| 1767 | 1767 | |
| 1768 | - $suffix = 1;  | 
                                                        |
| 1769 | -        do {
 | 
                                                        |
| 1770 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";  | 
                                                        |
| 1768 | + $suffix = 1;  | 
                                                        |
| 1769 | +		do {
 | 
                                                        |
| 1770 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";  | 
                                                        |
| 1771 | 1771 | |
| 1772 | - /** This action is documented in geodirectory_hooks_actions.php */  | 
                                                        |
| 1773 | -            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
 | 
                                                        |
| 1772 | + /** This action is documented in geodirectory_hooks_actions.php */  | 
                                                        |
| 1773 | +			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
 | 
                                                        |
| 1774 | 1774 | |
| 1775 | - $suffix++;  | 
                                                        |
| 1776 | - } while ($term_slug_check && $suffix < 100);  | 
                                                        |
| 1775 | + $suffix++;  | 
                                                        |
| 1776 | + } while ($term_slug_check && $suffix < 100);  | 
                                                        |
| 1777 | 1777 | |
| 1778 | - $slug = $new_slug;  | 
                                                        |
| 1778 | + $slug = $new_slug;  | 
                                                        |
| 1779 | 1779 | |
| 1780 | -        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
 | 
                                                        |
| 1780 | +		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
 | 
                                                        |
| 1781 | 1781 | |
| 1782 | -        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
 | 
                                                        |
| 1782 | +		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
 | 
                                                        |
| 1783 | 1783 | |
| 1784 | - }  | 
                                                        |
| 1784 | + }  | 
                                                        |
| 1785 | 1785 | |
| 1786 | 1786 | // Update tag in detail table.  | 
                                                        
| 1787 | 1787 | $taxonomy_obj = get_taxonomy($taxonomy);  | 
                                                        
@@ -1822,21 +1822,21 @@ discard block  | 
                                                    ||
| 1822 | 1822 | function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)  | 
                                                        
| 1823 | 1823 |  {
 | 
                                                        
| 1824 | 1824 | |
| 1825 | - global $wpdb, $table_prefix;  | 
                                                        |
| 1825 | + global $wpdb, $table_prefix;  | 
                                                        |
| 1826 | 1826 | |
| 1827 | - $default_location = geodir_get_default_location();  | 
                                                        |
| 1827 | + $default_location = geodir_get_default_location();  | 
                                                        |
| 1828 | 1828 | |
| 1829 | - $country_slug = $default_location->country_slug;  | 
                                                        |
| 1830 | - $region_slug = $default_location->region_slug;  | 
                                                        |
| 1831 | - $city_slug = $default_location->city_slug;  | 
                                                        |
| 1829 | + $country_slug = $default_location->country_slug;  | 
                                                        |
| 1830 | + $region_slug = $default_location->region_slug;  | 
                                                        |
| 1831 | + $city_slug = $default_location->city_slug;  | 
                                                        |
| 1832 | 1832 | |
| 1833 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)  | 
                                                        |
| 1834 | - return $slug_exists = true;  | 
                                                        |
| 1833 | + if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)  | 
                                                        |
| 1834 | + return $slug_exists = true;  | 
                                                        |
| 1835 | 1835 | |
| 1836 | -    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
 | 
                                                        |
| 1837 | - return $slug_exists = true;  | 
                                                        |
| 1836 | +	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
 | 
                                                        |
| 1837 | + return $slug_exists = true;  | 
                                                        |
| 1838 | 1838 | |
| 1839 | - return $slug_exists;  | 
                                                        |
| 1839 | + return $slug_exists;  | 
                                                        |
| 1840 | 1840 | }  | 
                                                        
| 1841 | 1841 | |
| 1842 | 1842 | |
@@ -1855,75 +1855,75 @@ discard block  | 
                                                    ||
| 1855 | 1855 | */  | 
                                                        
| 1856 | 1856 | function geodir_custom_page_title($title = '', $sep = '')  | 
                                                        
| 1857 | 1857 |  {
 | 
                                                        
| 1858 | - global $wp;  | 
                                                        |
| 1859 | -    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
 | 
                                                        |
| 1860 | - return $title;  | 
                                                        |
| 1861 | - }  | 
                                                        |
| 1858 | + global $wp;  | 
                                                        |
| 1859 | +	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
 | 
                                                        |
| 1860 | + return $title;  | 
                                                        |
| 1861 | + }  | 
                                                        |
| 1862 | 1862 | |
| 1863 | -    if ($sep == '') {
 | 
                                                        |
| 1864 | - /**  | 
                                                        |
| 1865 | - * Filter the page title separator.  | 
                                                        |
| 1866 | - *  | 
                                                        |
| 1867 | - * @since 1.0.0  | 
                                                        |
| 1868 | - * @package GeoDirectory  | 
                                                        |
| 1869 | - * @param string $sep The separator, default: `|`.  | 
                                                        |
| 1870 | - */  | 
                                                        |
| 1871 | -        $sep = apply_filters('geodir_page_title_separator', '|');
 | 
                                                        |
| 1872 | - }  | 
                                                        |
| 1863 | +	if ($sep == '') {
 | 
                                                        |
| 1864 | + /**  | 
                                                        |
| 1865 | + * Filter the page title separator.  | 
                                                        |
| 1866 | + *  | 
                                                        |
| 1867 | + * @since 1.0.0  | 
                                                        |
| 1868 | + * @package GeoDirectory  | 
                                                        |
| 1869 | + * @param string $sep The separator, default: `|`.  | 
                                                        |
| 1870 | + */  | 
                                                        |
| 1871 | +		$sep = apply_filters('geodir_page_title_separator', '|');
 | 
                                                        |
| 1872 | + }  | 
                                                        |
| 1873 | 1873 | |
| 1874 | 1874 | |
| 1875 | - $gd_page = '';  | 
                                                        |
| 1876 | -    if(geodir_is_page('home')){
 | 
                                                        |
| 1877 | - $gd_page = 'home';  | 
                                                        |
| 1878 | -        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
 | 
                                                        |
| 1879 | - }  | 
                                                        |
| 1880 | -    elseif(geodir_is_page('detail')){
 | 
                                                        |
| 1881 | - $gd_page = 'detail';  | 
                                                        |
| 1882 | -        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
 | 
                                                        |
| 1883 | - }  | 
                                                        |
| 1884 | -    elseif(geodir_is_page('pt')){
 | 
                                                        |
| 1885 | - $gd_page = 'pt';  | 
                                                        |
| 1886 | -        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
 | 
                                                        |
| 1887 | - }  | 
                                                        |
| 1888 | -    elseif(geodir_is_page('listing')){
 | 
                                                        |
| 1889 | - $gd_page = 'listing';  | 
                                                        |
| 1890 | -        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
 | 
                                                        |
| 1891 | - }  | 
                                                        |
| 1892 | -    elseif(geodir_is_page('location')){
 | 
                                                        |
| 1893 | - $gd_page = 'location';  | 
                                                        |
| 1894 | -        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
 | 
                                                        |
| 1895 | - }  | 
                                                        |
| 1896 | -    elseif(geodir_is_page('search')){
 | 
                                                        |
| 1897 | - $gd_page = 'search';  | 
                                                        |
| 1898 | -        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
 | 
                                                        |
| 1899 | - }  | 
                                                        |
| 1900 | -    elseif(geodir_is_page('add-listing')){
 | 
                                                        |
| 1901 | - $gd_page = 'add-listing';  | 
                                                        |
| 1902 | -        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
 | 
                                                        |
| 1903 | - }  | 
                                                        |
| 1904 | -    elseif(geodir_is_page('author')){
 | 
                                                        |
| 1905 | - $gd_page = 'author';  | 
                                                        |
| 1906 | -        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
 | 
                                                        |
| 1907 | - }  | 
                                                        |
| 1908 | -    elseif(geodir_is_page('login')){
 | 
                                                        |
| 1909 | - $gd_page = 'login';  | 
                                                        |
| 1910 | -        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
 | 
                                                        |
| 1911 | - }  | 
                                                        |
| 1912 | -    elseif(geodir_is_page('listing-success')){
 | 
                                                        |
| 1913 | - $gd_page = 'listing-success';  | 
                                                        |
| 1914 | -        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
 | 
                                                        |
| 1915 | - }  | 
                                                        |
| 1875 | + $gd_page = '';  | 
                                                        |
| 1876 | +	if(geodir_is_page('home')){
 | 
                                                        |
| 1877 | + $gd_page = 'home';  | 
                                                        |
| 1878 | +		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
 | 
                                                        |
| 1879 | + }  | 
                                                        |
| 1880 | +	elseif(geodir_is_page('detail')){
 | 
                                                        |
| 1881 | + $gd_page = 'detail';  | 
                                                        |
| 1882 | +		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
 | 
                                                        |
| 1883 | + }  | 
                                                        |
| 1884 | +	elseif(geodir_is_page('pt')){
 | 
                                                        |
| 1885 | + $gd_page = 'pt';  | 
                                                        |
| 1886 | +		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
 | 
                                                        |
| 1887 | + }  | 
                                                        |
| 1888 | +	elseif(geodir_is_page('listing')){
 | 
                                                        |
| 1889 | + $gd_page = 'listing';  | 
                                                        |
| 1890 | +		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
 | 
                                                        |
| 1891 | + }  | 
                                                        |
| 1892 | +	elseif(geodir_is_page('location')){
 | 
                                                        |
| 1893 | + $gd_page = 'location';  | 
                                                        |
| 1894 | +		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
 | 
                                                        |
| 1895 | + }  | 
                                                        |
| 1896 | +	elseif(geodir_is_page('search')){
 | 
                                                        |
| 1897 | + $gd_page = 'search';  | 
                                                        |
| 1898 | +		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
 | 
                                                        |
| 1899 | + }  | 
                                                        |
| 1900 | +	elseif(geodir_is_page('add-listing')){
 | 
                                                        |
| 1901 | + $gd_page = 'add-listing';  | 
                                                        |
| 1902 | +		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
 | 
                                                        |
| 1903 | + }  | 
                                                        |
| 1904 | +	elseif(geodir_is_page('author')){
 | 
                                                        |
| 1905 | + $gd_page = 'author';  | 
                                                        |
| 1906 | +		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
 | 
                                                        |
| 1907 | + }  | 
                                                        |
| 1908 | +	elseif(geodir_is_page('login')){
 | 
                                                        |
| 1909 | + $gd_page = 'login';  | 
                                                        |
| 1910 | +		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
 | 
                                                        |
| 1911 | + }  | 
                                                        |
| 1912 | +	elseif(geodir_is_page('listing-success')){
 | 
                                                        |
| 1913 | + $gd_page = 'listing-success';  | 
                                                        |
| 1914 | +		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
 | 
                                                        |
| 1915 | + }  | 
                                                        |
| 1916 | 1916 | |
| 1917 | 1917 | |
| 1918 | - /**  | 
                                                        |
| 1919 | - * Filter page meta title to replace variables.  | 
                                                        |
| 1920 | - *  | 
                                                        |
| 1921 | - * @since 1.5.4  | 
                                                        |
| 1922 | - * @param string $title The page title including variables.  | 
                                                        |
| 1923 | - * @param string $gd_page The GeoDirectory page type if any.  | 
                                                        |
| 1924 | - * @param string $sep The title separator symbol.  | 
                                                        |
| 1925 | - */  | 
                                                        |
| 1926 | -    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
 | 
                                                        |
| 1918 | + /**  | 
                                                        |
| 1919 | + * Filter page meta title to replace variables.  | 
                                                        |
| 1920 | + *  | 
                                                        |
| 1921 | + * @since 1.5.4  | 
                                                        |
| 1922 | + * @param string $title The page title including variables.  | 
                                                        |
| 1923 | + * @param string $gd_page The GeoDirectory page type if any.  | 
                                                        |
| 1924 | + * @param string $sep The title separator symbol.  | 
                                                        |
| 1925 | + */  | 
                                                        |
| 1926 | +	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
 | 
                                                        |
| 1927 | 1927 | |
| 1928 | 1928 | }  | 
                                                        
| 1929 | 1929 | |
@@ -1939,36 +1939,36 @@ discard block  | 
                                                    ||
| 1939 | 1939 | function geodir_set_post_attachment()  | 
                                                        
| 1940 | 1940 |  {
 | 
                                                        
| 1941 | 1941 | |
| 1942 | -    if (!get_option('geodir_set_post_attachments')) {
 | 
                                                        |
| 1942 | +	if (!get_option('geodir_set_post_attachments')) {
 | 
                                                        |
| 1943 | 1943 | |
| 1944 | - require_once(ABSPATH . 'wp-admin/includes/image.php');  | 
                                                        |
| 1945 | - require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 1944 | + require_once(ABSPATH . 'wp-admin/includes/image.php');  | 
                                                        |
| 1945 | + require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 1946 | 1946 | |
| 1947 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 1947 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 1948 | 1948 | |
| 1949 | -        foreach($all_postypes as $post_type){
 | 
                                                        |
| 1950 | - $args = array(  | 
                                                        |
| 1951 | - 'posts_per_page' => -1,  | 
                                                        |
| 1952 | - 'post_type' => $post_type,  | 
                                                        |
| 1953 | - 'post_status' => 'publish');  | 
                                                        |
| 1949 | +		foreach($all_postypes as $post_type){
 | 
                                                        |
| 1950 | + $args = array(  | 
                                                        |
| 1951 | + 'posts_per_page' => -1,  | 
                                                        |
| 1952 | + 'post_type' => $post_type,  | 
                                                        |
| 1953 | + 'post_status' => 'publish');  | 
                                                        |
| 1954 | 1954 | |
| 1955 | - $posts_array = get_posts($args);  | 
                                                        |
| 1955 | + $posts_array = get_posts($args);  | 
                                                        |
| 1956 | 1956 | |
| 1957 | -            if (!empty($posts_array)) {
 | 
                                                        |
| 1957 | +			if (!empty($posts_array)) {
 | 
                                                        |
| 1958 | 1958 | |
| 1959 | -                foreach ($posts_array as $post) {
 | 
                                                        |
| 1959 | +				foreach ($posts_array as $post) {
 | 
                                                        |
| 1960 | 1960 | |
| 1961 | - geodir_set_wp_featured_image($post->ID);  | 
                                                        |
| 1961 | + geodir_set_wp_featured_image($post->ID);  | 
                                                        |
| 1962 | 1962 | |
| 1963 | - }  | 
                                                        |
| 1963 | + }  | 
                                                        |
| 1964 | 1964 | |
| 1965 | - }  | 
                                                        |
| 1966 | - }  | 
                                                        |
| 1965 | + }  | 
                                                        |
| 1966 | + }  | 
                                                        |
| 1967 | 1967 | |
| 1968 | 1968 | |
| 1969 | -        update_option('geodir_set_post_attachments', '1');
 | 
                                                        |
| 1969 | +		update_option('geodir_set_post_attachments', '1');
 | 
                                                        |
| 1970 | 1970 | |
| 1971 | - }  | 
                                                        |
| 1971 | + }  | 
                                                        |
| 1972 | 1972 | |
| 1973 | 1973 | }  | 
                                                        
| 1974 | 1974 | |
@@ -1985,19 +1985,19 @@ discard block  | 
                                                    ||
| 1985 | 1985 | function geodir_remove_url_seperator()  | 
                                                        
| 1986 | 1986 |  {
 | 
                                                        
| 1987 | 1987 | |
| 1988 | -    if (!get_option('geodir_remove_url_seperator')) {
 | 
                                                        |
| 1988 | +	if (!get_option('geodir_remove_url_seperator')) {
 | 
                                                        |
| 1989 | 1989 | |
| 1990 | -        if (get_option('geodir_listingurl_separator'))
 | 
                                                        |
| 1991 | -            delete_option('geodir_listingurl_separator');
 | 
                                                        |
| 1990 | +		if (get_option('geodir_listingurl_separator'))
 | 
                                                        |
| 1991 | +			delete_option('geodir_listingurl_separator');
 | 
                                                        |
| 1992 | 1992 | |
| 1993 | -        if (get_option('geodir_detailurl_separator'))
 | 
                                                        |
| 1994 | -            delete_option('geodir_detailurl_separator');
 | 
                                                        |
| 1993 | +		if (get_option('geodir_detailurl_separator'))
 | 
                                                        |
| 1994 | +			delete_option('geodir_detailurl_separator');
 | 
                                                        |
| 1995 | 1995 | |
| 1996 | - flush_rewrite_rules(false);  | 
                                                        |
| 1996 | + flush_rewrite_rules(false);  | 
                                                        |
| 1997 | 1997 | |
| 1998 | -        update_option('geodir_remove_url_seperator', '1');
 | 
                                                        |
| 1998 | +		update_option('geodir_remove_url_seperator', '1');
 | 
                                                        |
| 1999 | 1999 | |
| 2000 | - }  | 
                                                        |
| 2000 | + }  | 
                                                        |
| 2001 | 2001 | |
| 2002 | 2002 | }  | 
                                                        
| 2003 | 2003 | |
@@ -2013,19 +2013,19 @@ discard block  | 
                                                    ||
| 2013 | 2013 | */  | 
                                                        
| 2014 | 2014 | function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)  | 
                                                        
| 2015 | 2015 |  {
 | 
                                                        
| 2016 | -    foreach ($permalink_arr as $key => $value) {
 | 
                                                        |
| 2016 | +	foreach ($permalink_arr as $key => $value) {
 | 
                                                        |
| 2017 | 2017 | |
| 2018 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')  | 
                                                        |
| 2019 | - unset($permalink_arr[$key]);  | 
                                                        |
| 2018 | + if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')  | 
                                                        |
| 2019 | + unset($permalink_arr[$key]);  | 
                                                        |
| 2020 | 2020 | |
| 2021 | - }  | 
                                                        |
| 2021 | + }  | 
                                                        |
| 2022 | 2022 | |
| 2023 | - return $permalink_arr;  | 
                                                        |
| 2023 | + return $permalink_arr;  | 
                                                        |
| 2024 | 2024 | |
| 2025 | 2025 | }  | 
                                                        
| 2026 | 2026 | |
| 2027 | 2027 |  if (!is_admin()) {
 | 
                                                        
| 2028 | -    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
 | 
                                                        |
| 2028 | +	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
 | 
                                                        |
| 2029 | 2029 | }  | 
                                                        
| 2030 | 2030 | /**  | 
                                                        
| 2031 | 2031 | * Set status from draft to publish.  | 
                                                        
@@ -2038,16 +2038,16 @@ discard block  | 
                                                    ||
| 2038 | 2038 | */  | 
                                                        
| 2039 | 2039 | function geodir_set_status_draft_to_publish_for_own_post($post)  | 
                                                        
| 2040 | 2040 |  {
 | 
                                                        
| 2041 | - $user_id = get_current_user_id();  | 
                                                        |
| 2041 | + $user_id = get_current_user_id();  | 
                                                        |
| 2042 | 2042 | |
| 2043 | -    if(!$user_id){return $post;}
 | 
                                                        |
| 2043 | +	if(!$user_id){return $post;}
 | 
                                                        |
| 2044 | 2044 | |
| 2045 | - $gd_post_types = geodir_get_posttypes();  | 
                                                        |
| 2045 | + $gd_post_types = geodir_get_posttypes();  | 
                                                        |
| 2046 | 2046 | |
| 2047 | -    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
 | 
                                                        |
| 2048 | - $post[0]->post_status = 'publish';  | 
                                                        |
| 2049 | - }  | 
                                                        |
| 2050 | - return $post;  | 
                                                        |
| 2047 | +	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
 | 
                                                        |
| 2048 | + $post[0]->post_status = 'publish';  | 
                                                        |
| 2049 | + }  | 
                                                        |
| 2050 | + return $post;  | 
                                                        |
| 2051 | 2051 | }  | 
                                                        
| 2052 | 2052 | |
| 2053 | 2053 | |
@@ -2139,33 +2139,33 @@ discard block  | 
                                                    ||
| 2139 | 2139 | */  | 
                                                        
| 2140 | 2140 | function geodir_detail_page_tab_headings_change($tabs_arr)  | 
                                                        
| 2141 | 2141 |  {
 | 
                                                        
| 2142 | - global $wpdb;  | 
                                                        |
| 2142 | + global $wpdb;  | 
                                                        |
| 2143 | 2143 | |
| 2144 | - $post_type = geodir_get_current_posttype();  | 
                                                        |
| 2144 | + $post_type = geodir_get_current_posttype();  | 
                                                        |
| 2145 | 2145 | |
| 2146 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2146 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2147 | 2147 | |
| 2148 | -    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
 | 
                                                        |
| 2148 | +	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
 | 
                                                        |
| 2149 | 2149 | |
| 2150 | -        if (array_key_exists('post_video', $tabs_arr)) {
 | 
                                                        |
| 2150 | +		if (array_key_exists('post_video', $tabs_arr)) {
 | 
                                                        |
| 2151 | 2151 | |
| 2152 | -            $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)));
 | 
                                                        |
| 2152 | +			$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)));
 | 
                                                        |
| 2153 | 2153 | |
| 2154 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')  | 
                                                        |
| 2155 | - $tabs_arr['post_video']['heading_text'] = $field_title;  | 
                                                        |
| 2156 | - }  | 
                                                        |
| 2154 | + if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')  | 
                                                        |
| 2155 | + $tabs_arr['post_video']['heading_text'] = $field_title;  | 
                                                        |
| 2156 | + }  | 
                                                        |
| 2157 | 2157 | |
| 2158 | -        if (array_key_exists('special_offers', $tabs_arr)) {
 | 
                                                        |
| 2158 | +		if (array_key_exists('special_offers', $tabs_arr)) {
 | 
                                                        |
| 2159 | 2159 | |
| 2160 | -            $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)));
 | 
                                                        |
| 2160 | +			$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)));
 | 
                                                        |
| 2161 | 2161 | |
| 2162 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')  | 
                                                        |
| 2163 | - $tabs_arr['special_offers']['heading_text'] = $field_title;  | 
                                                        |
| 2164 | - }  | 
                                                        |
| 2162 | + if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')  | 
                                                        |
| 2163 | + $tabs_arr['special_offers']['heading_text'] = $field_title;  | 
                                                        |
| 2164 | + }  | 
                                                        |
| 2165 | 2165 | |
| 2166 | - }  | 
                                                        |
| 2166 | + }  | 
                                                        |
| 2167 | 2167 | |
| 2168 | - return $tabs_arr;  | 
                                                        |
| 2168 | + return $tabs_arr;  | 
                                                        |
| 2169 | 2169 | |
| 2170 | 2170 | }  | 
                                                        
| 2171 | 2171 | |
@@ -2178,10 +2178,10 @@ discard block  | 
                                                    ||
| 2178 | 2178 | */  | 
                                                        
| 2179 | 2179 | function geodir_remove_template_redirect_actions()  | 
                                                        
| 2180 | 2180 |  {
 | 
                                                        
| 2181 | -    if (geodir_is_page('login')){
 | 
                                                        |
| 2182 | -        remove_all_actions('template_redirect');
 | 
                                                        |
| 2183 | -        remove_action('init', 'avia_modify_front', 10);
 | 
                                                        |
| 2184 | - }  | 
                                                        |
| 2181 | +	if (geodir_is_page('login')){
 | 
                                                        |
| 2182 | +		remove_all_actions('template_redirect');
 | 
                                                        |
| 2183 | +		remove_action('init', 'avia_modify_front', 10);
 | 
                                                        |
| 2184 | + }  | 
                                                        |
| 2185 | 2185 | }  | 
                                                        
| 2186 | 2186 | |
| 2187 | 2187 | |
@@ -2203,51 +2203,51 @@ discard block  | 
                                                    ||
| 2203 | 2203 | function geodirectory_before_featured_image_delete($attachment_id)  | 
                                                        
| 2204 | 2204 |  {
 | 
                                                        
| 2205 | 2205 | |
| 2206 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 2206 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 2207 | 2207 | |
| 2208 | -    $post_id = get_post_field('post_parent', $attachment_id);
 | 
                                                        |
| 2208 | +	$post_id = get_post_field('post_parent', $attachment_id);
 | 
                                                        |
| 2209 | 2209 | |
| 2210 | - $attachment_url = wp_get_attachment_url($attachment_id);  | 
                                                        |
| 2210 | + $attachment_url = wp_get_attachment_url($attachment_id);  | 
                                                        |
| 2211 | 2211 | |
| 2212 | -    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
 | 
                                                        |
| 2212 | +	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
 | 
                                                        |
| 2213 | 2213 | |
| 2214 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 2214 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 2215 | 2215 | |
| 2216 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2216 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2217 | 2217 | |
| 2218 | - if (!in_array($post_type, $all_postypes) || !is_admin())  | 
                                                        |
| 2219 | - return false;  | 
                                                        |
| 2218 | + if (!in_array($post_type, $all_postypes) || !is_admin())  | 
                                                        |
| 2219 | + return false;  | 
                                                        |
| 2220 | 2220 | |
| 2221 | - $uploads = wp_upload_dir();  | 
                                                        |
| 2221 | + $uploads = wp_upload_dir();  | 
                                                        |
| 2222 | 2222 | |
| 2223 | - $split_img_path = explode($uploads['baseurl'], $attachment_url);  | 
                                                        |
| 2223 | + $split_img_path = explode($uploads['baseurl'], $attachment_url);  | 
                                                        |
| 2224 | 2224 | |
| 2225 | - $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';  | 
                                                        |
| 2225 | + $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';  | 
                                                        |
| 2226 | 2226 | |
| 2227 | - $wpdb->query(  | 
                                                        |
| 2228 | -            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
 | 
                                                        |
| 2229 | - array($post_id, $split_img_file_path)  | 
                                                        |
| 2230 | - )  | 
                                                        |
| 2231 | - );  | 
                                                        |
| 2227 | + $wpdb->query(  | 
                                                        |
| 2228 | +			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
 | 
                                                        |
| 2229 | + array($post_id, $split_img_file_path)  | 
                                                        |
| 2230 | + )  | 
                                                        |
| 2231 | + );  | 
                                                        |
| 2232 | 2232 | |
| 2233 | - $attachment_data = $wpdb->get_row(  | 
                                                        |
| 2234 | -            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
 | 
                                                        |
| 2235 | - array($post_id)  | 
                                                        |
| 2236 | - )  | 
                                                        |
| 2237 | - );  | 
                                                        |
| 2233 | + $attachment_data = $wpdb->get_row(  | 
                                                        |
| 2234 | +			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
 | 
                                                        |
| 2235 | + array($post_id)  | 
                                                        |
| 2236 | + )  | 
                                                        |
| 2237 | + );  | 
                                                        |
| 2238 | 2238 | |
| 2239 | -        if (!empty($attachment_data)) {
 | 
                                                        |
| 2240 | -            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
 | 
                                                        |
| 2241 | - }  | 
                                                        |
| 2239 | +		if (!empty($attachment_data)) {
 | 
                                                        |
| 2240 | +			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
 | 
                                                        |
| 2241 | + }  | 
                                                        |
| 2242 | 2242 | |
| 2243 | 2243 | |
| 2244 | - $table_name = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2244 | + $table_name = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2245 | 2245 | |
| 2246 | -        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2246 | +		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2247 | 2247 | |
| 2248 | - geodir_set_wp_featured_image($post_id);  | 
                                                        |
| 2248 | + geodir_set_wp_featured_image($post_id);  | 
                                                        |
| 2249 | 2249 | |
| 2250 | - }  | 
                                                        |
| 2250 | + }  | 
                                                        |
| 2251 | 2251 | |
| 2252 | 2252 | }  | 
                                                        
| 2253 | 2253 | |
@@ -2265,79 +2265,79 @@ discard block  | 
                                                    ||
| 2265 | 2265 | function geodir_temp_set_post_attachment()  | 
                                                        
| 2266 | 2266 |  {
 | 
                                                        
| 2267 | 2267 | |
| 2268 | - global $wpdb, $plugin_prefix;  | 
                                                        |
| 2268 | + global $wpdb, $plugin_prefix;  | 
                                                        |
| 2269 | 2269 | |
| 2270 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2270 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2271 | 2271 | |
| 2272 | -    foreach ($all_postypes as $posttype) {
 | 
                                                        |
| 2272 | +	foreach ($all_postypes as $posttype) {
 | 
                                                        |
| 2273 | 2273 | |
| 2274 | - $tablename = $plugin_prefix . $posttype . '_detail';  | 
                                                        |
| 2274 | + $tablename = $plugin_prefix . $posttype . '_detail';  | 
                                                        |
| 2275 | 2275 | |
| 2276 | -        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
 | 
                                                        |
| 2276 | +		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
 | 
                                                        |
| 2277 | 2277 | |
| 2278 | -        if (!empty($get_post_data)) {
 | 
                                                        |
| 2278 | +		if (!empty($get_post_data)) {
 | 
                                                        |
| 2279 | 2279 | |
| 2280 | -            foreach ($get_post_data as $data) {
 | 
                                                        |
| 2280 | +			foreach ($get_post_data as $data) {
 | 
                                                        |
| 2281 | 2281 | |
| 2282 | - $post_id = $data->post_id;  | 
                                                        |
| 2282 | + $post_id = $data->post_id;  | 
                                                        |
| 2283 | 2283 | |
| 2284 | -                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
 | 
                                                        |
| 2284 | +				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
 | 
                                                        |
| 2285 | 2285 | |
| 2286 | -                if (!empty($attachment_data)) {
 | 
                                                        |
| 2286 | +				if (!empty($attachment_data)) {
 | 
                                                        |
| 2287 | 2287 | |
| 2288 | -                    foreach ($attachment_data as $attach) {
 | 
                                                        |
| 2288 | +					foreach ($attachment_data as $attach) {
 | 
                                                        |
| 2289 | 2289 | |
| 2290 | - $file_info = pathinfo($attach->file);  | 
                                                        |
| 2290 | + $file_info = pathinfo($attach->file);  | 
                                                        |
| 2291 | 2291 | |
| 2292 | - $sub_dir = '';  | 
                                                        |
| 2293 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 2294 | - $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 2292 | + $sub_dir = '';  | 
                                                        |
| 2293 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 2294 | + $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 2295 | 2295 | |
| 2296 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        |
| 2297 | - $uploads_path = $uploads['basedir'];  | 
                                                        |
| 2296 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        |
| 2297 | + $uploads_path = $uploads['basedir'];  | 
                                                        |
| 2298 | 2298 | |
| 2299 | - $file_name = $file_info['basename'];  | 
                                                        |
| 2299 | + $file_name = $file_info['basename'];  | 
                                                        |
| 2300 | 2300 | |
| 2301 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;  | 
                                                        |
| 2301 | + $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;  | 
                                                        |
| 2302 | 2302 | |
| 2303 | -                        if (!file_exists($img_arr['path'])) {
 | 
                                                        |
| 2303 | +						if (!file_exists($img_arr['path'])) {
 | 
                                                        |
| 2304 | 2304 | |
| 2305 | -                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
 | 
                                                        |
| 2305 | +							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
 | 
                                                        |
| 2306 | 2306 | |
| 2307 | - }  | 
                                                        |
| 2307 | + }  | 
                                                        |
| 2308 | 2308 | |
| 2309 | - }  | 
                                                        |
| 2309 | + }  | 
                                                        |
| 2310 | 2310 | |
| 2311 | -                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
 | 
                                                        |
| 2311 | +					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
 | 
                                                        |
| 2312 | 2312 | |
| 2313 | -                    if (!empty($attachment_data)) {
 | 
                                                        |
| 2313 | +					if (!empty($attachment_data)) {
 | 
                                                        |
| 2314 | 2314 | |
| 2315 | - if ($attachment_data->ID)  | 
                                                        |
| 2316 | -                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
 | 
                                                        |
| 2315 | + if ($attachment_data->ID)  | 
                                                        |
| 2316 | +							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
 | 
                                                        |
| 2317 | 2317 | |
| 2318 | -                    } else {
 | 
                                                        |
| 2318 | +					} else {
 | 
                                                        |
| 2319 | 2319 | |
| 2320 | -                        if (has_post_thumbnail($post_id)) {
 | 
                                                        |
| 2320 | +						if (has_post_thumbnail($post_id)) {
 | 
                                                        |
| 2321 | 2321 | |
| 2322 | - $post_thumbnail_id = get_post_thumbnail_id($post_id);  | 
                                                        |
| 2322 | + $post_thumbnail_id = get_post_thumbnail_id($post_id);  | 
                                                        |
| 2323 | 2323 | |
| 2324 | - wp_delete_attachment($post_thumbnail_id);  | 
                                                        |
| 2324 | + wp_delete_attachment($post_thumbnail_id);  | 
                                                        |
| 2325 | 2325 | |
| 2326 | - }  | 
                                                        |
| 2326 | + }  | 
                                                        |
| 2327 | 2327 | |
| 2328 | - }  | 
                                                        |
| 2328 | + }  | 
                                                        |
| 2329 | 2329 | |
| 2330 | -                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2330 | +					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2331 | 2331 | |
| 2332 | - geodir_set_wp_featured_image($post_id);  | 
                                                        |
| 2332 | + geodir_set_wp_featured_image($post_id);  | 
                                                        |
| 2333 | 2333 | |
| 2334 | - }  | 
                                                        |
| 2334 | + }  | 
                                                        |
| 2335 | 2335 | |
| 2336 | - }  | 
                                                        |
| 2336 | + }  | 
                                                        |
| 2337 | 2337 | |
| 2338 | - }  | 
                                                        |
| 2338 | + }  | 
                                                        |
| 2339 | 2339 | |
| 2340 | - }  | 
                                                        |
| 2340 | + }  | 
                                                        |
| 2341 | 2341 | |
| 2342 | 2342 | }  | 
                                                        
| 2343 | 2343 | |
@@ -2355,9 +2355,9 @@ discard block  | 
                                                    ||
| 2355 | 2355 | function geodir_default_rating_star_icon()  | 
                                                        
| 2356 | 2356 |  {
 | 
                                                        
| 2357 | 2357 | |
| 2358 | -    if (!get_option('geodir_default_rating_star_icon')) {
 | 
                                                        |
| 2359 | -        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
 | 
                                                        |
| 2360 | - }  | 
                                                        |
| 2358 | +	if (!get_option('geodir_default_rating_star_icon')) {
 | 
                                                        |
| 2359 | +		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
 | 
                                                        |
| 2360 | + }  | 
                                                        |
| 2361 | 2361 | |
| 2362 | 2362 | }  | 
                                                        
| 2363 | 2363 | |
@@ -2375,27 +2375,27 @@ discard block  | 
                                                    ||
| 2375 | 2375 | */  | 
                                                        
| 2376 | 2376 | function geodir_user_post_listing_count($user_id=null)  | 
                                                        
| 2377 | 2377 |  {
 | 
                                                        
| 2378 | - global $wpdb, $plugin_prefix, $current_user;  | 
                                                        |
| 2379 | -    if(!$user_id){
 | 
                                                        |
| 2380 | - $user_id = $current_user->ID;  | 
                                                        |
| 2381 | - }  | 
                                                        |
| 2378 | + global $wpdb, $plugin_prefix, $current_user;  | 
                                                        |
| 2379 | +	if(!$user_id){
 | 
                                                        |
| 2380 | + $user_id = $current_user->ID;  | 
                                                        |
| 2381 | + }  | 
                                                        |
| 2382 | 2382 | |
| 2383 | - $user_id = $current_user->ID;  | 
                                                        |
| 2384 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2385 | -    $all_posts = get_option('geodir_listing_link_user_dashboard');
 | 
                                                        |
| 2383 | + $user_id = $current_user->ID;  | 
                                                        |
| 2384 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2385 | +	$all_posts = get_option('geodir_listing_link_user_dashboard');
 | 
                                                        |
| 2386 | 2386 | |
| 2387 | - $user_listing = array();  | 
                                                        |
| 2388 | -    if (is_array($all_posts) && !empty($all_posts)) {
 | 
                                                        |
| 2389 | -        foreach ($all_posts as $ptype) {
 | 
                                                        |
| 2390 | -            $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' )");
 | 
                                                        |
| 2387 | + $user_listing = array();  | 
                                                        |
| 2388 | +	if (is_array($all_posts) && !empty($all_posts)) {
 | 
                                                        |
| 2389 | +		foreach ($all_posts as $ptype) {
 | 
                                                        |
| 2390 | +			$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' )");
 | 
                                                        |
| 2391 | 2391 | |
| 2392 | -            if ($total_posts > 0) {
 | 
                                                        |
| 2393 | - $user_listing[$ptype] = $total_posts;  | 
                                                        |
| 2394 | - }  | 
                                                        |
| 2395 | - }  | 
                                                        |
| 2396 | - }  | 
                                                        |
| 2392 | +			if ($total_posts > 0) {
 | 
                                                        |
| 2393 | + $user_listing[$ptype] = $total_posts;  | 
                                                        |
| 2394 | + }  | 
                                                        |
| 2395 | + }  | 
                                                        |
| 2396 | + }  | 
                                                        |
| 2397 | 2397 | |
| 2398 | - return $user_listing;  | 
                                                        |
| 2398 | + return $user_listing;  | 
                                                        |
| 2399 | 2399 | }  | 
                                                        
| 2400 | 2400 | |
| 2401 | 2401 | |
@@ -2415,593 +2415,593 @@ discard block  | 
                                                    ||
| 2415 | 2415 | */  | 
                                                        
| 2416 | 2416 | function geodir_detail_page_custom_field_tab($tabs_arr)  | 
                                                        
| 2417 | 2417 |  {
 | 
                                                        
| 2418 | - global $post;  | 
                                                        |
| 2419 | -  | 
                                                        |
| 2420 | - $post_type = geodir_get_current_posttype();  | 
                                                        |
| 2421 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2422 | -  | 
                                                        |
| 2423 | -    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
 | 
                                                        |
| 2424 | - $package_info = array();  | 
                                                        |
| 2425 | - $package_info = geodir_post_package_info($package_info, $post);  | 
                                                        |
| 2426 | - $post_package_id = $package_info->pid;  | 
                                                        |
| 2427 | - $fields_location = 'detail';  | 
                                                        |
| 2428 | -  | 
                                                        |
| 2429 | - $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);  | 
                                                        |
| 2430 | -        if (!empty($custom_fields)) {
 | 
                                                        |
| 2431 | - $parse_custom_fields = array();  | 
                                                        |
| 2432 | -            foreach ($custom_fields as $field) {
 | 
                                                        |
| 2433 | - $field = stripslashes_deep($field); // strip slashes  | 
                                                        |
| 2418 | + global $post;  | 
                                                        |
| 2419 | +  | 
                                                        |
| 2420 | + $post_type = geodir_get_current_posttype();  | 
                                                        |
| 2421 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 2422 | +  | 
                                                        |
| 2423 | +	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
 | 
                                                        |
| 2424 | + $package_info = array();  | 
                                                        |
| 2425 | + $package_info = geodir_post_package_info($package_info, $post);  | 
                                                        |
| 2426 | + $post_package_id = $package_info->pid;  | 
                                                        |
| 2427 | + $fields_location = 'detail';  | 
                                                        |
| 2428 | +  | 
                                                        |
| 2429 | + $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);  | 
                                                        |
| 2430 | +		if (!empty($custom_fields)) {
 | 
                                                        |
| 2431 | + $parse_custom_fields = array();  | 
                                                        |
| 2432 | +			foreach ($custom_fields as $field) {
 | 
                                                        |
| 2433 | + $field = stripslashes_deep($field); // strip slashes  | 
                                                        |
| 2434 | 2434 | |
| 2435 | - $type = $field;  | 
                                                        |
| 2436 | - $field_name = $field['htmlvar_name'];  | 
                                                        |
| 2437 | -                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
 | 
                                                        |
| 2438 | -                    $post->{$field_name} = $_REQUEST[$field_name];
 | 
                                                        |
| 2439 | - }  | 
                                                        |
| 2440 | -  | 
                                                        |
| 2441 | -                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
 | 
                                                        |
| 2442 | -                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
 | 
                                                        |
| 2443 | - continue;  | 
                                                        |
| 2444 | - }  | 
                                                        |
| 2445 | -  | 
                                                        |
| 2446 | - $parse_custom_fields[] = $field;  | 
                                                        |
| 2447 | - }  | 
                                                        |
| 2448 | - }  | 
                                                        |
| 2449 | - $custom_fields = $parse_custom_fields;  | 
                                                        |
| 2450 | - }  | 
                                                        |
| 2435 | + $type = $field;  | 
                                                        |
| 2436 | + $field_name = $field['htmlvar_name'];  | 
                                                        |
| 2437 | +				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
 | 
                                                        |
| 2438 | +					$post->{$field_name} = $_REQUEST[$field_name];
 | 
                                                        |
| 2439 | + }  | 
                                                        |
| 2440 | +  | 
                                                        |
| 2441 | +				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
 | 
                                                        |
| 2442 | +					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
 | 
                                                        |
| 2443 | + continue;  | 
                                                        |
| 2444 | + }  | 
                                                        |
| 2445 | +  | 
                                                        |
| 2446 | + $parse_custom_fields[] = $field;  | 
                                                        |
| 2447 | + }  | 
                                                        |
| 2448 | + }  | 
                                                        |
| 2449 | + $custom_fields = $parse_custom_fields;  | 
                                                        |
| 2450 | + }  | 
                                                        |
| 2451 | 2451 | |
| 2452 | -        if (!empty($custom_fields)) {
 | 
                                                        |
| 2453 | - $post = stripslashes_deep($post); // strip slashes  | 
                                                        |
| 2452 | +		if (!empty($custom_fields)) {
 | 
                                                        |
| 2453 | + $post = stripslashes_deep($post); // strip slashes  | 
                                                        |
| 2454 | 2454 | |
| 2455 | - $field_set_start = 0;  | 
                                                        |
| 2456 | - $fieldset_count = 0;  | 
                                                        |
| 2457 | - $fieldset = '';  | 
                                                        |
| 2458 | - $total_fields = count($custom_fields);  | 
                                                        |
| 2459 | - $count_field = 0;  | 
                                                        |
| 2460 | - $fieldset_arr = array();  | 
                                                        |
| 2461 | - $i = 0;  | 
                                                        |
| 2462 | - $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;  | 
                                                        |
| 2463 | -  | 
                                                        |
| 2464 | -            foreach ($custom_fields as $field) {
 | 
                                                        |
| 2465 | - $count_field++;  | 
                                                        |
| 2466 | - $field_name = $field['htmlvar_name'];  | 
                                                        |
| 2467 | -                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
 | 
                                                        |
| 2468 | -                    $post->{$field_name} = $_REQUEST[$field_name];
 | 
                                                        |
| 2469 | - }  | 
                                                        |
| 2470 | -  | 
                                                        |
| 2471 | -                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
 | 
                                                        |
| 2472 | - $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];  | 
                                                        |
| 2473 | - $site_title = trim($field['site_title']);  | 
                                                        |
| 2474 | - $type = $field;  | 
                                                        |
| 2475 | - $html = '';  | 
                                                        |
| 2476 | - $html_var = $field_name;  | 
                                                        |
| 2477 | - $field_icon = '';  | 
                                                        |
| 2478 | - $variables_array = array();  | 
                                                        |
| 2479 | -  | 
                                                        |
| 2480 | -                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
 | 
                                                        |
| 2481 | - continue;  | 
                                                        |
| 2482 | - }  | 
                                                        |
| 2483 | -  | 
                                                        |
| 2484 | -                    if ($type['type'] != 'fieldset') {
 | 
                                                        |
| 2485 | - $i++;  | 
                                                        |
| 2486 | - $variables_array['post_id'] = $post->ID;  | 
                                                        |
| 2487 | - $variables_array['label'] = __($type['site_title'], 'geodirectory');  | 
                                                        |
| 2488 | - $variables_array['value'] = '';  | 
                                                        |
| 2489 | -                        $variables_array['value'] = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2490 | - }  | 
                                                        |
| 2491 | -  | 
                                                        |
| 2492 | -                    if (strpos($type['field_icon'], 'http') !== false) {
 | 
                                                        |
| 2493 | -                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
 | 
                                                        |
| 2494 | -                    } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
 | 
                                                        |
| 2495 | - $field_icon = '<i class="' . $type['field_icon'] . '"></i>';  | 
                                                        |
| 2496 | - }  | 
                                                        |
| 2497 | -  | 
                                                        |
| 2498 | -                    switch ($type['type']) {
 | 
                                                        |
| 2499 | -                        case 'fieldset': {
 | 
                                                        |
| 2500 | - $i = 0;  | 
                                                        |
| 2501 | - $fieldset_count++;  | 
                                                        |
| 2502 | - $field_set_start = 1;  | 
                                                        |
| 2503 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;  | 
                                                        |
| 2504 | - $fieldset_arr[$fieldset_count]['label'] = $label;  | 
                                                        |
| 2505 | - }  | 
                                                        |
| 2506 | - break;  | 
                                                        |
| 2507 | -                        case 'url': {
 | 
                                                        |
| 2508 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2509 | - $field_icon_af = '';  | 
                                                        |
| 2510 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2511 | -  | 
                                                        |
| 2512 | -                                if ($type['name'] == 'geodir_facebook') {
 | 
                                                        |
| 2513 | - $field_icon_af = '<i class="fa fa-facebook-square"></i>';  | 
                                                        |
| 2514 | -                                } elseif ($type['name'] == 'geodir_twitter') {
 | 
                                                        |
| 2515 | - $field_icon_af = '<i class="fa fa-twitter-square"></i>';  | 
                                                        |
| 2516 | -                                } else {
 | 
                                                        |
| 2517 | - $field_icon_af = '<i class="fa fa-link"></i>';  | 
                                                        |
| 2518 | - }  | 
                                                        |
| 2519 | -  | 
                                                        |
| 2520 | -                            } else {
 | 
                                                        |
| 2521 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2522 | - $field_icon = '';  | 
                                                        |
| 2523 | - }  | 
                                                        |
| 2455 | + $field_set_start = 0;  | 
                                                        |
| 2456 | + $fieldset_count = 0;  | 
                                                        |
| 2457 | + $fieldset = '';  | 
                                                        |
| 2458 | + $total_fields = count($custom_fields);  | 
                                                        |
| 2459 | + $count_field = 0;  | 
                                                        |
| 2460 | + $fieldset_arr = array();  | 
                                                        |
| 2461 | + $i = 0;  | 
                                                        |
| 2462 | + $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;  | 
                                                        |
| 2463 | +  | 
                                                        |
| 2464 | +			foreach ($custom_fields as $field) {
 | 
                                                        |
| 2465 | + $count_field++;  | 
                                                        |
| 2466 | + $field_name = $field['htmlvar_name'];  | 
                                                        |
| 2467 | +				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
 | 
                                                        |
| 2468 | +					$post->{$field_name} = $_REQUEST[$field_name];
 | 
                                                        |
| 2469 | + }  | 
                                                        |
| 2470 | +  | 
                                                        |
| 2471 | +				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
 | 
                                                        |
| 2472 | + $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];  | 
                                                        |
| 2473 | + $site_title = trim($field['site_title']);  | 
                                                        |
| 2474 | + $type = $field;  | 
                                                        |
| 2475 | + $html = '';  | 
                                                        |
| 2476 | + $html_var = $field_name;  | 
                                                        |
| 2477 | + $field_icon = '';  | 
                                                        |
| 2478 | + $variables_array = array();  | 
                                                        |
| 2479 | +  | 
                                                        |
| 2480 | +					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
 | 
                                                        |
| 2481 | + continue;  | 
                                                        |
| 2482 | + }  | 
                                                        |
| 2483 | +  | 
                                                        |
| 2484 | +					if ($type['type'] != 'fieldset') {
 | 
                                                        |
| 2485 | + $i++;  | 
                                                        |
| 2486 | + $variables_array['post_id'] = $post->ID;  | 
                                                        |
| 2487 | + $variables_array['label'] = __($type['site_title'], 'geodirectory');  | 
                                                        |
| 2488 | + $variables_array['value'] = '';  | 
                                                        |
| 2489 | +						$variables_array['value'] = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2490 | + }  | 
                                                        |
| 2491 | +  | 
                                                        |
| 2492 | +					if (strpos($type['field_icon'], 'http') !== false) {
 | 
                                                        |
| 2493 | +						$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
 | 
                                                        |
| 2494 | +					} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
 | 
                                                        |
| 2495 | + $field_icon = '<i class="' . $type['field_icon'] . '"></i>';  | 
                                                        |
| 2496 | + }  | 
                                                        |
| 2497 | +  | 
                                                        |
| 2498 | +					switch ($type['type']) {
 | 
                                                        |
| 2499 | +						case 'fieldset': {
 | 
                                                        |
| 2500 | + $i = 0;  | 
                                                        |
| 2501 | + $fieldset_count++;  | 
                                                        |
| 2502 | + $field_set_start = 1;  | 
                                                        |
| 2503 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;  | 
                                                        |
| 2504 | + $fieldset_arr[$fieldset_count]['label'] = $label;  | 
                                                        |
| 2505 | + }  | 
                                                        |
| 2506 | + break;  | 
                                                        |
| 2507 | +						case 'url': {
 | 
                                                        |
| 2508 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2509 | + $field_icon_af = '';  | 
                                                        |
| 2510 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2511 | +  | 
                                                        |
| 2512 | +								if ($type['name'] == 'geodir_facebook') {
 | 
                                                        |
| 2513 | + $field_icon_af = '<i class="fa fa-facebook-square"></i>';  | 
                                                        |
| 2514 | +								} elseif ($type['name'] == 'geodir_twitter') {
 | 
                                                        |
| 2515 | + $field_icon_af = '<i class="fa fa-twitter-square"></i>';  | 
                                                        |
| 2516 | +								} else {
 | 
                                                        |
| 2517 | + $field_icon_af = '<i class="fa fa-link"></i>';  | 
                                                        |
| 2518 | + }  | 
                                                        |
| 2519 | +  | 
                                                        |
| 2520 | +							} else {
 | 
                                                        |
| 2521 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2522 | + $field_icon = '';  | 
                                                        |
| 2523 | + }  | 
                                                        |
| 2524 | 2524 | |
| 2525 | -                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
 | 
                                                        |
| 2526 | -  | 
                                                        |
| 2527 | - $website = !empty($a_url['url']) ? $a_url['url'] : '';  | 
                                                        |
| 2528 | - $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];  | 
                                                        |
| 2529 | - $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';  | 
                                                        |
| 2530 | -  | 
                                                        |
| 2531 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2532 | -  | 
                                                        |
| 2533 | - // all search engines that use the nofollow value exclude links that use it from their ranking calculation  | 
                                                        |
| 2534 | - $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';  | 
                                                        |
| 2535 | -  | 
                                                        |
| 2536 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .  | 
                                                        |
| 2537 | - /**  | 
                                                        |
| 2538 | - * Filer the custom field website name.  | 
                                                        |
| 2539 | - *  | 
                                                        |
| 2540 | - * @since 1.0.0  | 
                                                        |
| 2541 | - * @param string $title The field name default: "Website".  | 
                                                        |
| 2542 | - * @param string $website The website address.  | 
                                                        |
| 2543 | - * @param int $post->ID The post ID.  | 
                                                        |
| 2544 | - */  | 
                                                        |
| 2545 | -                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
 | 
                                                        |
| 2546 | - }  | 
                                                        |
| 2547 | - break;  | 
                                                        |
| 2548 | -                        case 'phone': {
 | 
                                                        |
| 2549 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2550 | - $field_icon_af = '';  | 
                                                        |
| 2551 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2552 | - $field_icon_af = '<i class="fa fa-phone"></i>';  | 
                                                        |
| 2553 | -                            } else {
 | 
                                                        |
| 2554 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2555 | - $field_icon = '';  | 
                                                        |
| 2556 | - }  | 
                                                        |
| 2557 | -  | 
                                                        |
| 2558 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2559 | -  | 
                                                        |
| 2560 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2561 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2562 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2563 | - }  | 
                                                        |
| 2564 | -                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2565 | - }  | 
                                                        |
| 2566 | - break;  | 
                                                        |
| 2567 | -                        case 'time': {
 | 
                                                        |
| 2568 | - $value = '';  | 
                                                        |
| 2569 | -                            if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2570 | -                                $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2571 | -  | 
                                                        |
| 2572 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2573 | - $field_icon_af = '';  | 
                                                        |
| 2574 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2575 | - $field_icon_af = '<i class="fa fa-clock-o"></i>';  | 
                                                        |
| 2576 | -                            } else {
 | 
                                                        |
| 2577 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2578 | - $field_icon = '';  | 
                                                        |
| 2579 | - }  | 
                                                        |
| 2580 | -  | 
                                                        |
| 2581 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2582 | -  | 
                                                        |
| 2583 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2584 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2585 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2586 | - }  | 
                                                        |
| 2587 | - $html .= ' </span>' . $value . '</div>';  | 
                                                        |
| 2588 | - }  | 
                                                        |
| 2589 | - break;  | 
                                                        |
| 2590 | -                        case 'datepicker': {
 | 
                                                        |
| 2591 | - $date_format = geodir_default_date_format();  | 
                                                        |
| 2592 | -                            if ($type['extra_fields'] != '') {
 | 
                                                        |
| 2593 | - $date_format = unserialize($type['extra_fields']);  | 
                                                        |
| 2594 | - $date_format = $date_format['date_format'];  | 
                                                        |
| 2595 | - }  | 
                                                        |
| 2596 | -  | 
                                                        |
| 2597 | - // check if we need to change the format or not  | 
                                                        |
| 2598 | -                            $date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        |
| 2599 | -                            if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 2600 | -  | 
                                                        |
| 2601 | -                                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 2602 | -                                $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 2603 | -  | 
                                                        |
| 2604 | - $date_format = str_replace($search, $replace, $date_format);  | 
                                                        |
| 2605 | -  | 
                                                        |
| 2606 | -                                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        |
| 2607 | -                            }else{
 | 
                                                        |
| 2608 | -                                $post_htmlvar_value = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2609 | - }  | 
                                                        |
| 2610 | -  | 
                                                        |
| 2611 | - $value = '';  | 
                                                        |
| 2612 | -                            if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2613 | - $value = date_i18n($date_format, strtotime($post_htmlvar_value));  | 
                                                        |
| 2614 | -  | 
                                                        |
| 2615 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2616 | - $field_icon_af = '';  | 
                                                        |
| 2617 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2618 | - $field_icon_af = '<i class="fa fa-calendar"></i>';  | 
                                                        |
| 2619 | -                            } else {
 | 
                                                        |
| 2620 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2621 | - $field_icon = '';  | 
                                                        |
| 2622 | - }  | 
                                                        |
| 2623 | -  | 
                                                        |
| 2624 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2625 | -  | 
                                                        |
| 2626 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2627 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2628 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2629 | - }  | 
                                                        |
| 2630 | - $html .= ' </span>' . $value . '</div>';  | 
                                                        |
| 2631 | - }  | 
                                                        |
| 2632 | - break;  | 
                                                        |
| 2633 | -                        case 'text': {
 | 
                                                        |
| 2634 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2635 | - $field_icon_af = '';  | 
                                                        |
| 2636 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2637 | - $field_icon_af = '';  | 
                                                        |
| 2638 | -                            } else {
 | 
                                                        |
| 2639 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2640 | - $field_icon = '';  | 
                                                        |
| 2641 | - }  | 
                                                        |
| 2642 | -  | 
                                                        |
| 2643 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2644 | -  | 
                                                        |
| 2645 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2646 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2647 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2648 | - }  | 
                                                        |
| 2649 | -                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2650 | - }  | 
                                                        |
| 2651 | - break;  | 
                                                        |
| 2652 | -                        case 'radio': {
 | 
                                                        |
| 2653 | -  | 
                                                        |
| 2654 | -                            if ($post->{$type['htmlvar_name']} != '') {
 | 
                                                        |
| 2655 | -                                if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
 | 
                                                        |
| 2656 | -                                    $html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2657 | -                                } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
 | 
                                                        |
| 2658 | -                                    $html_val = __('Yes', 'geodirectory');
 | 
                                                        |
| 2659 | -                                } else {
 | 
                                                        |
| 2660 | -                                    $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        |
| 2525 | +							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
 | 
                                                        |
| 2526 | +  | 
                                                        |
| 2527 | + $website = !empty($a_url['url']) ? $a_url['url'] : '';  | 
                                                        |
| 2528 | + $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];  | 
                                                        |
| 2529 | + $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';  | 
                                                        |
| 2530 | +  | 
                                                        |
| 2531 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2532 | +  | 
                                                        |
| 2533 | + // all search engines that use the nofollow value exclude links that use it from their ranking calculation  | 
                                                        |
| 2534 | + $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';  | 
                                                        |
| 2535 | +  | 
                                                        |
| 2536 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .  | 
                                                        |
| 2537 | + /**  | 
                                                        |
| 2538 | + * Filer the custom field website name.  | 
                                                        |
| 2539 | + *  | 
                                                        |
| 2540 | + * @since 1.0.0  | 
                                                        |
| 2541 | + * @param string $title The field name default: "Website".  | 
                                                        |
| 2542 | + * @param string $website The website address.  | 
                                                        |
| 2543 | + * @param int $post->ID The post ID.  | 
                                                        |
| 2544 | + */  | 
                                                        |
| 2545 | +								apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
 | 
                                                        |
| 2546 | + }  | 
                                                        |
| 2547 | + break;  | 
                                                        |
| 2548 | +						case 'phone': {
 | 
                                                        |
| 2549 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2550 | + $field_icon_af = '';  | 
                                                        |
| 2551 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2552 | + $field_icon_af = '<i class="fa fa-phone"></i>';  | 
                                                        |
| 2553 | +							} else {
 | 
                                                        |
| 2554 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2555 | + $field_icon = '';  | 
                                                        |
| 2556 | + }  | 
                                                        |
| 2557 | +  | 
                                                        |
| 2558 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2559 | +  | 
                                                        |
| 2560 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2561 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2562 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2563 | + }  | 
                                                        |
| 2564 | +							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2565 | + }  | 
                                                        |
| 2566 | + break;  | 
                                                        |
| 2567 | +						case 'time': {
 | 
                                                        |
| 2568 | + $value = '';  | 
                                                        |
| 2569 | +							if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2570 | +								$value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2571 | +  | 
                                                        |
| 2572 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2573 | + $field_icon_af = '';  | 
                                                        |
| 2574 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2575 | + $field_icon_af = '<i class="fa fa-clock-o"></i>';  | 
                                                        |
| 2576 | +							} else {
 | 
                                                        |
| 2577 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2578 | + $field_icon = '';  | 
                                                        |
| 2579 | + }  | 
                                                        |
| 2580 | +  | 
                                                        |
| 2581 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2582 | +  | 
                                                        |
| 2583 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2584 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2585 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2586 | + }  | 
                                                        |
| 2587 | + $html .= ' </span>' . $value . '</div>';  | 
                                                        |
| 2588 | + }  | 
                                                        |
| 2589 | + break;  | 
                                                        |
| 2590 | +						case 'datepicker': {
 | 
                                                        |
| 2591 | + $date_format = geodir_default_date_format();  | 
                                                        |
| 2592 | +							if ($type['extra_fields'] != '') {
 | 
                                                        |
| 2593 | + $date_format = unserialize($type['extra_fields']);  | 
                                                        |
| 2594 | + $date_format = $date_format['date_format'];  | 
                                                        |
| 2595 | + }  | 
                                                        |
| 2596 | +  | 
                                                        |
| 2597 | + // check if we need to change the format or not  | 
                                                        |
| 2598 | +							$date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        |
| 2599 | +							if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 2600 | +  | 
                                                        |
| 2601 | +								$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 2602 | +								$replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 2603 | +  | 
                                                        |
| 2604 | + $date_format = str_replace($search, $replace, $date_format);  | 
                                                        |
| 2605 | +  | 
                                                        |
| 2606 | +								$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        |
| 2607 | +							}else{
 | 
                                                        |
| 2608 | +								$post_htmlvar_value = $post->{$type['htmlvar_name']};
 | 
                                                        |
| 2609 | + }  | 
                                                        |
| 2610 | +  | 
                                                        |
| 2611 | + $value = '';  | 
                                                        |
| 2612 | +							if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2613 | + $value = date_i18n($date_format, strtotime($post_htmlvar_value));  | 
                                                        |
| 2614 | +  | 
                                                        |
| 2615 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2616 | + $field_icon_af = '';  | 
                                                        |
| 2617 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2618 | + $field_icon_af = '<i class="fa fa-calendar"></i>';  | 
                                                        |
| 2619 | +							} else {
 | 
                                                        |
| 2620 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2621 | + $field_icon = '';  | 
                                                        |
| 2622 | + }  | 
                                                        |
| 2623 | +  | 
                                                        |
| 2624 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2625 | +  | 
                                                        |
| 2626 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2627 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2628 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2629 | + }  | 
                                                        |
| 2630 | + $html .= ' </span>' . $value . '</div>';  | 
                                                        |
| 2631 | + }  | 
                                                        |
| 2632 | + break;  | 
                                                        |
| 2633 | +						case 'text': {
 | 
                                                        |
| 2634 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2635 | + $field_icon_af = '';  | 
                                                        |
| 2636 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2637 | + $field_icon_af = '';  | 
                                                        |
| 2638 | +							} else {
 | 
                                                        |
| 2639 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2640 | + $field_icon = '';  | 
                                                        |
| 2641 | + }  | 
                                                        |
| 2642 | +  | 
                                                        |
| 2643 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2644 | +  | 
                                                        |
| 2645 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2646 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2647 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2648 | + }  | 
                                                        |
| 2649 | +							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2650 | + }  | 
                                                        |
| 2651 | + break;  | 
                                                        |
| 2652 | +						case 'radio': {
 | 
                                                        |
| 2653 | +  | 
                                                        |
| 2654 | +							if ($post->{$type['htmlvar_name']} != '') {
 | 
                                                        |
| 2655 | +								if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
 | 
                                                        |
| 2656 | +									$html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2657 | +								} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
 | 
                                                        |
| 2658 | +									$html_val = __('Yes', 'geodirectory');
 | 
                                                        |
| 2659 | +								} else {
 | 
                                                        |
| 2660 | +									$html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        |
| 2661 | 2661 | |
| 2662 | -                                    if (!empty($type['option_values'])) {
 | 
                                                        |
| 2663 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2662 | +									if (!empty($type['option_values'])) {
 | 
                                                        |
| 2663 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2664 | 2664 | |
| 2665 | -                                        if (!empty($cf_option_values)) {
 | 
                                                        |
| 2666 | -                                            foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2667 | -                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2668 | - $html_val = $cf_option_value['label'];  | 
                                                        |
| 2669 | - }  | 
                                                        |
| 2670 | - }  | 
                                                        |
| 2671 | - }  | 
                                                        |
| 2672 | - }  | 
                                                        |
| 2673 | - }  | 
                                                        |
| 2674 | -  | 
                                                        |
| 2675 | -                                if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2676 | - $field_icon_af = '';  | 
                                                        |
| 2677 | -                                } else if ($field_icon == '') {
 | 
                                                        |
| 2678 | - $field_icon_af = '';  | 
                                                        |
| 2679 | -                                } else {
 | 
                                                        |
| 2680 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2681 | - $field_icon = '';  | 
                                                        |
| 2682 | - }  | 
                                                        |
| 2683 | -  | 
                                                        |
| 2684 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2685 | -  | 
                                                        |
| 2686 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2687 | -  | 
                                                        |
| 2688 | -                                if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2689 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2690 | - }  | 
                                                        |
| 2691 | -  | 
                                                        |
| 2692 | - $html .= ' </span>' . $html_val . '</div>';  | 
                                                        |
| 2693 | - }  | 
                                                        |
| 2694 | - }  | 
                                                        |
| 2695 | - break;  | 
                                                        |
| 2696 | -                        case 'checkbox': {
 | 
                                                        |
| 2697 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2698 | - $html_val = $type['htmlvar_name'];  | 
                                                        |
| 2699 | -  | 
                                                        |
| 2700 | -                            if ((int)$post->{$html_var} == 1) {
 | 
                                                        |
| 2701 | -  | 
                                                        |
| 2702 | -                                if ($post->{$type['htmlvar_name']} == '1') {
 | 
                                                        |
| 2703 | -                                    $html_val = __('Yes', 'geodirectory');
 | 
                                                        |
| 2704 | -                                } else {
 | 
                                                        |
| 2705 | -                                    $html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2706 | - }  | 
                                                        |
| 2707 | -  | 
                                                        |
| 2708 | -                                if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2709 | - $field_icon_af = '';  | 
                                                        |
| 2710 | -                                } else if ($field_icon == '') {
 | 
                                                        |
| 2711 | - $field_icon_af = '';  | 
                                                        |
| 2712 | -                                } else {
 | 
                                                        |
| 2713 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2714 | - $field_icon = '';  | 
                                                        |
| 2715 | - }  | 
                                                        |
| 2716 | -  | 
                                                        |
| 2717 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2718 | -  | 
                                                        |
| 2719 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2720 | -  | 
                                                        |
| 2721 | -                                if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2722 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2723 | - }  | 
                                                        |
| 2724 | -  | 
                                                        |
| 2725 | - $html .= ' </span>' . $html_val . '</div>';  | 
                                                        |
| 2726 | - }  | 
                                                        |
| 2727 | - }  | 
                                                        |
| 2728 | - break;  | 
                                                        |
| 2729 | -                        case 'select': {
 | 
                                                        |
| 2730 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2731 | - $field_icon_af = '';  | 
                                                        |
| 2732 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2733 | - $field_icon_af = '';  | 
                                                        |
| 2734 | -                            } else {
 | 
                                                        |
| 2735 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2736 | - $field_icon = '';  | 
                                                        |
| 2737 | - }  | 
                                                        |
| 2665 | +										if (!empty($cf_option_values)) {
 | 
                                                        |
| 2666 | +											foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2667 | +												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2668 | + $html_val = $cf_option_value['label'];  | 
                                                        |
| 2669 | + }  | 
                                                        |
| 2670 | + }  | 
                                                        |
| 2671 | + }  | 
                                                        |
| 2672 | + }  | 
                                                        |
| 2673 | + }  | 
                                                        |
| 2674 | +  | 
                                                        |
| 2675 | +								if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2676 | + $field_icon_af = '';  | 
                                                        |
| 2677 | +								} else if ($field_icon == '') {
 | 
                                                        |
| 2678 | + $field_icon_af = '';  | 
                                                        |
| 2679 | +								} else {
 | 
                                                        |
| 2680 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2681 | + $field_icon = '';  | 
                                                        |
| 2682 | + }  | 
                                                        |
| 2683 | +  | 
                                                        |
| 2684 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2685 | +  | 
                                                        |
| 2686 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2687 | +  | 
                                                        |
| 2688 | +								if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2689 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2690 | + }  | 
                                                        |
| 2691 | +  | 
                                                        |
| 2692 | + $html .= ' </span>' . $html_val . '</div>';  | 
                                                        |
| 2693 | + }  | 
                                                        |
| 2694 | + }  | 
                                                        |
| 2695 | + break;  | 
                                                        |
| 2696 | +						case 'checkbox': {
 | 
                                                        |
| 2697 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2698 | + $html_val = $type['htmlvar_name'];  | 
                                                        |
| 2699 | +  | 
                                                        |
| 2700 | +							if ((int)$post->{$html_var} == 1) {
 | 
                                                        |
| 2701 | +  | 
                                                        |
| 2702 | +								if ($post->{$type['htmlvar_name']} == '1') {
 | 
                                                        |
| 2703 | +									$html_val = __('Yes', 'geodirectory');
 | 
                                                        |
| 2704 | +								} else {
 | 
                                                        |
| 2705 | +									$html_val = __('No', 'geodirectory');
 | 
                                                        |
| 2706 | + }  | 
                                                        |
| 2707 | +  | 
                                                        |
| 2708 | +								if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2709 | + $field_icon_af = '';  | 
                                                        |
| 2710 | +								} else if ($field_icon == '') {
 | 
                                                        |
| 2711 | + $field_icon_af = '';  | 
                                                        |
| 2712 | +								} else {
 | 
                                                        |
| 2713 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2714 | + $field_icon = '';  | 
                                                        |
| 2715 | + }  | 
                                                        |
| 2716 | +  | 
                                                        |
| 2717 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2718 | +  | 
                                                        |
| 2719 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2720 | +  | 
                                                        |
| 2721 | +								if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2722 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2723 | + }  | 
                                                        |
| 2724 | +  | 
                                                        |
| 2725 | + $html .= ' </span>' . $html_val . '</div>';  | 
                                                        |
| 2726 | + }  | 
                                                        |
| 2727 | + }  | 
                                                        |
| 2728 | + break;  | 
                                                        |
| 2729 | +						case 'select': {
 | 
                                                        |
| 2730 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2731 | + $field_icon_af = '';  | 
                                                        |
| 2732 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2733 | + $field_icon_af = '';  | 
                                                        |
| 2734 | +							} else {
 | 
                                                        |
| 2735 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2736 | + $field_icon = '';  | 
                                                        |
| 2737 | + }  | 
                                                        |
| 2738 | 2738 | |
| 2739 | -                            $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        |
| 2739 | +							$field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
 | 
                                                        |
| 2740 | 2740 | |
| 2741 | -                            if (!empty($type['option_values'])) {
 | 
                                                        |
| 2742 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2741 | +							if (!empty($type['option_values'])) {
 | 
                                                        |
| 2742 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2743 | 2743 | |
| 2744 | -                                if (!empty($cf_option_values)) {
 | 
                                                        |
| 2745 | -                                    foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2746 | -                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2747 | - $field_value = $cf_option_value['label'];  | 
                                                        |
| 2748 | - }  | 
                                                        |
| 2749 | - }  | 
                                                        |
| 2750 | - }  | 
                                                        |
| 2751 | - }  | 
                                                        |
| 2752 | -  | 
                                                        |
| 2753 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2754 | -  | 
                                                        |
| 2755 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2756 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2757 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2758 | - }  | 
                                                        |
| 2759 | - $html .= ' </span>' . $field_value . '</div>';  | 
                                                        |
| 2760 | - }  | 
                                                        |
| 2761 | - break;  | 
                                                        |
| 2762 | -                        case 'multiselect': {
 | 
                                                        |
| 2763 | -                            if (is_array($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2764 | -                                $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2765 | - }  | 
                                                        |
| 2766 | -  | 
                                                        |
| 2767 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2768 | - $field_icon_af = '';  | 
                                                        |
| 2769 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2770 | - $field_icon_af = '';  | 
                                                        |
| 2771 | -                            } else {
 | 
                                                        |
| 2772 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2773 | - $field_icon = '';  | 
                                                        |
| 2774 | - }  | 
                                                        |
| 2775 | -  | 
                                                        |
| 2776 | -                            $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
 | 
                                                        |
| 2777 | -  | 
                                                        |
| 2778 | - $option_values = array();  | 
                                                        |
| 2779 | -                            if (!empty($type['option_values'])) {
 | 
                                                        |
| 2780 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2744 | +								if (!empty($cf_option_values)) {
 | 
                                                        |
| 2745 | +									foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2746 | +										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
 | 
                                                        |
| 2747 | + $field_value = $cf_option_value['label'];  | 
                                                        |
| 2748 | + }  | 
                                                        |
| 2749 | + }  | 
                                                        |
| 2750 | + }  | 
                                                        |
| 2751 | + }  | 
                                                        |
| 2752 | +  | 
                                                        |
| 2753 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2754 | +  | 
                                                        |
| 2755 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2756 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2757 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2758 | + }  | 
                                                        |
| 2759 | + $html .= ' </span>' . $field_value . '</div>';  | 
                                                        |
| 2760 | + }  | 
                                                        |
| 2761 | + break;  | 
                                                        |
| 2762 | +						case 'multiselect': {
 | 
                                                        |
| 2763 | +							if (is_array($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2764 | +								$post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2765 | + }  | 
                                                        |
| 2766 | +  | 
                                                        |
| 2767 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2768 | + $field_icon_af = '';  | 
                                                        |
| 2769 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2770 | + $field_icon_af = '';  | 
                                                        |
| 2771 | +							} else {
 | 
                                                        |
| 2772 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2773 | + $field_icon = '';  | 
                                                        |
| 2774 | + }  | 
                                                        |
| 2775 | +  | 
                                                        |
| 2776 | +							$field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
 | 
                                                        |
| 2777 | +  | 
                                                        |
| 2778 | + $option_values = array();  | 
                                                        |
| 2779 | +							if (!empty($type['option_values'])) {
 | 
                                                        |
| 2780 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);  | 
                                                        |
| 2781 | 2781 | |
| 2782 | -                                if (!empty($cf_option_values)) {
 | 
                                                        |
| 2783 | -                                    foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2784 | -                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
 | 
                                                        |
| 2785 | - $option_values[] = $cf_option_value['label'];  | 
                                                        |
| 2786 | - }  | 
                                                        |
| 2787 | - }  | 
                                                        |
| 2788 | - }  | 
                                                        |
| 2789 | - }  | 
                                                        |
| 2790 | -  | 
                                                        |
| 2791 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2792 | -  | 
                                                        |
| 2793 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2794 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2795 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2796 | - }  | 
                                                        |
| 2797 | - $html .= ' </span>';  | 
                                                        |
| 2798 | -  | 
                                                        |
| 2799 | - $html .= ' <span class="gd-multiselect-value-output gd-val-'.$type['htmlvar_name'].'" >';  | 
                                                        |
| 2800 | -  | 
                                                        |
| 2801 | -                            if (count($option_values) > 1) {
 | 
                                                        |
| 2802 | -                                $html .= "<span>".implode('</span>, <span>',$option_values)."</span>";
 | 
                                                        |
| 2803 | -                            } else {
 | 
                                                        |
| 2804 | -                                $vals = explode(",",$post->{$type['htmlvar_name']});
 | 
                                                        |
| 2805 | -                                $html .= "<span>".implode('</span>, <span>', $vals)."</span>";
 | 
                                                        |
| 2806 | - }  | 
                                                        |
| 2807 | -  | 
                                                        |
| 2808 | - $html .= ' </span>';  | 
                                                        |
| 2809 | -  | 
                                                        |
| 2810 | -  | 
                                                        |
| 2811 | -  | 
                                                        |
| 2812 | -  | 
                                                        |
| 2813 | - $html .= '</div>';  | 
                                                        |
| 2814 | - }  | 
                                                        |
| 2815 | - break;  | 
                                                        |
| 2816 | -                        case 'email': {
 | 
                                                        |
| 2817 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2818 | - $field_icon_af = '';  | 
                                                        |
| 2819 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2820 | - $field_icon_af = '<i class="fa fa-envelope"></i>';  | 
                                                        |
| 2821 | -                            } else {
 | 
                                                        |
| 2822 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2823 | - $field_icon = '';  | 
                                                        |
| 2824 | - }  | 
                                                        |
| 2825 | -  | 
                                                        |
| 2826 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2827 | -  | 
                                                        |
| 2828 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2829 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2830 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2831 | - }  | 
                                                        |
| 2832 | -                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2833 | - }  | 
                                                        |
| 2834 | - break;  | 
                                                        |
| 2835 | -                        case 'textarea': {
 | 
                                                        |
| 2836 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2837 | - $field_icon_af = '';  | 
                                                        |
| 2838 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2839 | - $field_icon_af = '';  | 
                                                        |
| 2840 | -                            } else {
 | 
                                                        |
| 2841 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2842 | - $field_icon = '';  | 
                                                        |
| 2843 | - }  | 
                                                        |
| 2844 | -  | 
                                                        |
| 2845 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2846 | -  | 
                                                        |
| 2847 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2848 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2849 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2850 | - }  | 
                                                        |
| 2851 | -                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 2852 | - }  | 
                                                        |
| 2853 | - break;  | 
                                                        |
| 2854 | -                        case 'html': {
 | 
                                                        |
| 2855 | -                            if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2856 | - $field_icon_af = '';  | 
                                                        |
| 2857 | -                            } elseif ($field_icon == '') {
 | 
                                                        |
| 2858 | - $field_icon_af = '';  | 
                                                        |
| 2859 | -                            } else {
 | 
                                                        |
| 2860 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2861 | - $field_icon = '';  | 
                                                        |
| 2862 | - }  | 
                                                        |
| 2863 | -  | 
                                                        |
| 2864 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2865 | -  | 
                                                        |
| 2866 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2867 | -                            if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2868 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2869 | - }  | 
                                                        |
| 2870 | -                            $html .= ' </span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 2871 | - }  | 
                                                        |
| 2872 | - break;  | 
                                                        |
| 2873 | -                        case 'file': {
 | 
                                                        |
| 2874 | - $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2875 | -  | 
                                                        |
| 2876 | -                            if (!empty($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2877 | -                                $files = explode(",", $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2878 | -  | 
                                                        |
| 2879 | -                                if (!empty($files)) {
 | 
                                                        |
| 2880 | - $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;  | 
                                                        |
| 2881 | -                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 2782 | +								if (!empty($cf_option_values)) {
 | 
                                                        |
| 2783 | +									foreach ($cf_option_values as $cf_option_value) {
 | 
                                                        |
| 2784 | +										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
 | 
                                                        |
| 2785 | + $option_values[] = $cf_option_value['label'];  | 
                                                        |
| 2786 | + }  | 
                                                        |
| 2787 | + }  | 
                                                        |
| 2788 | + }  | 
                                                        |
| 2789 | + }  | 
                                                        |
| 2790 | +  | 
                                                        |
| 2791 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2792 | +  | 
                                                        |
| 2793 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2794 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2795 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2796 | + }  | 
                                                        |
| 2797 | + $html .= ' </span>';  | 
                                                        |
| 2798 | +  | 
                                                        |
| 2799 | + $html .= ' <span class="gd-multiselect-value-output gd-val-'.$type['htmlvar_name'].'" >';  | 
                                                        |
| 2800 | +  | 
                                                        |
| 2801 | +							if (count($option_values) > 1) {
 | 
                                                        |
| 2802 | +								$html .= "<span>".implode('</span>, <span>',$option_values)."</span>";
 | 
                                                        |
| 2803 | +							} else {
 | 
                                                        |
| 2804 | +								$vals = explode(",",$post->{$type['htmlvar_name']});
 | 
                                                        |
| 2805 | +								$html .= "<span>".implode('</span>, <span>', $vals)."</span>";
 | 
                                                        |
| 2806 | + }  | 
                                                        |
| 2807 | +  | 
                                                        |
| 2808 | + $html .= ' </span>';  | 
                                                        |
| 2809 | +  | 
                                                        |
| 2810 | +  | 
                                                        |
| 2811 | +  | 
                                                        |
| 2812 | +  | 
                                                        |
| 2813 | + $html .= '</div>';  | 
                                                        |
| 2814 | + }  | 
                                                        |
| 2815 | + break;  | 
                                                        |
| 2816 | +						case 'email': {
 | 
                                                        |
| 2817 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2818 | + $field_icon_af = '';  | 
                                                        |
| 2819 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2820 | + $field_icon_af = '<i class="fa fa-envelope"></i>';  | 
                                                        |
| 2821 | +							} else {
 | 
                                                        |
| 2822 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2823 | + $field_icon = '';  | 
                                                        |
| 2824 | + }  | 
                                                        |
| 2825 | +  | 
                                                        |
| 2826 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2827 | +  | 
                                                        |
| 2828 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2829 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2830 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2831 | + }  | 
                                                        |
| 2832 | +							$html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2833 | + }  | 
                                                        |
| 2834 | + break;  | 
                                                        |
| 2835 | +						case 'textarea': {
 | 
                                                        |
| 2836 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2837 | + $field_icon_af = '';  | 
                                                        |
| 2838 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2839 | + $field_icon_af = '';  | 
                                                        |
| 2840 | +							} else {
 | 
                                                        |
| 2841 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2842 | + $field_icon = '';  | 
                                                        |
| 2843 | + }  | 
                                                        |
| 2844 | +  | 
                                                        |
| 2845 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2846 | +  | 
                                                        |
| 2847 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2848 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2849 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2850 | + }  | 
                                                        |
| 2851 | +							$html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 2852 | + }  | 
                                                        |
| 2853 | + break;  | 
                                                        |
| 2854 | +						case 'html': {
 | 
                                                        |
| 2855 | +							if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2856 | + $field_icon_af = '';  | 
                                                        |
| 2857 | +							} elseif ($field_icon == '') {
 | 
                                                        |
| 2858 | + $field_icon_af = '';  | 
                                                        |
| 2859 | +							} else {
 | 
                                                        |
| 2860 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2861 | + $field_icon = '';  | 
                                                        |
| 2862 | + }  | 
                                                        |
| 2863 | +  | 
                                                        |
| 2864 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2865 | +  | 
                                                        |
| 2866 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2867 | +							if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2868 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2869 | + }  | 
                                                        |
| 2870 | +							$html .= ' </span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 2871 | + }  | 
                                                        |
| 2872 | + break;  | 
                                                        |
| 2873 | +						case 'file': {
 | 
                                                        |
| 2874 | + $html_var = $type['htmlvar_name'];  | 
                                                        |
| 2875 | +  | 
                                                        |
| 2876 | +							if (!empty($post->{$type['htmlvar_name']})) {
 | 
                                                        |
| 2877 | +								$files = explode(",", $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2878 | +  | 
                                                        |
| 2879 | +								if (!empty($files)) {
 | 
                                                        |
| 2880 | + $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;  | 
                                                        |
| 2881 | +									$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 2882 | 2882 | |
| 2883 | - $file_paths = '';  | 
                                                        |
| 2884 | -                                    foreach ($files as $file) {
 | 
                                                        |
| 2885 | -                                        if (!empty($file)) {
 | 
                                                        |
| 2886 | -                                            $image_name_arr = explode('/', $file);
 | 
                                                        |
| 2887 | - $filename = end($image_name_arr);  | 
                                                        |
| 2888 | -  | 
                                                        |
| 2889 | - $arr_file_type = wp_check_filetype($filename);  | 
                                                        |
| 2890 | -                                            if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
 | 
                                                        |
| 2891 | - continue;  | 
                                                        |
| 2892 | - }  | 
                                                        |
| 2893 | - $uploaded_file_type = $arr_file_type['type'];  | 
                                                        |
| 2894 | - $uploaded_file_ext = $arr_file_type['ext'];  | 
                                                        |
| 2883 | + $file_paths = '';  | 
                                                        |
| 2884 | +									foreach ($files as $file) {
 | 
                                                        |
| 2885 | +										if (!empty($file)) {
 | 
                                                        |
| 2886 | +											$image_name_arr = explode('/', $file);
 | 
                                                        |
| 2887 | + $filename = end($image_name_arr);  | 
                                                        |
| 2888 | +  | 
                                                        |
| 2889 | + $arr_file_type = wp_check_filetype($filename);  | 
                                                        |
| 2890 | +											if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
 | 
                                                        |
| 2891 | + continue;  | 
                                                        |
| 2892 | + }  | 
                                                        |
| 2893 | + $uploaded_file_type = $arr_file_type['type'];  | 
                                                        |
| 2894 | + $uploaded_file_ext = $arr_file_type['ext'];  | 
                                                        |
| 2895 | 2895 | |
| 2896 | -                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
 | 
                                                        |
| 2897 | - continue; // Invalid file type.  | 
                                                        |
| 2898 | - }  | 
                                                        |
| 2899 | -  | 
                                                        |
| 2900 | -                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
 | 
                                                        |
| 2901 | -  | 
                                                        |
| 2902 | - // If the uploaded file is image  | 
                                                        |
| 2903 | -                                            if (in_array($uploaded_file_type, $image_file_types)) {
 | 
                                                        |
| 2904 | - $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';  | 
                                                        |
| 2905 | - $file_paths .= '<a href="'.$file.'">';  | 
                                                        |
| 2906 | -                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
 | 
                                                        |
| 2907 | - $file_paths .= '</a>';  | 
                                                        |
| 2908 | - $file_paths .= '</div>';  | 
                                                        |
| 2909 | -                                            } else {
 | 
                                                        |
| 2910 | - $ext_path = '_' . $html_var . '_';  | 
                                                        |
| 2911 | - $filename = explode($ext_path, $filename);  | 
                                                        |
| 2912 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';  | 
                                                        |
| 2913 | - }  | 
                                                        |
| 2914 | - }  | 
                                                        |
| 2915 | - }  | 
                                                        |
| 2916 | -  | 
                                                        |
| 2917 | -                                    if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2918 | - $field_icon_af = '';  | 
                                                        |
| 2919 | -                                    } else if ($field_icon == '') {
 | 
                                                        |
| 2920 | - $field_icon_af = '';  | 
                                                        |
| 2921 | -                                    } else {
 | 
                                                        |
| 2922 | - $field_icon_af = $field_icon;  | 
                                                        |
| 2923 | - $field_icon = '';  | 
                                                        |
| 2924 | - }  | 
                                                        |
| 2925 | -  | 
                                                        |
| 2926 | - $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2927 | -  | 
                                                        |
| 2928 | -  | 
                                                        |
| 2929 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2930 | -  | 
                                                        |
| 2931 | -                                    if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2932 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2933 | - }  | 
                                                        |
| 2934 | -  | 
                                                        |
| 2935 | - $html .= ' </span>' . $file_paths . '</div>';  | 
                                                        |
| 2936 | - }  | 
                                                        |
| 2937 | - }  | 
                                                        |
| 2938 | - }  | 
                                                        |
| 2939 | - break;  | 
                                                        |
| 2940 | - }  | 
                                                        |
| 2941 | -  | 
                                                        |
| 2942 | -  | 
                                                        |
| 2943 | - /**  | 
                                                        |
| 2944 | - * Filter custom field output in tab.  | 
                                                        |
| 2945 | - *  | 
                                                        |
| 2946 | - * @since 1.5.6  | 
                                                        |
| 2947 | - *  | 
                                                        |
| 2948 | - * @param string $html_var The HTML variable name for the field.  | 
                                                        |
| 2949 | - * @param string $html Custom field unfiltered HTML.  | 
                                                        |
| 2950 | - * @param array $variables_array Custom field variables array.  | 
                                                        |
| 2951 | - */  | 
                                                        |
| 2952 | -                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
 | 
                                                        |
| 2953 | -  | 
                                                        |
| 2954 | - $fieldset_html = '';  | 
                                                        |
| 2955 | -                    if ($field_set_start == 1) {
 | 
                                                        |
| 2956 | - $add_html = false;  | 
                                                        |
| 2957 | -                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
 | 
                                                        |
| 2958 | -                            if ($fieldset != '') {
 | 
                                                        |
| 2959 | - $add_html = true;  | 
                                                        |
| 2960 | - $label = $fieldset_arr[$fieldset_count - 1]['label'];  | 
                                                        |
| 2961 | - $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];  | 
                                                        |
| 2962 | - }  | 
                                                        |
| 2963 | - $fieldset_html = $fieldset;  | 
                                                        |
| 2964 | - $fieldset = '';  | 
                                                        |
| 2965 | -                        } else {
 | 
                                                        |
| 2966 | - $fieldset .= $html;  | 
                                                        |
| 2967 | -                            if ($total_fields == $count_field && $fieldset != '') {
 | 
                                                        |
| 2968 | - $add_html = true;  | 
                                                        |
| 2969 | - $label = $fieldset_arr[$fieldset_count]['label'];  | 
                                                        |
| 2970 | - $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];  | 
                                                        |
| 2971 | - $fieldset_html = $fieldset;  | 
                                                        |
| 2972 | - }  | 
                                                        |
| 2973 | - }  | 
                                                        |
| 2974 | -  | 
                                                        |
| 2975 | -                        if ($add_html) {
 | 
                                                        |
| 2976 | - $tabs_arr[$htmlvar_name] = array(  | 
                                                        |
| 2977 | - 'heading_text' => __($label, 'geodirectory'),  | 
                                                        |
| 2978 | - 'is_active_tab' => false,  | 
                                                        |
| 2979 | - /**  | 
                                                        |
| 2980 | - * Filter if a custom field should be displayed on the details page tab.  | 
                                                        |
| 2981 | - *  | 
                                                        |
| 2982 | - * @since 1.0.0  | 
                                                        |
| 2983 | - * @param string $htmlvar_name The field HTML var name.  | 
                                                        |
| 2984 | - */  | 
                                                        |
| 2985 | -                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
 | 
                                                        |
| 2986 | - 'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'  | 
                                                        |
| 2987 | - );  | 
                                                        |
| 2988 | - }  | 
                                                        |
| 2989 | -                    } else {
 | 
                                                        |
| 2990 | -                        if ($html != '') {
 | 
                                                        |
| 2991 | - $tabs_arr[$field['htmlvar_name']] = array(  | 
                                                        |
| 2992 | - 'heading_text' => __($label, 'geodirectory'),  | 
                                                        |
| 2993 | - 'is_active_tab' => false,  | 
                                                        |
| 2994 | - /** This action is documented in geodirectory_hooks_actions.php */  | 
                                                        |
| 2995 | -                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
 | 
                                                        |
| 2996 | - 'tab_content' => $html  | 
                                                        |
| 2997 | - );  | 
                                                        |
| 2998 | - }  | 
                                                        |
| 2999 | - }  | 
                                                        |
| 3000 | - }  | 
                                                        |
| 3001 | - }  | 
                                                        |
| 3002 | - }  | 
                                                        |
| 3003 | - }  | 
                                                        |
| 3004 | - return $tabs_arr;  | 
                                                        |
| 2896 | +											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
 | 
                                                        |
| 2897 | + continue; // Invalid file type.  | 
                                                        |
| 2898 | + }  | 
                                                        |
| 2899 | +  | 
                                                        |
| 2900 | +											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
 | 
                                                        |
| 2901 | +  | 
                                                        |
| 2902 | + // If the uploaded file is image  | 
                                                        |
| 2903 | +											if (in_array($uploaded_file_type, $image_file_types)) {
 | 
                                                        |
| 2904 | + $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';  | 
                                                        |
| 2905 | + $file_paths .= '<a href="'.$file.'">';  | 
                                                        |
| 2906 | +												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
 | 
                                                        |
| 2907 | + $file_paths .= '</a>';  | 
                                                        |
| 2908 | + $file_paths .= '</div>';  | 
                                                        |
| 2909 | +											} else {
 | 
                                                        |
| 2910 | + $ext_path = '_' . $html_var . '_';  | 
                                                        |
| 2911 | + $filename = explode($ext_path, $filename);  | 
                                                        |
| 2912 | + $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';  | 
                                                        |
| 2913 | + }  | 
                                                        |
| 2914 | + }  | 
                                                        |
| 2915 | + }  | 
                                                        |
| 2916 | +  | 
                                                        |
| 2917 | +									if (strpos($field_icon, 'http') !== false) {
 | 
                                                        |
| 2918 | + $field_icon_af = '';  | 
                                                        |
| 2919 | +									} else if ($field_icon == '') {
 | 
                                                        |
| 2920 | + $field_icon_af = '';  | 
                                                        |
| 2921 | +									} else {
 | 
                                                        |
| 2922 | + $field_icon_af = $field_icon;  | 
                                                        |
| 2923 | + $field_icon = '';  | 
                                                        |
| 2924 | + }  | 
                                                        |
| 2925 | +  | 
                                                        |
| 2926 | + $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        |
| 2927 | +  | 
                                                        |
| 2928 | +  | 
                                                        |
| 2929 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2930 | +  | 
                                                        |
| 2931 | +									if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        |
| 2932 | + $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2933 | + }  | 
                                                        |
| 2934 | +  | 
                                                        |
| 2935 | + $html .= ' </span>' . $file_paths . '</div>';  | 
                                                        |
| 2936 | + }  | 
                                                        |
| 2937 | + }  | 
                                                        |
| 2938 | + }  | 
                                                        |
| 2939 | + break;  | 
                                                        |
| 2940 | + }  | 
                                                        |
| 2941 | +  | 
                                                        |
| 2942 | +  | 
                                                        |
| 2943 | + /**  | 
                                                        |
| 2944 | + * Filter custom field output in tab.  | 
                                                        |
| 2945 | + *  | 
                                                        |
| 2946 | + * @since 1.5.6  | 
                                                        |
| 2947 | + *  | 
                                                        |
| 2948 | + * @param string $html_var The HTML variable name for the field.  | 
                                                        |
| 2949 | + * @param string $html Custom field unfiltered HTML.  | 
                                                        |
| 2950 | + * @param array $variables_array Custom field variables array.  | 
                                                        |
| 2951 | + */  | 
                                                        |
| 2952 | +					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
 | 
                                                        |
| 2953 | +  | 
                                                        |
| 2954 | + $fieldset_html = '';  | 
                                                        |
| 2955 | +					if ($field_set_start == 1) {
 | 
                                                        |
| 2956 | + $add_html = false;  | 
                                                        |
| 2957 | +						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
 | 
                                                        |
| 2958 | +							if ($fieldset != '') {
 | 
                                                        |
| 2959 | + $add_html = true;  | 
                                                        |
| 2960 | + $label = $fieldset_arr[$fieldset_count - 1]['label'];  | 
                                                        |
| 2961 | + $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];  | 
                                                        |
| 2962 | + }  | 
                                                        |
| 2963 | + $fieldset_html = $fieldset;  | 
                                                        |
| 2964 | + $fieldset = '';  | 
                                                        |
| 2965 | +						} else {
 | 
                                                        |
| 2966 | + $fieldset .= $html;  | 
                                                        |
| 2967 | +							if ($total_fields == $count_field && $fieldset != '') {
 | 
                                                        |
| 2968 | + $add_html = true;  | 
                                                        |
| 2969 | + $label = $fieldset_arr[$fieldset_count]['label'];  | 
                                                        |
| 2970 | + $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];  | 
                                                        |
| 2971 | + $fieldset_html = $fieldset;  | 
                                                        |
| 2972 | + }  | 
                                                        |
| 2973 | + }  | 
                                                        |
| 2974 | +  | 
                                                        |
| 2975 | +						if ($add_html) {
 | 
                                                        |
| 2976 | + $tabs_arr[$htmlvar_name] = array(  | 
                                                        |
| 2977 | + 'heading_text' => __($label, 'geodirectory'),  | 
                                                        |
| 2978 | + 'is_active_tab' => false,  | 
                                                        |
| 2979 | + /**  | 
                                                        |
| 2980 | + * Filter if a custom field should be displayed on the details page tab.  | 
                                                        |
| 2981 | + *  | 
                                                        |
| 2982 | + * @since 1.0.0  | 
                                                        |
| 2983 | + * @param string $htmlvar_name The field HTML var name.  | 
                                                        |
| 2984 | + */  | 
                                                        |
| 2985 | +								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
 | 
                                                        |
| 2986 | + 'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'  | 
                                                        |
| 2987 | + );  | 
                                                        |
| 2988 | + }  | 
                                                        |
| 2989 | +					} else {
 | 
                                                        |
| 2990 | +						if ($html != '') {
 | 
                                                        |
| 2991 | + $tabs_arr[$field['htmlvar_name']] = array(  | 
                                                        |
| 2992 | + 'heading_text' => __($label, 'geodirectory'),  | 
                                                        |
| 2993 | + 'is_active_tab' => false,  | 
                                                        |
| 2994 | + /** This action is documented in geodirectory_hooks_actions.php */  | 
                                                        |
| 2995 | +								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
 | 
                                                        |
| 2996 | + 'tab_content' => $html  | 
                                                        |
| 2997 | + );  | 
                                                        |
| 2998 | + }  | 
                                                        |
| 2999 | + }  | 
                                                        |
| 3000 | + }  | 
                                                        |
| 3001 | + }  | 
                                                        |
| 3002 | + }  | 
                                                        |
| 3003 | + }  | 
                                                        |
| 3004 | + return $tabs_arr;  | 
                                                        |
| 3005 | 3005 | }  | 
                                                        
| 3006 | 3006 | |
| 3007 | 3007 | /* display add listing page for wpml */  | 
                                                        
@@ -3025,37 +3025,37 @@ discard block  | 
                                                    ||
| 3025 | 3025 | */  | 
                                                        
| 3026 | 3026 | function geodir_add_post_status_author_page()  | 
                                                        
| 3027 | 3027 |  {
 | 
                                                        
| 3028 | - global $wpdb, $post;  | 
                                                        |
| 3029 | -  | 
                                                        |
| 3030 | - $html = '';  | 
                                                        |
| 3031 | -    if (get_current_user_id()) {
 | 
                                                        |
| 3032 | -        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
 | 
                                                        |
| 3033 | -  | 
                                                        |
| 3034 | - // 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.  | 
                                                        |
| 3035 | -            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
 | 
                                                        |
| 3036 | -            $status = "<strong>(";
 | 
                                                        |
| 3037 | - $status_icon = '<i class="fa fa-play"></i>';  | 
                                                        |
| 3038 | -            if ($real_status == 'publish') {
 | 
                                                        |
| 3039 | -                $status .= __('Published', 'geodirectory');
 | 
                                                        |
| 3040 | -            } else {
 | 
                                                        |
| 3041 | -                $status .= __('Not published', 'geodirectory');
 | 
                                                        |
| 3042 | - $status_icon = '<i class="fa fa-pause"></i>';  | 
                                                        |
| 3043 | - }  | 
                                                        |
| 3044 | - $status .= ")</strong>";  | 
                                                        |
| 3028 | + global $wpdb, $post;  | 
                                                        |
| 3029 | +  | 
                                                        |
| 3030 | + $html = '';  | 
                                                        |
| 3031 | +	if (get_current_user_id()) {
 | 
                                                        |
| 3032 | +		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
 | 
                                                        |
| 3033 | +  | 
                                                        |
| 3034 | + // 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.  | 
                                                        |
| 3035 | +			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
 | 
                                                        |
| 3036 | +			$status = "<strong>(";
 | 
                                                        |
| 3037 | + $status_icon = '<i class="fa fa-play"></i>';  | 
                                                        |
| 3038 | +			if ($real_status == 'publish') {
 | 
                                                        |
| 3039 | +				$status .= __('Published', 'geodirectory');
 | 
                                                        |
| 3040 | +			} else {
 | 
                                                        |
| 3041 | +				$status .= __('Not published', 'geodirectory');
 | 
                                                        |
| 3042 | + $status_icon = '<i class="fa fa-pause"></i>';  | 
                                                        |
| 3043 | + }  | 
                                                        |
| 3044 | + $status .= ")</strong>";  | 
                                                        |
| 3045 | 3045 | |
| 3046 | -            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
 | 
                                                        |
| 3047 | - }  | 
                                                        |
| 3048 | - }  | 
                                                        |
| 3046 | +			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
 | 
                                                        |
| 3047 | + }  | 
                                                        |
| 3048 | + }  | 
                                                        |
| 3049 | 3049 | |
| 3050 | -    if ($html != '') {
 | 
                                                        |
| 3051 | - /**  | 
                                                        |
| 3052 | - * Filter the post status text on the author page.  | 
                                                        |
| 3053 | - *  | 
                                                        |
| 3054 | - * @since 1.0.0  | 
                                                        |
| 3055 | - * @param string $html The HTML of the status.  | 
                                                        |
| 3056 | - */  | 
                                                        |
| 3057 | -        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
 | 
                                                        |
| 3058 | - }  | 
                                                        |
| 3050 | +	if ($html != '') {
 | 
                                                        |
| 3051 | + /**  | 
                                                        |
| 3052 | + * Filter the post status text on the author page.  | 
                                                        |
| 3053 | + *  | 
                                                        |
| 3054 | + * @since 1.0.0  | 
                                                        |
| 3055 | + * @param string $html The HTML of the status.  | 
                                                        |
| 3056 | + */  | 
                                                        |
| 3057 | +		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
 | 
                                                        |
| 3058 | + }  | 
                                                        |
| 3059 | 3059 | |
| 3060 | 3060 | |
| 3061 | 3061 | }  | 
                                                        
@@ -3069,21 +3069,21 @@ discard block  | 
                                                    ||
| 3069 | 3069 | */  | 
                                                        
| 3070 | 3070 | function geodir_init_no_rating()  | 
                                                        
| 3071 | 3071 |  {
 | 
                                                        
| 3072 | -    if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3073 | -        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
 | 
                                                        |
| 3074 | -        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
 | 
                                                        |
| 3075 | -        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
 | 
                                                        |
| 3076 | -        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
 | 
                                                        |
| 3077 | -        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
 | 
                                                        |
| 3078 | -        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
 | 
                                                        |
| 3079 | -        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
 | 
                                                        |
| 3080 | -  | 
                                                        |
| 3081 | -        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
 | 
                                                        |
| 3082 | -        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
 | 
                                                        |
| 3083 | -        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
 | 
                                                        |
| 3084 | -        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
 | 
                                                        |
| 3085 | -        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
 | 
                                                        |
| 3086 | - }  | 
                                                        |
| 3072 | +	if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3073 | +		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
 | 
                                                        |
| 3074 | +		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
 | 
                                                        |
| 3075 | +		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
 | 
                                                        |
| 3076 | +		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
 | 
                                                        |
| 3077 | +		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
 | 
                                                        |
| 3078 | +		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
 | 
                                                        |
| 3079 | +		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
 | 
                                                        |
| 3080 | +  | 
                                                        |
| 3081 | +		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
 | 
                                                        |
| 3082 | +		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
 | 
                                                        |
| 3083 | +		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
 | 
                                                        |
| 3084 | +		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
 | 
                                                        |
| 3085 | +		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
 | 
                                                        |
| 3086 | + }  | 
                                                        |
| 3087 | 3087 | }  | 
                                                        
| 3088 | 3088 | |
| 3089 | 3089 | /**  | 
                                                        
@@ -3095,20 +3095,20 @@ discard block  | 
                                                    ||
| 3095 | 3095 | */  | 
                                                        
| 3096 | 3096 | function geodir_no_rating_rating_fields()  | 
                                                        
| 3097 | 3097 |  {
 | 
                                                        
| 3098 | - global $post;  | 
                                                        |
| 3098 | + global $post;  | 
                                                        |
| 3099 | 3099 | |
| 3100 | - $post_types = geodir_get_posttypes();  | 
                                                        |
| 3100 | + $post_types = geodir_get_posttypes();  | 
                                                        |
| 3101 | 3101 | |
| 3102 | -    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
 | 
                                                        |
| 3103 | -        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
 | 
                                                        |
| 3104 | - echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';  | 
                                                        |
| 3105 | -            if (get_option('geodir_reviewrating_enable_images')) {
 | 
                                                        |
| 3106 | - geodir_reviewrating_rating_img_html();  | 
                                                        |
| 3107 | - }  | 
                                                        |
| 3108 | -        } else {
 | 
                                                        |
| 3109 | - echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';  | 
                                                        |
| 3110 | - }  | 
                                                        |
| 3111 | - }  | 
                                                        |
| 3102 | +	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
 | 
                                                        |
| 3103 | +		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
 | 
                                                        |
| 3104 | + echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';  | 
                                                        |
| 3105 | +			if (get_option('geodir_reviewrating_enable_images')) {
 | 
                                                        |
| 3106 | + geodir_reviewrating_rating_img_html();  | 
                                                        |
| 3107 | + }  | 
                                                        |
| 3108 | +		} else {
 | 
                                                        |
| 3109 | + echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';  | 
                                                        |
| 3110 | + }  | 
                                                        |
| 3111 | + }  | 
                                                        |
| 3112 | 3112 | }  | 
                                                        
| 3113 | 3113 | |
| 3114 | 3114 | /**  | 
                                                        
@@ -3122,11 +3122,11 @@ discard block  | 
                                                    ||
| 3122 | 3122 | */  | 
                                                        
| 3123 | 3123 | function geodir_no_rating_comment_text($content, $comment = '')  | 
                                                        
| 3124 | 3124 |  {
 | 
                                                        
| 3125 | -    if (!is_admin()) {
 | 
                                                        |
| 3126 | - return '<div class="description">' . $content . '</div>';  | 
                                                        |
| 3127 | -    } else {
 | 
                                                        |
| 3128 | - return $content;  | 
                                                        |
| 3129 | - }  | 
                                                        |
| 3125 | +	if (!is_admin()) {
 | 
                                                        |
| 3126 | + return '<div class="description">' . $content . '</div>';  | 
                                                        |
| 3127 | +	} else {
 | 
                                                        |
| 3128 | + return $content;  | 
                                                        |
| 3129 | + }  | 
                                                        |
| 3130 | 3130 | }  | 
                                                        
| 3131 | 3131 | |
| 3132 | 3132 | /**  | 
                                                        
@@ -3139,7 +3139,7 @@ discard block  | 
                                                    ||
| 3139 | 3139 | */  | 
                                                        
| 3140 | 3140 | function geodir_no_rating_review_rating_html($content = '')  | 
                                                        
| 3141 | 3141 |  {
 | 
                                                        
| 3142 | - return NULL;  | 
                                                        |
| 3142 | + return NULL;  | 
                                                        |
| 3143 | 3143 | }  | 
                                                        
| 3144 | 3144 | |
| 3145 | 3145 | /**  | 
                                                        
@@ -3153,19 +3153,19 @@ discard block  | 
                                                    ||
| 3153 | 3153 | */  | 
                                                        
| 3154 | 3154 | function geodir_no_rating_get_sort_options($options, $post_type = '')  | 
                                                        
| 3155 | 3155 |  {
 | 
                                                        
| 3156 | - $new_options = array();  | 
                                                        |
| 3157 | -    if (!empty($options)) {
 | 
                                                        |
| 3158 | -        foreach ($options as $option) {
 | 
                                                        |
| 3159 | -            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
 | 
                                                        |
| 3160 | - continue;  | 
                                                        |
| 3161 | - }  | 
                                                        |
| 3162 | - $new_options[] = $option;  | 
                                                        |
| 3163 | - }  | 
                                                        |
| 3156 | + $new_options = array();  | 
                                                        |
| 3157 | +	if (!empty($options)) {
 | 
                                                        |
| 3158 | +		foreach ($options as $option) {
 | 
                                                        |
| 3159 | +			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
 | 
                                                        |
| 3160 | + continue;  | 
                                                        |
| 3161 | + }  | 
                                                        |
| 3162 | + $new_options[] = $option;  | 
                                                        |
| 3163 | + }  | 
                                                        |
| 3164 | 3164 | |
| 3165 | - $options = $new_options;  | 
                                                        |
| 3166 | - }  | 
                                                        |
| 3165 | + $options = $new_options;  | 
                                                        |
| 3166 | + }  | 
                                                        |
| 3167 | 3167 | |
| 3168 | - return $options;  | 
                                                        |
| 3168 | + return $options;  | 
                                                        |
| 3169 | 3169 | }  | 
                                                        
| 3170 | 3170 | |
| 3171 | 3171 |  add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
 | 
                                                        
@@ -3179,11 +3179,11 @@ discard block  | 
                                                    ||
| 3179 | 3179 | */  | 
                                                        
| 3180 | 3180 | function geodir_all_js_msg_no_rating($msg = array())  | 
                                                        
| 3181 | 3181 |  {
 | 
                                                        
| 3182 | -    if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3183 | - $msg['gd_cmt_no_rating'] = true;  | 
                                                        |
| 3184 | - }  | 
                                                        |
| 3182 | +	if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3183 | + $msg['gd_cmt_no_rating'] = true;  | 
                                                        |
| 3184 | + }  | 
                                                        |
| 3185 | 3185 | |
| 3186 | - return $msg;  | 
                                                        |
| 3186 | + return $msg;  | 
                                                        |
| 3187 | 3187 | }  | 
                                                        
| 3188 | 3188 | |
| 3189 | 3189 |  add_filter('body_class', 'geodir_body_class_no_rating', 100);
 | 
                                                        
@@ -3197,13 +3197,13 @@ discard block  | 
                                                    ||
| 3197 | 3197 | */  | 
                                                        
| 3198 | 3198 | function geodir_body_class_no_rating($classes = array())  | 
                                                        
| 3199 | 3199 |  {
 | 
                                                        
| 3200 | -    if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3201 | - $classes[] = 'gd-no-rating';  | 
                                                        |
| 3202 | - }  | 
                                                        |
| 3200 | +	if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3201 | + $classes[] = 'gd-no-rating';  | 
                                                        |
| 3202 | + }  | 
                                                        |
| 3203 | 3203 | |
| 3204 | - $classes[] = 'gd-map-' . geodir_map_name();  | 
                                                        |
| 3204 | + $classes[] = 'gd-map-' . geodir_map_name();  | 
                                                        |
| 3205 | 3205 | |
| 3206 | - return $classes;  | 
                                                        |
| 3206 | + return $classes;  | 
                                                        |
| 3207 | 3207 | }  | 
                                                        
| 3208 | 3208 | |
| 3209 | 3209 |  add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
 | 
                                                        
@@ -3217,13 +3217,13 @@ discard block  | 
                                                    ||
| 3217 | 3217 | */  | 
                                                        
| 3218 | 3218 | function geodir_admin_body_class_no_rating($class = '')  | 
                                                        
| 3219 | 3219 |  {
 | 
                                                        
| 3220 | -    if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3221 | - $class .= ' gd-no-rating';  | 
                                                        |
| 3222 | - }  | 
                                                        |
| 3220 | +	if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3221 | + $class .= ' gd-no-rating';  | 
                                                        |
| 3222 | + }  | 
                                                        |
| 3223 | 3223 | |
| 3224 | - $class .= ' gd-map-' . geodir_map_name();  | 
                                                        |
| 3224 | + $class .= ' gd-map-' . geodir_map_name();  | 
                                                        |
| 3225 | 3225 | |
| 3226 | - return $class;  | 
                                                        |
| 3226 | + return $class;  | 
                                                        |
| 3227 | 3227 | }  | 
                                                        
| 3228 | 3228 | |
| 3229 | 3229 |  add_action('wp_head', 'geodir_wp_head_no_rating');
 | 
                                                        
@@ -3236,10 +3236,10 @@ discard block  | 
                                                    ||
| 3236 | 3236 | */  | 
                                                        
| 3237 | 3237 | function geodir_wp_head_no_rating()  | 
                                                        
| 3238 | 3238 |  {
 | 
                                                        
| 3239 | -    if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3240 | -        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
 | 
                                                        |
| 3241 | -        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
 | 
                                                        |
| 3242 | - }  | 
                                                        |
| 3239 | +	if (get_option('geodir_disable_rating')) {
 | 
                                                        |
| 3240 | +		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
 | 
                                                        |
| 3241 | +		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
 | 
                                                        |
| 3242 | + }  | 
                                                        |
| 3243 | 3243 | }  | 
                                                        
| 3244 | 3244 | |
| 3245 | 3245 |  add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
 | 
                                                        
@@ -3256,36 +3256,36 @@ discard block  | 
                                                    ||
| 3256 | 3256 | * @return array Translation texts.  | 
                                                        
| 3257 | 3257 | */  | 
                                                        
| 3258 | 3258 |  function geodir_load_gd_options_text_translation($translation_texts = array()) {
 | 
                                                        
| 3259 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();  | 
                                                        |
| 3260 | -  | 
                                                        |
| 3261 | -    $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');
 | 
                                                        |
| 3262 | -  | 
                                                        |
| 3263 | - /**  | 
                                                        |
| 3264 | - * Filters the geodirectory option names that requires to add for translation.  | 
                                                        |
| 3265 | - *  | 
                                                        |
| 3266 | - * @since 1.5.7  | 
                                                        |
| 3267 | - * @package GeoDirectory  | 
                                                        |
| 3268 | - *  | 
                                                        |
| 3269 | - * @param array $gd_options Array of option names.  | 
                                                        |
| 3270 | - */  | 
                                                        |
| 3271 | -    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
 | 
                                                        |
| 3272 | - $gd_options = array_unique($gd_options);  | 
                                                        |
| 3273 | -  | 
                                                        |
| 3274 | -    if (!empty($gd_options)) {
 | 
                                                        |
| 3275 | -        foreach ($gd_options as $gd_option) {
 | 
                                                        |
| 3276 | -            if ($gd_option != '' && $option_value = get_option($gd_option)) {
 | 
                                                        |
| 3277 | - $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';  | 
                                                        |
| 3259 | + $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();  | 
                                                        |
| 3260 | +  | 
                                                        |
| 3261 | +	$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');
 | 
                                                        |
| 3262 | +  | 
                                                        |
| 3263 | + /**  | 
                                                        |
| 3264 | + * Filters the geodirectory option names that requires to add for translation.  | 
                                                        |
| 3265 | + *  | 
                                                        |
| 3266 | + * @since 1.5.7  | 
                                                        |
| 3267 | + * @package GeoDirectory  | 
                                                        |
| 3268 | + *  | 
                                                        |
| 3269 | + * @param array $gd_options Array of option names.  | 
                                                        |
| 3270 | + */  | 
                                                        |
| 3271 | +	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
 | 
                                                        |
| 3272 | + $gd_options = array_unique($gd_options);  | 
                                                        |
| 3273 | +  | 
                                                        |
| 3274 | +	if (!empty($gd_options)) {
 | 
                                                        |
| 3275 | +		foreach ($gd_options as $gd_option) {
 | 
                                                        |
| 3276 | +			if ($gd_option != '' && $option_value = get_option($gd_option)) {
 | 
                                                        |
| 3277 | + $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';  | 
                                                        |
| 3278 | 3278 | |
| 3279 | -                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
 | 
                                                        |
| 3280 | - $translation_texts[] = stripslashes_deep($option_value);  | 
                                                        |
| 3281 | - }  | 
                                                        |
| 3282 | - }  | 
                                                        |
| 3283 | - }  | 
                                                        |
| 3284 | - }  | 
                                                        |
| 3279 | +				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
 | 
                                                        |
| 3280 | + $translation_texts[] = stripslashes_deep($option_value);  | 
                                                        |
| 3281 | + }  | 
                                                        |
| 3282 | + }  | 
                                                        |
| 3283 | + }  | 
                                                        |
| 3284 | + }  | 
                                                        |
| 3285 | 3285 | |
| 3286 | - $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;  | 
                                                        |
| 3286 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;  | 
                                                        |
| 3287 | 3287 | |
| 3288 | - return $translation_texts;  | 
                                                        |
| 3288 | + return $translation_texts;  | 
                                                        |
| 3289 | 3289 | }  | 
                                                        
| 3290 | 3290 | |
| 3291 | 3291 |  add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
 | 
                                                        
@@ -3299,15 +3299,15 @@ discard block  | 
                                                    ||
| 3299 | 3299 | |
| 3300 | 3300 |  add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
 | 
                                                        
| 3301 | 3301 |  function gd_get_comments_link($comments_link, $post_id) {
 | 
                                                        
| 3302 | - $post_type = get_post_type($post_id);  | 
                                                        |
| 3302 | + $post_type = get_post_type($post_id);  | 
                                                        |
| 3303 | 3303 | |
| 3304 | - $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 3305 | -    if (in_array($post_type, $all_postypes)) {
 | 
                                                        |
| 3306 | -        $comments_link = str_replace('#comments', '#reviews', $comments_link);
 | 
                                                        |
| 3307 | -        $comments_link = str_replace('#respond', '#reviews', $comments_link);
 | 
                                                        |
| 3308 | - }  | 
                                                        |
| 3304 | + $all_postypes = geodir_get_posttypes();  | 
                                                        |
| 3305 | +	if (in_array($post_type, $all_postypes)) {
 | 
                                                        |
| 3306 | +		$comments_link = str_replace('#comments', '#reviews', $comments_link);
 | 
                                                        |
| 3307 | +		$comments_link = str_replace('#respond', '#reviews', $comments_link);
 | 
                                                        |
| 3308 | + }  | 
                                                        |
| 3309 | 3309 | |
| 3310 | - return $comments_link;  | 
                                                        |
| 3310 | + return $comments_link;  | 
                                                        |
| 3311 | 3311 | }  | 
                                                        
| 3312 | 3312 | |
| 3313 | 3313 | |
@@ -3325,11 +3325,11 @@ discard block  | 
                                                    ||
| 3325 | 3325 | function geodir_add_nav_menu_class( $args )  | 
                                                        
| 3326 | 3326 |  {
 | 
                                                        
| 3327 | 3327 | |
| 3328 | -        if(isset($args['menu_class'])){
 | 
                                                        |
| 3329 | - $args['menu_class'] = $args['menu_class']." gd-menu-z";  | 
                                                        |
| 3330 | - }  | 
                                                        |
| 3328 | +		if(isset($args['menu_class'])){
 | 
                                                        |
| 3329 | + $args['menu_class'] = $args['menu_class']." gd-menu-z";  | 
                                                        |
| 3330 | + }  | 
                                                        |
| 3331 | 3331 | |
| 3332 | - return $args;  | 
                                                        |
| 3332 | + return $args;  | 
                                                        |
| 3333 | 3333 | }  | 
                                                        
| 3334 | 3334 | |
| 3335 | 3335 | add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );  | 
                                                        
| 3336 | 3336 | \ No newline at end of file  | 
                                                        
@@ -136,7 +136,7 @@ discard block  | 
                                                    ||
| 136 | 136 | /* ON TEMPLATE INCLUDE */  | 
                                                        
| 137 | 137 | /////////////////////////  | 
                                                        
| 138 | 138 | |
| 139 | -add_filter('template_include', 'geodir_template_loader',9);
 | 
                                                        |
| 139 | +add_filter('template_include', 'geodir_template_loader', 9);
 | 
                                                        |
| 140 | 140 | |
| 141 | 141 | /////////////////////////  | 
                                                        
| 142 | 142 | /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */  | 
                                                        
@@ -176,9 +176,9 @@ discard block  | 
                                                    ||
| 176 | 176 | /* WP REVIEW COUNT ACTIONS */  | 
                                                        
| 177 | 177 | ////////////////////////  | 
                                                        
| 178 | 178 | |
| 179 | -add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1);
 | 
                                                        |
| 179 | +add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1);
 | 
                                                        |
| 180 | 180 |  //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
 | 
                                                        
| 181 | -add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
 | 
                                                        |
| 181 | +add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
 | 
                                                        |
| 182 | 182 |  //add_action('created_term', 'geodir_term_review_count_force_update', 100);
 | 
                                                        
| 183 | 183 |  add_action('edited_term', 'geodir_term_review_count_force_update', 100);
 | 
                                                        
| 184 | 184 |  add_action('delete_term', 'geodir_term_review_count_force_update', 100);
 | 
                                                        
@@ -222,7 +222,7 @@ discard block  | 
                                                    ||
| 222 | 222 | */  | 
                                                        
| 223 | 223 | function geodir_unset_prev_theme_nav_location($newname)  | 
                                                        
| 224 | 224 |  {
 | 
                                                        
| 225 | -    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
 | 
                                                        |
| 225 | +    $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname);
 | 
                                                        |
| 226 | 226 |      if ($geodir_theme_location) {
 | 
                                                        
| 227 | 227 |          update_option('geodir_theme_location_nav', $geodir_theme_location);
 | 
                                                        
| 228 | 228 |      } else {
 | 
                                                        
@@ -320,8 +320,8 @@ discard block  | 
                                                    ||
| 320 | 320 | |
| 321 | 321 | /////// GEO DIRECOTORY CUSTOM HOOKS ///  | 
                                                        
| 322 | 322 | |
| 323 | -add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
 | 
                                                        |
| 324 | -add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
 | 
                                                        |
| 323 | +add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
 | 
                                                        |
| 324 | +add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
 | 
                                                        |
| 325 | 325 | |
| 326 | 326 | // Detail page sidebar content  | 
                                                        
| 327 | 327 |  add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
 | 
                                                        
@@ -422,8 +422,8 @@ discard block  | 
                                                    ||
| 422 | 422 |      do_action('geodir_after_social_sharing_buttons');
 | 
                                                        
| 423 | 423 | $content_html = ob_get_clean();  | 
                                                        
| 424 | 424 | if (trim($content_html) != '')  | 
                                                        
| 425 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';  | 
                                                        |
| 426 | -    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
 | 
                                                        |
| 425 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>';  | 
                                                        |
| 426 | +    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
 | 
                                                        |
| 427 | 427 | /**  | 
                                                        
| 428 | 428 | * Filter the geodir_social_sharing_buttons() function content.  | 
                                                        
| 429 | 429 | *  | 
                                                        
@@ -469,8 +469,8 @@ discard block  | 
                                                    ||
| 469 | 469 |      do_action('geodir_after_share_this_button');
 | 
                                                        
| 470 | 470 | $content_html = ob_get_clean();  | 
                                                        
| 471 | 471 | if (trim($content_html) != '')  | 
                                                        
| 472 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';  | 
                                                        |
| 473 | -    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
 | 
                                                        |
| 472 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">'.$content_html.'</div>';  | 
                                                        |
| 473 | +    if ((int) get_option('geodir_disable_sharethis_button_section') != 1) {
 | 
                                                        |
| 474 | 474 | /**  | 
                                                        
| 475 | 475 | * Filter the geodir_share_this_button() function content.  | 
                                                        
| 476 | 476 | *  | 
                                                        
@@ -509,12 +509,12 @@ discard block  | 
                                                    ||
| 509 | 509 | $post_id = $post->ID;  | 
                                                        
| 510 | 510 | |
| 511 | 511 |              if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
 | 
                                                        
| 512 | - $post_id = (int)$_REQUEST['pid'];  | 
                                                        |
| 512 | + $post_id = (int) $_REQUEST['pid'];  | 
                                                        |
| 513 | 513 | }  | 
                                                        
| 514 | 514 | |
| 515 | 515 | $postlink = get_permalink(geodir_add_listing_page_id());  | 
                                                        
| 516 | 516 |              $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
 | 
                                                        
| 517 | -            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
 | 
                                                        |
| 517 | +            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>';
 | 
                                                        |
| 518 | 518 | }  | 
                                                        
| 519 | 519 | }// end of if, if its a preview or not  | 
                                                        
| 520 | 520 | /**  | 
                                                        
@@ -525,8 +525,8 @@ discard block  | 
                                                    ||
| 525 | 525 |      do_action('geodir_after_edit_post_link');
 | 
                                                        
| 526 | 526 | $content_html = ob_get_clean();  | 
                                                        
| 527 | 527 | if (trim($content_html) != '')  | 
                                                        
| 528 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';  | 
                                                        |
| 529 | -    if ((int)get_option('geodir_disable_user_links_section') != 1) {
 | 
                                                        |
| 528 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>';  | 
                                                        |
| 529 | +    if ((int) get_option('geodir_disable_user_links_section') != 1) {
 | 
                                                        |
| 530 | 530 | /**  | 
                                                        
| 531 | 531 | * Filter the geodir_edit_post_link() function content.  | 
                                                        
| 532 | 532 | *  | 
                                                        
@@ -579,14 +579,14 @@ discard block  | 
                                                    ||
| 579 | 579 |      $hide_refresh = get_option('geodir_ga_auto_refresh');
 | 
                                                        
| 580 | 580 | |
| 581 | 581 | $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;  | 
                                                        
| 582 | -    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' )) ) {
 | 
                                                        |
| 582 | +    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'))) {
 | 
                                                        |
| 583 | 583 | $page_url = urlencode($_SERVER['REQUEST_URI']);  | 
                                                        
| 584 | 584 | ?>  | 
                                                        
| 585 | 585 | <script type="text/javascript">  | 
                                                        
| 586 | 586 | var gd_gaTimeOut;  | 
                                                        
| 587 | -            var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
 | 
                                                        |
| 588 | - var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>;  | 
                                                        |
| 589 | - var gd_gaAutoRefresh = <?php echo $auto_refresh;?>;  | 
                                                        |
| 587 | +            var gd_gaTime = parseInt('<?php echo $refresh_time; ?>');
 | 
                                                        |
| 588 | + var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>;  | 
                                                        |
| 589 | + var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>;  | 
                                                        |
| 590 | 590 | ga_data1 = false;  | 
                                                        
| 591 | 591 | ga_data2 = false;  | 
                                                        
| 592 | 592 | ga_data3 = false;  | 
                                                        
@@ -727,7 +727,7 @@ discard block  | 
                                                    ||
| 727 | 727 | }  | 
                                                        
| 728 | 728 | |
| 729 | 729 |              function gdga_noResults() {
 | 
                                                        
| 730 | -                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
 | 
                                                        |
| 730 | +                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
 | 
                                                        |
| 731 | 731 |                  jQuery('#gdga-legend-container').html('');
 | 
                                                        
| 732 | 732 | }  | 
                                                        
| 733 | 733 | |
@@ -759,18 +759,18 @@ discard block  | 
                                                    ||
| 759 | 759 |                      var data2 = results[1].rows.map(function(row) { return +row[2]; });
 | 
                                                        
| 760 | 760 |                      //var labelsN = results[0].rows.map(function(row) { return +row[1]; });
 | 
                                                        
| 761 | 761 | |
| 762 | -                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
 | 
                                                        |
| 763 | -                        '<?php _e('Feb', 'geodirectory');?>',
 | 
                                                        |
| 764 | -                        '<?php _e('Mar', 'geodirectory');?>',
 | 
                                                        |
| 765 | -                        '<?php _e('Apr', 'geodirectory');?>',
 | 
                                                        |
| 766 | -                        '<?php _e('May', 'geodirectory');?>',
 | 
                                                        |
| 767 | -                        '<?php _e('Jun', 'geodirectory');?>',
 | 
                                                        |
| 768 | -                        '<?php _e('Jul', 'geodirectory');?>',
 | 
                                                        |
| 769 | -                        '<?php _e('Aug', 'geodirectory');?>',
 | 
                                                        |
| 770 | -                        '<?php _e('Sep', 'geodirectory');?>',
 | 
                                                        |
| 771 | -                        '<?php _e('Oct', 'geodirectory');?>',
 | 
                                                        |
| 772 | -                        '<?php _e('Nov', 'geodirectory');?>',
 | 
                                                        |
| 773 | -                        '<?php _e('Dec', 'geodirectory');?>'];
 | 
                                                        |
| 762 | +                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
 | 
                                                        |
| 763 | +                        '<?php _e('Feb', 'geodirectory'); ?>',
 | 
                                                        |
| 764 | +                        '<?php _e('Mar', 'geodirectory'); ?>',
 | 
                                                        |
| 765 | +                        '<?php _e('Apr', 'geodirectory'); ?>',
 | 
                                                        |
| 766 | +                        '<?php _e('May', 'geodirectory'); ?>',
 | 
                                                        |
| 767 | +                        '<?php _e('Jun', 'geodirectory'); ?>',
 | 
                                                        |
| 768 | +                        '<?php _e('Jul', 'geodirectory'); ?>',
 | 
                                                        |
| 769 | +                        '<?php _e('Aug', 'geodirectory'); ?>',
 | 
                                                        |
| 770 | +                        '<?php _e('Sep', 'geodirectory'); ?>',
 | 
                                                        |
| 771 | +                        '<?php _e('Oct', 'geodirectory'); ?>',
 | 
                                                        |
| 772 | +                        '<?php _e('Nov', 'geodirectory'); ?>',
 | 
                                                        |
| 773 | +                        '<?php _e('Dec', 'geodirectory'); ?>'];
 | 
                                                        |
| 774 | 774 | |
| 775 | 775 | // Ensure the data arrays are at least as long as the labels array.  | 
                                                        
| 776 | 776 | // Chart.js bar charts don't (yet) accept sparse datasets.  | 
                                                        
@@ -783,13 +783,13 @@ discard block  | 
                                                    ||
| 783 | 783 | labels : labels,  | 
                                                        
| 784 | 784 | datasets : [  | 
                                                        
| 785 | 785 |                              {
 | 
                                                        
| 786 | -                                label: '<?php _e('Last Year', 'geodirectory');?>',
 | 
                                                        |
| 786 | +                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
 | 
                                                        |
| 787 | 787 | fillColor : "rgba(220,220,220,0.5)",  | 
                                                        
| 788 | 788 | strokeColor : "rgba(220,220,220,1)",  | 
                                                        
| 789 | 789 | data : data2  | 
                                                        
| 790 | 790 | },  | 
                                                        
| 791 | 791 |                              {
 | 
                                                        
| 792 | -                                label: '<?php _e('This Year', 'geodirectory');?>',
 | 
                                                        |
| 792 | +                                label: '<?php _e('This Year', 'geodirectory'); ?>',
 | 
                                                        |
| 793 | 793 | fillColor : "rgba(151,187,205,0.5)",  | 
                                                        
| 794 | 794 | strokeColor : "rgba(151,187,205,1)",  | 
                                                        
| 795 | 795 | data : data1  | 
                                                        
@@ -834,30 +834,30 @@ discard block  | 
                                                    ||
| 834 | 834 | |
| 835 | 835 | <?php  | 
                                                        
| 836 | 836 | // Here we list the shorthand days of the week so it can be used in translation.  | 
                                                        
| 837 | -                    __("Mon",'geodirectory');
 | 
                                                        |
| 838 | -                    __("Tue",'geodirectory');
 | 
                                                        |
| 839 | -                    __("Wed",'geodirectory');
 | 
                                                        |
| 840 | -                    __("Thu",'geodirectory');
 | 
                                                        |
| 841 | -                    __("Fri",'geodirectory');
 | 
                                                        |
| 842 | -                    __("Sat",'geodirectory');
 | 
                                                        |
| 843 | -                    __("Sun",'geodirectory');
 | 
                                                        |
| 837 | +                    __("Mon", 'geodirectory');
 | 
                                                        |
| 838 | +                    __("Tue", 'geodirectory');
 | 
                                                        |
| 839 | +                    __("Wed", 'geodirectory');
 | 
                                                        |
| 840 | +                    __("Thu", 'geodirectory');
 | 
                                                        |
| 841 | +                    __("Fri", 'geodirectory');
 | 
                                                        |
| 842 | +                    __("Sat", 'geodirectory');
 | 
                                                        |
| 843 | +                    __("Sun", 'geodirectory');
 | 
                                                        |
| 844 | 844 | ?>  | 
                                                        
| 845 | 845 | |
| 846 | 846 | labels = [  | 
                                                        
| 847 | -                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
 | 
                                                        |
| 848 | -                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
 | 
                                                        |
| 849 | -                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
 | 
                                                        |
| 850 | -                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
 | 
                                                        |
| 851 | -                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
 | 
                                                        |
| 852 | -                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
 | 
                                                        |
| 853 | -                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
 | 
                                                        |
| 847 | +                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
 | 
                                                        |
| 848 | +                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
 | 
                                                        |
| 849 | +                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
 | 
                                                        |
| 850 | +                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
 | 
                                                        |
| 851 | +                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
 | 
                                                        |
| 852 | +                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
 | 
                                                        |
| 853 | +                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
 | 
                                                        |
| 854 | 854 | ];  | 
                                                        
| 855 | 855 | |
| 856 | 856 |                      var data = {
 | 
                                                        
| 857 | 857 | labels : labels,  | 
                                                        
| 858 | 858 | datasets : [  | 
                                                        
| 859 | 859 |                              {
 | 
                                                        
| 860 | -                                label: '<?php _e('Last Week', 'geodirectory');?>',
 | 
                                                        |
| 860 | +                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
 | 
                                                        |
| 861 | 861 | fillColor : "rgba(220,220,220,0.5)",  | 
                                                        
| 862 | 862 | strokeColor : "rgba(220,220,220,1)",  | 
                                                        
| 863 | 863 | pointColor : "rgba(220,220,220,1)",  | 
                                                        
@@ -865,7 +865,7 @@ discard block  | 
                                                    ||
| 865 | 865 | data : data2  | 
                                                        
| 866 | 866 | },  | 
                                                        
| 867 | 867 |                              {
 | 
                                                        
| 868 | -                                label: '<?php _e('This Week', 'geodirectory');?>',
 | 
                                                        |
| 868 | +                                label: '<?php _e('This Week', 'geodirectory'); ?>',
 | 
                                                        |
| 869 | 869 | fillColor : "rgba(151,187,205,0.5)",  | 
                                                        
| 870 | 870 | strokeColor : "rgba(151,187,205,1)",  | 
                                                        
| 871 | 871 | pointColor : "rgba(151,187,205,1)",  | 
                                                        
@@ -1072,18 +1072,18 @@ discard block  | 
                                                    ||
| 1072 | 1072 | </style>  | 
                                                        
| 1073 | 1073 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>  | 
                                                        
| 1074 | 1074 | <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>  | 
                                                        
| 1075 | -        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button>
 | 
                                                        |
| 1075 | +        <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button>
 | 
                                                        |
| 1076 | 1076 | <span id="ga_stats" class="gdga-analytics-box" style="display:none">  | 
                                                        
| 1077 | -            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
 | 
                                                        |
| 1077 | +            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
 | 
                                                        |
| 1078 | 1078 | <div id="gd-active-users-container">  | 
                                                        
| 1079 | -                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?>
 | 
                                                        |
| 1079 | +                <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?>
 | 
                                                        |
| 1080 | 1080 | <b class="gd-ActiveUsers-value">0</b>  | 
                                                        
| 1081 | 1081 | </div>  | 
                                                        
| 1082 | 1082 | </div>  | 
                                                        
| 1083 | 1083 | <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">  | 
                                                        
| 1084 | -                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
 | 
                                                        |
| 1085 | -                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
 | 
                                                        |
| 1086 | -                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
 | 
                                                        |
| 1084 | +                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
 | 
                                                        |
| 1085 | +                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
 | 
                                                        |
| 1086 | +                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
 | 
                                                        |
| 1087 | 1087 | </select>  | 
                                                        
| 1088 | 1088 | <div class="Chartjs-figure" id="gdga-chart-container"></div>  | 
                                                        
| 1089 | 1089 | <ol class="Chartjs-legend" id="gdga-legend-container"></ol>  | 
                                                        
@@ -1099,8 +1099,8 @@ discard block  | 
                                                    ||
| 1099 | 1099 |      do_action('geodir_after_google_analytics');
 | 
                                                        
| 1100 | 1100 | $content_html = ob_get_clean();  | 
                                                        
| 1101 | 1101 | if (trim($content_html) != '')  | 
                                                        
| 1102 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';  | 
                                                        |
| 1103 | -    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
 | 
                                                        |
| 1102 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>';  | 
                                                        |
| 1103 | +    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
 | 
                                                        |
| 1104 | 1104 | /**  | 
                                                        
| 1105 | 1105 | * Filter the geodir_edit_post_link() function content.  | 
                                                        
| 1106 | 1106 | *  | 
                                                        
@@ -1156,10 +1156,10 @@ discard block  | 
                                                    ||
| 1156 | 1156 | |
| 1157 | 1157 |  	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
 | 
                                                        
| 1158 | 1158 | |
| 1159 | -	   $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 />';
 | 
                                                        |
| 1159 | +	   $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 />';
 | 
                                                        |
| 1160 | 1160 | |
| 1161 | 1161 | $html .= '<span class="item">';  | 
                                                        
| 1162 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';  | 
                                                        |
| 1162 | + $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>';  | 
                                                        |
| 1163 | 1163 | |
| 1164 | 1164 |          if ($post_images) {
 | 
                                                        
| 1165 | 1165 |              foreach ($post_images as $img) {
 | 
                                                        
@@ -1169,7 +1169,7 @@ discard block  | 
                                                    ||
| 1169 | 1169 | }  | 
                                                        
| 1170 | 1170 | |
| 1171 | 1171 |          if (isset($post_img) && $post_img) {
 | 
                                                        
| 1172 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';  | 
                                                        |
| 1172 | + $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />';  | 
                                                        |
| 1173 | 1173 | }  | 
                                                        
| 1174 | 1174 | |
| 1175 | 1175 | $html .= '</span>';  | 
                                                        
@@ -1196,9 +1196,9 @@ discard block  | 
                                                    ||
| 1196 | 1196 |      do_action('geodir_after_detail_page_review_rating');
 | 
                                                        
| 1197 | 1197 | $content_html = ob_get_clean();  | 
                                                        
| 1198 | 1198 |      if (trim($content_html) != '') {
 | 
                                                        
| 1199 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';  | 
                                                        |
| 1199 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>';  | 
                                                        |
| 1200 | 1200 | }  | 
                                                        
| 1201 | -    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
 | 
                                                        |
| 1201 | +    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
 | 
                                                        |
| 1202 | 1202 | /**  | 
                                                        
| 1203 | 1203 | * Filter the geodir_detail_page_review_rating() function content.  | 
                                                        
| 1204 | 1204 | *  | 
                                                        
@@ -1237,8 +1237,8 @@ discard block  | 
                                                    ||
| 1237 | 1237 | |
| 1238 | 1238 | $content_html = ob_get_clean();  | 
                                                        
| 1239 | 1239 | if (trim($content_html) != '')  | 
                                                        
| 1240 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';  | 
                                                        |
| 1241 | -    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
 | 
                                                        |
| 1240 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>';  | 
                                                        |
| 1241 | +    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
 | 
                                                        |
| 1242 | 1242 | /**  | 
                                                        
| 1243 | 1243 | * Filter the output html for function geodir_detail_page_more_info().  | 
                                                        
| 1244 | 1244 | *  | 
                                                        
@@ -1336,7 +1336,7 @@ discard block  | 
                                                    ||
| 1336 | 1336 |  		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
 | 
                                                        
| 1337 | 1337 |  		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
 | 
                                                        
| 1338 | 1338 |  		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
 | 
                                                        
| 1339 | -		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
 | 
                                                        |
| 1339 | +		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
 | 
                                                        |
| 1340 | 1340 |  		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
 | 
                                                        
| 1341 | 1341 | 'geodir_map_name' => geodir_map_name(),  | 
                                                        
| 1342 | 1342 | );  | 
                                                        
@@ -1354,10 +1354,10 @@ discard block  | 
                                                    ||
| 1354 | 1354 |      foreach ($arr_alert_msg as $key => $value) {
 | 
                                                        
| 1355 | 1355 | if (!is_scalar($value))  | 
                                                        
| 1356 | 1356 | continue;  | 
                                                        
| 1357 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');  | 
                                                        |
| 1357 | + $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');  | 
                                                        |
| 1358 | 1358 | }  | 
                                                        
| 1359 | 1359 | |
| 1360 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';  | 
                                                        |
| 1360 | + $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';';  | 
                                                        |
| 1361 | 1361 | echo '<script>';  | 
                                                        
| 1362 | 1362 | echo $script;  | 
                                                        
| 1363 | 1363 | echo '</script>';  | 
                                                        
@@ -1445,7 +1445,7 @@ discard block  | 
                                                    ||
| 1445 | 1445 |          $geodir_old_sidebars = get_option('geodir_sidebars');
 | 
                                                        
| 1446 | 1446 |          if (is_array($geodir_old_sidebars)) {
 | 
                                                        
| 1447 | 1447 |              foreach ($geodir_old_sidebars as $key => $val) {
 | 
                                                        
| 1448 | - if(0 === strpos($key, 'geodir_'))// if gd widget  | 
                                                        |
| 1448 | + if (0 === strpos($key, 'geodir_'))// if gd widget  | 
                                                        |
| 1449 | 1449 |                  {
 | 
                                                        
| 1450 | 1450 | $sidebars_widgets[$key] = $geodir_old_sidebars[$key];  | 
                                                        
| 1451 | 1451 | }  | 
                                                        
@@ -1524,7 +1524,7 @@ discard block  | 
                                                    ||
| 1524 | 1524 | global $post;  | 
                                                        
| 1525 | 1525 | $term_condition = '';  | 
                                                        
| 1526 | 1526 |          if (isset($_REQUEST['backandedit'])) {
 | 
                                                        
| 1527 | -            $post = (object)$gd_session->get('listing');
 | 
                                                        |
| 1527 | +            $post = (object) $gd_session->get('listing');
 | 
                                                        |
| 1528 | 1528 | $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';  | 
                                                        
| 1529 | 1529 | }  | 
                                                        
| 1530 | 1530 | |
@@ -1538,7 +1538,7 @@ discard block  | 
                                                    ||
| 1538 | 1538 | echo 'checked="checked"';  | 
                                                        
| 1539 | 1539 | } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"  | 
                                                        
| 1540 | 1540 | class="geodir_textfield" value="1"  | 
                                                        
| 1541 | -                       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>
 | 
                                                        |
| 1541 | +                       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>
 | 
                                                        |
| 1542 | 1542 | </span>  | 
                                                        
| 1543 | 1543 | </div>  | 
                                                        
| 1544 | 1544 |              <span class="geodir_message_error"><?php if (isset($required_msg)) {
 | 
                                                        
@@ -1578,7 +1578,7 @@ discard block  | 
                                                    ||
| 1578 | 1578 | /** This action is documented in geodirectory_template_actions.php */  | 
                                                        
| 1579 | 1579 |          $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
 | 
                                                        
| 1580 | 1580 | |
| 1581 | -        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
 | 
                                                        |
| 1581 | +        if (!($desc_limit === '' || (int) $desc_limit > 0)) {
 | 
                                                        |
| 1582 | 1582 | $is_display = false;  | 
                                                        
| 1583 | 1583 | }  | 
                                                        
| 1584 | 1584 | }  | 
                                                        
@@ -1626,16 +1626,16 @@ discard block  | 
                                                    ||
| 1626 | 1626 | global $wpdb, $plugin_prefix;  | 
                                                        
| 1627 | 1627 | |
| 1628 | 1628 | // Remove unused virtual page  | 
                                                        
| 1629 | -	$listings_page_id = (int)get_option('geodir_listing_page');
 | 
                                                        |
| 1629 | +	$listings_page_id = (int) get_option('geodir_listing_page');
 | 
                                                        |
| 1630 | 1630 |  	if ($listings_page_id) {
 | 
                                                        
| 1631 | -		$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')));
 | 
                                                        |
| 1631 | +		$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')));
 | 
                                                        |
| 1632 | 1632 |          delete_option('geodir_listing_page');
 | 
                                                        
| 1633 | 1633 | }  | 
                                                        
| 1634 | 1634 | |
| 1635 | 1635 |      if (!get_option('geodir_changes_in_custom_fields_table')) {
 | 
                                                        
| 1636 | 1636 | $wpdb->query(  | 
                                                        
| 1637 | 1637 | $wpdb->prepare(  | 
                                                        
| 1638 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",  | 
                                                        |
| 1638 | + "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s",  | 
                                                        |
| 1639 | 1639 |                  array('1', '1', 'admin')
 | 
                                                        
| 1640 | 1640 | )  | 
                                                        
| 1641 | 1641 | );  | 
                                                        
@@ -1643,9 +1643,9 @@ discard block  | 
                                                    ||
| 1643 | 1643 | |
| 1644 | 1644 | /* --- terms meta value set --- */  | 
                                                        
| 1645 | 1645 | |
| 1646 | -        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
 | 
                                                        |
| 1646 | +        update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png');
 | 
                                                        |
| 1647 | 1647 | |
| 1648 | -        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
 | 
                                                        |
| 1648 | +        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%')));
 | 
                                                        |
| 1649 | 1649 | |
| 1650 | 1650 |          if (!empty($options_data)) {
 | 
                                                        
| 1651 | 1651 | |
@@ -1653,7 +1653,7 @@ discard block  | 
                                                    ||
| 1653 | 1653 | |
| 1654 | 1654 |                  $option_val = str_replace('tax_meta_', '', $optobj->option_name);
 | 
                                                        
| 1655 | 1655 | |
| 1656 | -                $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)));
 | 
                                                        |
| 1656 | +                $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)));
 | 
                                                        |
| 1657 | 1657 | |
| 1658 | 1658 |                  if (!empty($taxonomies_data)) {
 | 
                                                        
| 1659 | 1659 | |
@@ -1662,17 +1662,17 @@ discard block  | 
                                                    ||
| 1662 | 1662 | $taxObject = get_taxonomy($taxobj->taxonomy);  | 
                                                        
| 1663 | 1663 | $post_type = $taxObject->object_type[0];  | 
                                                        
| 1664 | 1664 | |
| 1665 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;  | 
                                                        |
| 1665 | + $opt_value = 'tax_meta_'.$post_type.'_'.$option_val;  | 
                                                        |
| 1666 | 1666 | |
| 1667 | -                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
 | 
                                                        |
| 1667 | +                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val)));
 | 
                                                        |
| 1668 | 1668 | |
| 1669 | 1669 |                          if ($duplicate_data) {
 | 
                                                        
| 1670 | 1670 | |
| 1671 | -                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
 | 
                                                        |
| 1671 | +                            $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
 | 
                                                        |
| 1672 | 1672 | |
| 1673 | 1673 |                          } else {
 | 
                                                        
| 1674 | 1674 | |
| 1675 | -                            $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)));
 | 
                                                        |
| 1675 | +                            $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)));
 | 
                                                        |
| 1676 | 1676 | |
| 1677 | 1677 | }  | 
                                                        
| 1678 | 1678 | |
@@ -1706,14 +1706,14 @@ discard block  | 
                                                    ||
| 1706 | 1706 | |
| 1707 | 1707 | global $wpdb, $table_prefix;  | 
                                                        
| 1708 | 1708 | |
| 1709 | -    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
 | 
                                                        |
| 1709 | +    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug)));
 | 
                                                        |
| 1710 | 1710 | |
| 1711 | 1711 |      if ($slug_exists) {
 | 
                                                        
| 1712 | 1712 | |
| 1713 | 1713 | $suffix = 1;  | 
                                                        
| 1714 | 1714 |          do {
 | 
                                                        
| 1715 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";  | 
                                                        |
| 1716 | -            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
 | 
                                                        |
| 1715 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";  | 
                                                        |
| 1716 | +            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name)));
 | 
                                                        |
| 1717 | 1717 | $suffix++;  | 
                                                        
| 1718 | 1718 | } while ($location_slug_check && $suffix < 100);  | 
                                                        
| 1719 | 1719 | |
@@ -1767,7 +1767,7 @@ discard block  | 
                                                    ||
| 1767 | 1767 | |
| 1768 | 1768 | $suffix = 1;  | 
                                                        
| 1769 | 1769 |          do {
 | 
                                                        
| 1770 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";  | 
                                                        |
| 1770 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";  | 
                                                        |
| 1771 | 1771 | |
| 1772 | 1772 | /** This action is documented in geodirectory_hooks_actions.php */  | 
                                                        
| 1773 | 1773 |              $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
 | 
                                                        
@@ -1779,7 +1779,7 @@ discard block  | 
                                                    ||
| 1779 | 1779 | |
| 1780 | 1780 |          //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
 | 
                                                        
| 1781 | 1781 | |
| 1782 | -        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
 | 
                                                        |
| 1782 | +        $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
 | 
                                                        |
| 1783 | 1783 | |
| 1784 | 1784 | }  | 
                                                        
| 1785 | 1785 | |
@@ -1788,18 +1788,18 @@ discard block  | 
                                                    ||
| 1788 | 1788 | $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;  | 
                                                        
| 1789 | 1789 | |
| 1790 | 1790 | $post_types = geodir_get_posttypes();  | 
                                                        
| 1791 | -	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
 | 
                                                        |
| 1792 | -		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
 | 
                                                        |
| 1791 | +	if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) {		
 | 
                                                        |
| 1792 | +		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id)));
 | 
                                                        |
| 1793 | 1793 | |
| 1794 | 1794 |  		if (!empty($posts_obj)) {
 | 
                                                        
| 1795 | 1795 |  			foreach ($posts_obj as $post_obj) {
 | 
                                                        
| 1796 | 1796 | $post_id = $post_obj->object_id;  | 
                                                        
| 1797 | 1797 | |
| 1798 | -				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
 | 
                                                        |
| 1798 | +				$raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names'));
 | 
                                                        |
| 1799 | 1799 |  				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
 | 
                                                        
| 1800 | 1800 | |
| 1801 | - $listing_table = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 1802 | -				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
 | 
                                                        |
| 1801 | + $listing_table = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 1802 | +				$wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
 | 
                                                        |
| 1803 | 1803 | }  | 
                                                        
| 1804 | 1804 | }  | 
                                                        
| 1805 | 1805 | }  | 
                                                        
@@ -1833,7 +1833,7 @@ discard block  | 
                                                    ||
| 1833 | 1833 | if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)  | 
                                                        
| 1834 | 1834 | return $slug_exists = true;  | 
                                                        
| 1835 | 1835 | |
| 1836 | -    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
 | 
                                                        |
| 1836 | +    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
 | 
                                                        |
| 1837 | 1837 | return $slug_exists = true;  | 
                                                        
| 1838 | 1838 | |
| 1839 | 1839 | return $slug_exists;  | 
                                                        
@@ -1873,43 +1873,43 @@ discard block  | 
                                                    ||
| 1873 | 1873 | |
| 1874 | 1874 | |
| 1875 | 1875 | $gd_page = '';  | 
                                                        
| 1876 | -    if(geodir_is_page('home')){
 | 
                                                        |
| 1876 | +    if (geodir_is_page('home')) {
 | 
                                                        |
| 1877 | 1877 | $gd_page = 'home';  | 
                                                        
| 1878 | 1878 |          $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
 | 
                                                        
| 1879 | 1879 | }  | 
                                                        
| 1880 | -    elseif(geodir_is_page('detail')){
 | 
                                                        |
| 1880 | +    elseif (geodir_is_page('detail')) {
 | 
                                                        |
| 1881 | 1881 | $gd_page = 'detail';  | 
                                                        
| 1882 | 1882 |          $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
 | 
                                                        
| 1883 | 1883 | }  | 
                                                        
| 1884 | -    elseif(geodir_is_page('pt')){
 | 
                                                        |
| 1884 | +    elseif (geodir_is_page('pt')) {
 | 
                                                        |
| 1885 | 1885 | $gd_page = 'pt';  | 
                                                        
| 1886 | 1886 |          $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
 | 
                                                        
| 1887 | 1887 | }  | 
                                                        
| 1888 | -    elseif(geodir_is_page('listing')){
 | 
                                                        |
| 1888 | +    elseif (geodir_is_page('listing')) {
 | 
                                                        |
| 1889 | 1889 | $gd_page = 'listing';  | 
                                                        
| 1890 | 1890 |          $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
 | 
                                                        
| 1891 | 1891 | }  | 
                                                        
| 1892 | -    elseif(geodir_is_page('location')){
 | 
                                                        |
| 1892 | +    elseif (geodir_is_page('location')) {
 | 
                                                        |
| 1893 | 1893 | $gd_page = 'location';  | 
                                                        
| 1894 | 1894 |          $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
 | 
                                                        
| 1895 | 1895 | }  | 
                                                        
| 1896 | -    elseif(geodir_is_page('search')){
 | 
                                                        |
| 1896 | +    elseif (geodir_is_page('search')) {
 | 
                                                        |
| 1897 | 1897 | $gd_page = 'search';  | 
                                                        
| 1898 | 1898 |          $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
 | 
                                                        
| 1899 | 1899 | }  | 
                                                        
| 1900 | -    elseif(geodir_is_page('add-listing')){
 | 
                                                        |
| 1900 | +    elseif (geodir_is_page('add-listing')) {
 | 
                                                        |
| 1901 | 1901 | $gd_page = 'add-listing';  | 
                                                        
| 1902 | 1902 |          $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
 | 
                                                        
| 1903 | 1903 | }  | 
                                                        
| 1904 | -    elseif(geodir_is_page('author')){
 | 
                                                        |
| 1904 | +    elseif (geodir_is_page('author')) {
 | 
                                                        |
| 1905 | 1905 | $gd_page = 'author';  | 
                                                        
| 1906 | 1906 |          $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
 | 
                                                        
| 1907 | 1907 | }  | 
                                                        
| 1908 | -    elseif(geodir_is_page('login')){
 | 
                                                        |
| 1908 | +    elseif (geodir_is_page('login')) {
 | 
                                                        |
| 1909 | 1909 | $gd_page = 'login';  | 
                                                        
| 1910 | 1910 |          $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
 | 
                                                        
| 1911 | 1911 | }  | 
                                                        
| 1912 | -    elseif(geodir_is_page('listing-success')){
 | 
                                                        |
| 1912 | +    elseif (geodir_is_page('listing-success')) {
 | 
                                                        |
| 1913 | 1913 | $gd_page = 'listing-success';  | 
                                                        
| 1914 | 1914 |          $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
 | 
                                                        
| 1915 | 1915 | }  | 
                                                        
@@ -1941,12 +1941,12 @@ discard block  | 
                                                    ||
| 1941 | 1941 | |
| 1942 | 1942 |      if (!get_option('geodir_set_post_attachments')) {
 | 
                                                        
| 1943 | 1943 | |
| 1944 | - require_once(ABSPATH . 'wp-admin/includes/image.php');  | 
                                                        |
| 1945 | - require_once(ABSPATH . 'wp-admin/includes/file.php');  | 
                                                        |
| 1944 | + require_once(ABSPATH.'wp-admin/includes/image.php');  | 
                                                        |
| 1945 | + require_once(ABSPATH.'wp-admin/includes/file.php');  | 
                                                        |
| 1946 | 1946 | |
| 1947 | 1947 | $all_postypes = geodir_get_posttypes();  | 
                                                        
| 1948 | 1948 | |
| 1949 | -        foreach($all_postypes as $post_type){
 | 
                                                        |
| 1949 | +        foreach ($all_postypes as $post_type) {
 | 
                                                        |
| 1950 | 1950 | $args = array(  | 
                                                        
| 1951 | 1951 | 'posts_per_page' => -1,  | 
                                                        
| 1952 | 1952 | 'post_type' => $post_type,  | 
                                                        
@@ -2040,7 +2040,7 @@ discard block  | 
                                                    ||
| 2040 | 2040 |  {
 | 
                                                        
| 2041 | 2041 | $user_id = get_current_user_id();  | 
                                                        
| 2042 | 2042 | |
| 2043 | -    if(!$user_id){return $post;}
 | 
                                                        |
| 2043 | +    if (!$user_id) {return $post; }
 | 
                                                        |
| 2044 | 2044 | |
| 2045 | 2045 | $gd_post_types = geodir_get_posttypes();  | 
                                                        
| 2046 | 2046 | |
@@ -2149,7 +2149,7 @@ discard block  | 
                                                    ||
| 2149 | 2149 | |
| 2150 | 2150 |          if (array_key_exists('post_video', $tabs_arr)) {
 | 
                                                        
| 2151 | 2151 | |
| 2152 | -            $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)));
 | 
                                                        |
| 2152 | +            $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)));
 | 
                                                        |
| 2153 | 2153 | |
| 2154 | 2154 | if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')  | 
                                                        
| 2155 | 2155 | $tabs_arr['post_video']['heading_text'] = $field_title;  | 
                                                        
@@ -2157,7 +2157,7 @@ discard block  | 
                                                    ||
| 2157 | 2157 | |
| 2158 | 2158 |          if (array_key_exists('special_offers', $tabs_arr)) {
 | 
                                                        
| 2159 | 2159 | |
| 2160 | -            $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)));
 | 
                                                        |
| 2160 | +            $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)));
 | 
                                                        |
| 2161 | 2161 | |
| 2162 | 2162 | if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')  | 
                                                        
| 2163 | 2163 | $tabs_arr['special_offers']['heading_text'] = $field_title;  | 
                                                        
@@ -2178,7 +2178,7 @@ discard block  | 
                                                    ||
| 2178 | 2178 | */  | 
                                                        
| 2179 | 2179 | function geodir_remove_template_redirect_actions()  | 
                                                        
| 2180 | 2180 |  {
 | 
                                                        
| 2181 | -    if (geodir_is_page('login')){
 | 
                                                        |
| 2181 | +    if (geodir_is_page('login')) {
 | 
                                                        |
| 2182 | 2182 |          remove_all_actions('template_redirect');
 | 
                                                        
| 2183 | 2183 |          remove_action('init', 'avia_modify_front', 10);
 | 
                                                        
| 2184 | 2184 | }  | 
                                                        
@@ -2225,25 +2225,25 @@ discard block  | 
                                                    ||
| 2225 | 2225 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';  | 
                                                        
| 2226 | 2226 | |
| 2227 | 2227 | $wpdb->query(  | 
                                                        
| 2228 | -            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
 | 
                                                        |
| 2228 | +            $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ",
 | 
                                                        |
| 2229 | 2229 | array($post_id, $split_img_file_path)  | 
                                                        
| 2230 | 2230 | )  | 
                                                        
| 2231 | 2231 | );  | 
                                                        
| 2232 | 2232 | |
| 2233 | 2233 | $attachment_data = $wpdb->get_row(  | 
                                                        
| 2234 | -            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
 | 
                                                        |
| 2234 | +            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d",
 | 
                                                        |
| 2235 | 2235 | array($post_id)  | 
                                                        
| 2236 | 2236 | )  | 
                                                        
| 2237 | 2237 | );  | 
                                                        
| 2238 | 2238 | |
| 2239 | 2239 |          if (!empty($attachment_data)) {
 | 
                                                        
| 2240 | -            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
 | 
                                                        |
| 2240 | +            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
 | 
                                                        |
| 2241 | 2241 | }  | 
                                                        
| 2242 | 2242 | |
| 2243 | 2243 | |
| 2244 | - $table_name = $plugin_prefix . $post_type . '_detail';  | 
                                                        |
| 2244 | + $table_name = $plugin_prefix.$post_type.'_detail';  | 
                                                        |
| 2245 | 2245 | |
| 2246 | -        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2246 | +        $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id);
 | 
                                                        |
| 2247 | 2247 | |
| 2248 | 2248 | geodir_set_wp_featured_image($post_id);  | 
                                                        
| 2249 | 2249 | |
@@ -2271,9 +2271,9 @@ discard block  | 
                                                    ||
| 2271 | 2271 | |
| 2272 | 2272 |      foreach ($all_postypes as $posttype) {
 | 
                                                        
| 2273 | 2273 | |
| 2274 | - $tablename = $plugin_prefix . $posttype . '_detail';  | 
                                                        |
| 2274 | + $tablename = $plugin_prefix.$posttype.'_detail';  | 
                                                        |
| 2275 | 2275 | |
| 2276 | -        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
 | 
                                                        |
| 2276 | +        $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename);
 | 
                                                        |
| 2277 | 2277 | |
| 2278 | 2278 |          if (!empty($get_post_data)) {
 | 
                                                        
| 2279 | 2279 | |
@@ -2281,7 +2281,7 @@ discard block  | 
                                                    ||
| 2281 | 2281 | |
| 2282 | 2282 | $post_id = $data->post_id;  | 
                                                        
| 2283 | 2283 | |
| 2284 | -                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
 | 
                                                        |
| 2284 | +                $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''");
 | 
                                                        |
| 2285 | 2285 | |
| 2286 | 2286 |                  if (!empty($attachment_data)) {
 | 
                                                        
| 2287 | 2287 | |
@@ -2298,22 +2298,22 @@ discard block  | 
                                                    ||
| 2298 | 2298 | |
| 2299 | 2299 | $file_name = $file_info['basename'];  | 
                                                        
| 2300 | 2300 | |
| 2301 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;  | 
                                                        |
| 2301 | + $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name;  | 
                                                        |
| 2302 | 2302 | |
| 2303 | 2303 |                          if (!file_exists($img_arr['path'])) {
 | 
                                                        
| 2304 | 2304 | |
| 2305 | -                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
 | 
                                                        |
| 2305 | +                            $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID);
 | 
                                                        |
| 2306 | 2306 | |
| 2307 | 2307 | }  | 
                                                        
| 2308 | 2308 | |
| 2309 | 2309 | }  | 
                                                        
| 2310 | 2310 | |
| 2311 | -                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
 | 
                                                        |
| 2311 | +                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id");
 | 
                                                        |
| 2312 | 2312 | |
| 2313 | 2313 |                      if (!empty($attachment_data)) {
 | 
                                                        
| 2314 | 2314 | |
| 2315 | 2315 | if ($attachment_data->ID)  | 
                                                        
| 2316 | -                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
 | 
                                                        |
| 2316 | +                            $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID);
 | 
                                                        |
| 2317 | 2317 | |
| 2318 | 2318 |                      } else {
 | 
                                                        
| 2319 | 2319 | |
@@ -2327,7 +2327,7 @@ discard block  | 
                                                    ||
| 2327 | 2327 | |
| 2328 | 2328 | }  | 
                                                        
| 2329 | 2329 | |
| 2330 | -                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
 | 
                                                        |
| 2330 | +                    $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id);
 | 
                                                        |
| 2331 | 2331 | |
| 2332 | 2332 | geodir_set_wp_featured_image($post_id);  | 
                                                        
| 2333 | 2333 | |
@@ -2356,7 +2356,7 @@ discard block  | 
                                                    ||
| 2356 | 2356 |  {
 | 
                                                        
| 2357 | 2357 | |
| 2358 | 2358 |      if (!get_option('geodir_default_rating_star_icon')) {
 | 
                                                        
| 2359 | -        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
 | 
                                                        |
| 2359 | +        update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png');
 | 
                                                        |
| 2360 | 2360 | }  | 
                                                        
| 2361 | 2361 | |
| 2362 | 2362 | }  | 
                                                        
@@ -2373,10 +2373,10 @@ discard block  | 
                                                    ||
| 2373 | 2373 | * @global string $plugin_prefix Geodirectory plugin table prefix.  | 
                                                        
| 2374 | 2374 | * @return array User listing count for each post type.  | 
                                                        
| 2375 | 2375 | */  | 
                                                        
| 2376 | -function geodir_user_post_listing_count($user_id=null)  | 
                                                        |
| 2376 | +function geodir_user_post_listing_count($user_id = null)  | 
                                                        |
| 2377 | 2377 |  {
 | 
                                                        
| 2378 | 2378 | global $wpdb, $plugin_prefix, $current_user;  | 
                                                        
| 2379 | -    if(!$user_id){
 | 
                                                        |
| 2379 | +    if (!$user_id) {
 | 
                                                        |
| 2380 | 2380 | $user_id = $current_user->ID;  | 
                                                        
| 2381 | 2381 | }  | 
                                                        
| 2382 | 2382 | |
@@ -2387,7 +2387,7 @@ discard block  | 
                                                    ||
| 2387 | 2387 | $user_listing = array();  | 
                                                        
| 2388 | 2388 |      if (is_array($all_posts) && !empty($all_posts)) {
 | 
                                                        
| 2389 | 2389 |          foreach ($all_posts as $ptype) {
 | 
                                                        
| 2390 | -            $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' )");
 | 
                                                        |
| 2390 | +            $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' )");
 | 
                                                        |
| 2391 | 2391 | |
| 2392 | 2392 |              if ($total_posts > 0) {
 | 
                                                        
| 2393 | 2393 | $user_listing[$ptype] = $total_posts;  | 
                                                        
@@ -2490,9 +2490,9 @@ discard block  | 
                                                    ||
| 2490 | 2490 | }  | 
                                                        
| 2491 | 2491 | |
| 2492 | 2492 |                      if (strpos($type['field_icon'], 'http') !== false) {
 | 
                                                        
| 2493 | -                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
 | 
                                                        |
| 2493 | +                        $field_icon = ' background: url('.$type['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
 | 
                                                        |
| 2494 | 2494 |                      } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
 | 
                                                        
| 2495 | - $field_icon = '<i class="' . $type['field_icon'] . '"></i>';  | 
                                                        |
| 2495 | + $field_icon = '<i class="'.$type['field_icon'].'"></i>';  | 
                                                        |
| 2496 | 2496 | }  | 
                                                        
| 2497 | 2497 | |
| 2498 | 2498 |                      switch ($type['type']) {
 | 
                                                        
@@ -2500,7 +2500,7 @@ discard block  | 
                                                    ||
| 2500 | 2500 | $i = 0;  | 
                                                        
| 2501 | 2501 | $fieldset_count++;  | 
                                                        
| 2502 | 2502 | $field_set_start = 1;  | 
                                                        
| 2503 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;  | 
                                                        |
| 2503 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count;  | 
                                                        |
| 2504 | 2504 | $fieldset_arr[$fieldset_count]['label'] = $label;  | 
                                                        
| 2505 | 2505 | }  | 
                                                        
| 2506 | 2506 | break;  | 
                                                        
@@ -2533,7 +2533,7 @@ discard block  | 
                                                    ||
| 2533 | 2533 | // all search engines that use the nofollow value exclude links that use it from their ranking calculation  | 
                                                        
| 2534 | 2534 | $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';  | 
                                                        
| 2535 | 2535 | |
| 2536 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .  | 
                                                        |
| 2536 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.' <a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.  | 
                                                        |
| 2537 | 2537 | /**  | 
                                                        
| 2538 | 2538 | * Filer the custom field website name.  | 
                                                        
| 2539 | 2539 | *  | 
                                                        
@@ -2542,7 +2542,7 @@ discard block  | 
                                                    ||
| 2542 | 2542 | * @param string $website The website address.  | 
                                                        
| 2543 | 2543 | * @param int $post->ID The post ID.  | 
                                                        
| 2544 | 2544 | */  | 
                                                        
| 2545 | -                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
 | 
                                                        |
| 2545 | +                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
 | 
                                                        |
| 2546 | 2546 | }  | 
                                                        
| 2547 | 2547 | break;  | 
                                                        
| 2548 | 2548 |                          case 'phone': {
 | 
                                                        
@@ -2557,11 +2557,11 @@ discard block  | 
                                                    ||
| 2557 | 2557 | |
| 2558 | 2558 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2559 | 2559 | |
| 2560 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2560 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2561 | 2561 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2562 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2562 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2563 | 2563 | }  | 
                                                        
| 2564 | -                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2564 | +                            $html .= ' </span>'.$post->{$type['htmlvar_name']}.'</div>';
 | 
                                                        |
| 2565 | 2565 | }  | 
                                                        
| 2566 | 2566 | break;  | 
                                                        
| 2567 | 2567 |                          case 'time': {
 | 
                                                        
@@ -2580,11 +2580,11 @@ discard block  | 
                                                    ||
| 2580 | 2580 | |
| 2581 | 2581 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2582 | 2582 | |
| 2583 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2583 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2584 | 2584 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2585 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2585 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2586 | 2586 | }  | 
                                                        
| 2587 | - $html .= ' </span>' . $value . '</div>';  | 
                                                        |
| 2587 | + $html .= ' </span>'.$value.'</div>';  | 
                                                        |
| 2588 | 2588 | }  | 
                                                        
| 2589 | 2589 | break;  | 
                                                        
| 2590 | 2590 |                          case 'datepicker': {
 | 
                                                        
@@ -2596,15 +2596,15 @@ discard block  | 
                                                    ||
| 2596 | 2596 | |
| 2597 | 2597 | // check if we need to change the format or not  | 
                                                        
| 2598 | 2598 |                              $date_format_len = strlen(str_replace(' ', '', $date_format));
 | 
                                                        
| 2599 | -                            if($date_format_len>5){// if greater then 5 then it's the old style format.
 | 
                                                        |
| 2599 | +                            if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
 | 
                                                        |
| 2600 | 2600 | |
| 2601 | -                                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
 | 
                                                        |
| 2602 | -                                $replace = array('d','j','l','m','n','F','Y');//PHP date format
 | 
                                                        |
| 2601 | +                                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
 | 
                                                        |
| 2602 | +                                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
 | 
                                                        |
| 2603 | 2603 | |
| 2604 | 2604 | $date_format = str_replace($search, $replace, $date_format);  | 
                                                        
| 2605 | 2605 | |
| 2606 | -                                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        |
| 2607 | -                            }else{
 | 
                                                        |
| 2606 | +                                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        |
| 2607 | +                            } else {
 | 
                                                        |
| 2608 | 2608 |                                  $post_htmlvar_value = $post->{$type['htmlvar_name']};
 | 
                                                        
| 2609 | 2609 | }  | 
                                                        
| 2610 | 2610 | |
@@ -2623,11 +2623,11 @@ discard block  | 
                                                    ||
| 2623 | 2623 | |
| 2624 | 2624 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2625 | 2625 | |
| 2626 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2626 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2627 | 2627 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2628 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2628 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2629 | 2629 | }  | 
                                                        
| 2630 | - $html .= ' </span>' . $value . '</div>';  | 
                                                        |
| 2630 | + $html .= ' </span>'.$value.'</div>';  | 
                                                        |
| 2631 | 2631 | }  | 
                                                        
| 2632 | 2632 | break;  | 
                                                        
| 2633 | 2633 |                          case 'text': {
 | 
                                                        
@@ -2642,11 +2642,11 @@ discard block  | 
                                                    ||
| 2642 | 2642 | |
| 2643 | 2643 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2644 | 2644 | |
| 2645 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2645 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2646 | 2646 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2647 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2647 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2648 | 2648 | }  | 
                                                        
| 2649 | -                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2649 | +                            $html .= ' </span>'.$post->{$type['htmlvar_name']}.'</div>';
 | 
                                                        |
| 2650 | 2650 | }  | 
                                                        
| 2651 | 2651 | break;  | 
                                                        
| 2652 | 2652 |                          case 'radio': {
 | 
                                                        
@@ -2683,13 +2683,13 @@ discard block  | 
                                                    ||
| 2683 | 2683 | |
| 2684 | 2684 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2685 | 2685 | |
| 2686 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2686 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2687 | 2687 | |
| 2688 | 2688 |                                  if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2689 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2689 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2690 | 2690 | }  | 
                                                        
| 2691 | 2691 | |
| 2692 | - $html .= ' </span>' . $html_val . '</div>';  | 
                                                        |
| 2692 | + $html .= ' </span>'.$html_val.'</div>';  | 
                                                        |
| 2693 | 2693 | }  | 
                                                        
| 2694 | 2694 | }  | 
                                                        
| 2695 | 2695 | break;  | 
                                                        
@@ -2697,7 +2697,7 @@ discard block  | 
                                                    ||
| 2697 | 2697 | $html_var = $type['htmlvar_name'];  | 
                                                        
| 2698 | 2698 | $html_val = $type['htmlvar_name'];  | 
                                                        
| 2699 | 2699 | |
| 2700 | -                            if ((int)$post->{$html_var} == 1) {
 | 
                                                        |
| 2700 | +                            if ((int) $post->{$html_var} == 1) {
 | 
                                                        |
| 2701 | 2701 | |
| 2702 | 2702 |                                  if ($post->{$type['htmlvar_name']} == '1') {
 | 
                                                        
| 2703 | 2703 |                                      $html_val = __('Yes', 'geodirectory');
 | 
                                                        
@@ -2716,13 +2716,13 @@ discard block  | 
                                                    ||
| 2716 | 2716 | |
| 2717 | 2717 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2718 | 2718 | |
| 2719 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2719 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2720 | 2720 | |
| 2721 | 2721 |                                  if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2722 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2722 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2723 | 2723 | }  | 
                                                        
| 2724 | 2724 | |
| 2725 | - $html .= ' </span>' . $html_val . '</div>';  | 
                                                        |
| 2725 | + $html .= ' </span>'.$html_val.'</div>';  | 
                                                        |
| 2726 | 2726 | }  | 
                                                        
| 2727 | 2727 | }  | 
                                                        
| 2728 | 2728 | break;  | 
                                                        
@@ -2752,11 +2752,11 @@ discard block  | 
                                                    ||
| 2752 | 2752 | |
| 2753 | 2753 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2754 | 2754 | |
| 2755 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2755 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2756 | 2756 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2757 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2757 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2758 | 2758 | }  | 
                                                        
| 2759 | - $html .= ' </span>' . $field_value . '</div>';  | 
                                                        |
| 2759 | + $html .= ' </span>'.$field_value.'</div>';  | 
                                                        |
| 2760 | 2760 | }  | 
                                                        
| 2761 | 2761 | break;  | 
                                                        
| 2762 | 2762 |                          case 'multiselect': {
 | 
                                                        
@@ -2790,18 +2790,18 @@ discard block  | 
                                                    ||
| 2790 | 2790 | |
| 2791 | 2791 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2792 | 2792 | |
| 2793 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2793 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2794 | 2794 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2795 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2795 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2796 | 2796 | }  | 
                                                        
| 2797 | 2797 | $html .= ' </span>';  | 
                                                        
| 2798 | 2798 | |
| 2799 | 2799 | $html .= ' <span class="gd-multiselect-value-output gd-val-'.$type['htmlvar_name'].'" >';  | 
                                                        
| 2800 | 2800 | |
| 2801 | 2801 |                              if (count($option_values) > 1) {
 | 
                                                        
| 2802 | -                                $html .= "<span>".implode('</span>, <span>',$option_values)."</span>";
 | 
                                                        |
| 2802 | +                                $html .= "<span>".implode('</span>, <span>', $option_values)."</span>";
 | 
                                                        |
| 2803 | 2803 |                              } else {
 | 
                                                        
| 2804 | -                                $vals = explode(",",$post->{$type['htmlvar_name']});
 | 
                                                        |
| 2804 | +                                $vals = explode(",", $post->{$type['htmlvar_name']});
 | 
                                                        |
| 2805 | 2805 |                                  $html .= "<span>".implode('</span>, <span>', $vals)."</span>";
 | 
                                                        
| 2806 | 2806 | }  | 
                                                        
| 2807 | 2807 | |
@@ -2825,11 +2825,11 @@ discard block  | 
                                                    ||
| 2825 | 2825 | |
| 2826 | 2826 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2827 | 2827 | |
| 2828 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2828 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2829 | 2829 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2830 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2830 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2831 | 2831 | }  | 
                                                        
| 2832 | -                            $html .= ' </span>' . $post->{$type['htmlvar_name']} . '</div>';
 | 
                                                        |
| 2832 | +                            $html .= ' </span>'.$post->{$type['htmlvar_name']}.'</div>';
 | 
                                                        |
| 2833 | 2833 | }  | 
                                                        
| 2834 | 2834 | break;  | 
                                                        
| 2835 | 2835 |                          case 'textarea': {
 | 
                                                        
@@ -2844,11 +2844,11 @@ discard block  | 
                                                    ||
| 2844 | 2844 | |
| 2845 | 2845 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2846 | 2846 | |
| 2847 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2847 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2848 | 2848 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2849 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2849 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2850 | 2850 | }  | 
                                                        
| 2851 | -                            $html .= '</span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 2851 | +                            $html .= '</span>'.wpautop($post->{$type['htmlvar_name']}).'</div>';
 | 
                                                        |
| 2852 | 2852 | }  | 
                                                        
| 2853 | 2853 | break;  | 
                                                        
| 2854 | 2854 |                          case 'html': {
 | 
                                                        
@@ -2863,11 +2863,11 @@ discard block  | 
                                                    ||
| 2863 | 2863 | |
| 2864 | 2864 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2865 | 2865 | |
| 2866 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2866 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2867 | 2867 |                              if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2868 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2868 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2869 | 2869 | }  | 
                                                        
| 2870 | -                            $html .= ' </span>' . wpautop($post->{$type['htmlvar_name']}) . '</div>';
 | 
                                                        |
| 2870 | +                            $html .= ' </span>'.wpautop($post->{$type['htmlvar_name']}).'</div>';
 | 
                                                        |
| 2871 | 2871 | }  | 
                                                        
| 2872 | 2872 | break;  | 
                                                        
| 2873 | 2873 |                          case 'file': {
 | 
                                                        
@@ -2878,7 +2878,7 @@ discard block  | 
                                                    ||
| 2878 | 2878 | |
| 2879 | 2879 |                                  if (!empty($files)) {
 | 
                                                        
| 2880 | 2880 | $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;  | 
                                                        
| 2881 | -                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 2881 | +                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
 | 
                                                        |
| 2882 | 2882 | |
| 2883 | 2883 | $file_paths = '';  | 
                                                        
| 2884 | 2884 |                                      foreach ($files as $file) {
 | 
                                                        
@@ -2907,9 +2907,9 @@ discard block  | 
                                                    ||
| 2907 | 2907 | $file_paths .= '</a>';  | 
                                                        
| 2908 | 2908 | $file_paths .= '</div>';  | 
                                                        
| 2909 | 2909 |                                              } else {
 | 
                                                        
| 2910 | - $ext_path = '_' . $html_var . '_';  | 
                                                        |
| 2910 | + $ext_path = '_'.$html_var.'_';  | 
                                                        |
| 2911 | 2911 | $filename = explode($ext_path, $filename);  | 
                                                        
| 2912 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';  | 
                                                        |
| 2912 | + $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';  | 
                                                        |
| 2913 | 2913 | }  | 
                                                        
| 2914 | 2914 | }  | 
                                                        
| 2915 | 2915 | }  | 
                                                        
@@ -2926,13 +2926,13 @@ discard block  | 
                                                    ||
| 2926 | 2926 | $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';  | 
                                                        
| 2927 | 2927 | |
| 2928 | 2928 | |
| 2929 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;  | 
                                                        |
| 2929 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;'.$field_icon.'">'.$field_icon_af;  | 
                                                        |
| 2930 | 2930 | |
| 2931 | 2931 |                                      if ($field_set_start == 1 && $site_title != '') {
 | 
                                                        
| 2932 | - $html .= ' ' . __($site_title, 'geodirectory') . ': ';  | 
                                                        |
| 2932 | + $html .= ' '.__($site_title, 'geodirectory').': ';  | 
                                                        |
| 2933 | 2933 | }  | 
                                                        
| 2934 | 2934 | |
| 2935 | - $html .= ' </span>' . $file_paths . '</div>';  | 
                                                        |
| 2935 | + $html .= ' </span>'.$file_paths.'</div>';  | 
                                                        |
| 2936 | 2936 | }  | 
                                                        
| 2937 | 2937 | }  | 
                                                        
| 2938 | 2938 | }  | 
                                                        
@@ -2983,7 +2983,7 @@ discard block  | 
                                                    ||
| 2983 | 2983 | * @param string $htmlvar_name The field HTML var name.  | 
                                                        
| 2984 | 2984 | */  | 
                                                        
| 2985 | 2985 |                                  'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
 | 
                                                        
| 2986 | - 'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'  | 
                                                        |
| 2986 | + 'tab_content' => '<div class="geodir-company_info field-group">'.$fieldset_html.'</html>'  | 
                                                        |
| 2987 | 2987 | );  | 
                                                        
| 2988 | 2988 | }  | 
                                                        
| 2989 | 2989 |                      } else {
 | 
                                                        
@@ -3043,7 +3043,7 @@ discard block  | 
                                                    ||
| 3043 | 3043 | }  | 
                                                        
| 3044 | 3044 | $status .= ")</strong>";  | 
                                                        
| 3045 | 3045 | |
| 3046 | -            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
 | 
                                                        |
| 3046 | +            $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>';
 | 
                                                        |
| 3047 | 3047 | }  | 
                                                        
| 3048 | 3048 | }  | 
                                                        
| 3049 | 3049 | |
@@ -3123,7 +3123,7 @@ discard block  | 
                                                    ||
| 3123 | 3123 | function geodir_no_rating_comment_text($content, $comment = '')  | 
                                                        
| 3124 | 3124 |  {
 | 
                                                        
| 3125 | 3125 |      if (!is_admin()) {
 | 
                                                        
| 3126 | - return '<div class="description">' . $content . '</div>';  | 
                                                        |
| 3126 | + return '<div class="description">'.$content.'</div>';  | 
                                                        |
| 3127 | 3127 |      } else {
 | 
                                                        
| 3128 | 3128 | return $content;  | 
                                                        
| 3129 | 3129 | }  | 
                                                        
@@ -3201,7 +3201,7 @@ discard block  | 
                                                    ||
| 3201 | 3201 | $classes[] = 'gd-no-rating';  | 
                                                        
| 3202 | 3202 | }  | 
                                                        
| 3203 | 3203 | |
| 3204 | - $classes[] = 'gd-map-' . geodir_map_name();  | 
                                                        |
| 3204 | + $classes[] = 'gd-map-'.geodir_map_name();  | 
                                                        |
| 3205 | 3205 | |
| 3206 | 3206 | return $classes;  | 
                                                        
| 3207 | 3207 | }  | 
                                                        
@@ -3221,7 +3221,7 @@ discard block  | 
                                                    ||
| 3221 | 3221 | $class .= ' gd-no-rating';  | 
                                                        
| 3222 | 3222 | }  | 
                                                        
| 3223 | 3223 | |
| 3224 | - $class .= ' gd-map-' . geodir_map_name();  | 
                                                        |
| 3224 | + $class .= ' gd-map-'.geodir_map_name();  | 
                                                        |
| 3225 | 3225 | |
| 3226 | 3226 | return $class;  | 
                                                        
| 3227 | 3227 | }  | 
                                                        
@@ -3256,7 +3256,7 @@ discard block  | 
                                                    ||
| 3256 | 3256 | * @return array Translation texts.  | 
                                                        
| 3257 | 3257 | */  | 
                                                        
| 3258 | 3258 |  function geodir_load_gd_options_text_translation($translation_texts = array()) {
 | 
                                                        
| 3259 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();  | 
                                                        |
| 3259 | + $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();  | 
                                                        |
| 3260 | 3260 | |
| 3261 | 3261 |      $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');
 | 
                                                        
| 3262 | 3262 | |
@@ -3322,14 +3322,14 @@ discard block  | 
                                                    ||
| 3322 | 3322 | * @param array $args The array of menu arguments.  | 
                                                        
| 3323 | 3323 | * @return array The modified arguments.  | 
                                                        
| 3324 | 3324 | */  | 
                                                        
| 3325 | -function geodir_add_nav_menu_class( $args )  | 
                                                        |
| 3325 | +function geodir_add_nav_menu_class($args)  | 
                                                        |
| 3326 | 3326 |  {
 | 
                                                        
| 3327 | 3327 | |
| 3328 | -        if(isset($args['menu_class'])){
 | 
                                                        |
| 3328 | +        if (isset($args['menu_class'])) {
 | 
                                                        |
| 3329 | 3329 | $args['menu_class'] = $args['menu_class']." gd-menu-z";  | 
                                                        
| 3330 | 3330 | }  | 
                                                        
| 3331 | 3331 | |
| 3332 | 3332 | return $args;  | 
                                                        
| 3333 | 3333 | }  | 
                                                        
| 3334 | 3334 | |
| 3335 | -add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );  | 
                                                        |
| 3336 | 3335 | \ No newline at end of file  | 
                                                        
| 3336 | +add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class'); | 
                                                        |
| 3337 | 3337 | \ 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 | |
@@ -421,8 +422,9 @@ discard block  | 
                                                    ||
| 421 | 422 | */  | 
                                                        
| 422 | 423 |      do_action('geodir_after_social_sharing_buttons');
 | 
                                                        
| 423 | 424 | $content_html = ob_get_clean();  | 
                                                        
| 424 | - if (trim($content_html) != '')  | 
                                                        |
| 425 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';  | 
                                                        |
| 425 | +    if (trim($content_html) != '') { | 
                                                        |
| 426 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';  | 
                                                        |
| 427 | + }  | 
                                                        |
| 426 | 428 |      if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
 | 
                                                        
| 427 | 429 | /**  | 
                                                        
| 428 | 430 | * Filter the geodir_social_sharing_buttons() function content.  | 
                                                        
@@ -468,8 +470,9 @@ discard block  | 
                                                    ||
| 468 | 470 | */  | 
                                                        
| 469 | 471 |      do_action('geodir_after_share_this_button');
 | 
                                                        
| 470 | 472 | $content_html = ob_get_clean();  | 
                                                        
| 471 | - if (trim($content_html) != '')  | 
                                                        |
| 472 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';  | 
                                                        |
| 473 | +    if (trim($content_html) != '') { | 
                                                        |
| 474 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';  | 
                                                        |
| 475 | + }  | 
                                                        |
| 473 | 476 |      if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
 | 
                                                        
| 474 | 477 | /**  | 
                                                        
| 475 | 478 | * Filter the geodir_share_this_button() function content.  | 
                                                        
@@ -524,8 +527,9 @@ discard block  | 
                                                    ||
| 524 | 527 | */  | 
                                                        
| 525 | 528 |      do_action('geodir_after_edit_post_link');
 | 
                                                        
| 526 | 529 | $content_html = ob_get_clean();  | 
                                                        
| 527 | - if (trim($content_html) != '')  | 
                                                        |
| 528 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';  | 
                                                        |
| 530 | +    if (trim($content_html) != '') { | 
                                                        |
| 531 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';  | 
                                                        |
| 532 | + }  | 
                                                        |
| 529 | 533 |      if ((int)get_option('geodir_disable_user_links_section') != 1) {
 | 
                                                        
| 530 | 534 | /**  | 
                                                        
| 531 | 535 | * Filter the geodir_edit_post_link() function content.  | 
                                                        
@@ -1098,8 +1102,9 @@ discard block  | 
                                                    ||
| 1098 | 1102 | */  | 
                                                        
| 1099 | 1103 |      do_action('geodir_after_google_analytics');
 | 
                                                        
| 1100 | 1104 | $content_html = ob_get_clean();  | 
                                                        
| 1101 | - if (trim($content_html) != '')  | 
                                                        |
| 1102 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';  | 
                                                        |
| 1105 | +    if (trim($content_html) != '') { | 
                                                        |
| 1106 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';  | 
                                                        |
| 1107 | + }  | 
                                                        |
| 1103 | 1108 |      if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
 | 
                                                        
| 1104 | 1109 | /**  | 
                                                        
| 1105 | 1110 | * Filter the geodir_edit_post_link() function content.  | 
                                                        
@@ -1236,8 +1241,9 @@ discard block  | 
                                                    ||
| 1236 | 1241 |      do_action('geodir_after_detail_page_more_info');
 | 
                                                        
| 1237 | 1242 | |
| 1238 | 1243 | $content_html = ob_get_clean();  | 
                                                        
| 1239 | - if (trim($content_html) != '')  | 
                                                        |
| 1240 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';  | 
                                                        |
| 1244 | +    if (trim($content_html) != '') { | 
                                                        |
| 1245 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';  | 
                                                        |
| 1246 | + }  | 
                                                        |
| 1241 | 1247 |      if ((int)get_option('geodir_disable_listing_info_section') != 1) {
 | 
                                                        
| 1242 | 1248 | /**  | 
                                                        
| 1243 | 1249 | * Filter the output html for function geodir_detail_page_more_info().  | 
                                                        
@@ -1352,8 +1358,9 @@ discard block  | 
                                                    ||
| 1352 | 1358 |      $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
 | 
                                                        
| 1353 | 1359 | |
| 1354 | 1360 |      foreach ($arr_alert_msg as $key => $value) {
 | 
                                                        
| 1355 | - if (!is_scalar($value))  | 
                                                        |
| 1356 | - continue;  | 
                                                        |
| 1361 | +        if (!is_scalar($value)) { | 
                                                        |
| 1362 | + continue;  | 
                                                        |
| 1363 | + }  | 
                                                        |
| 1357 | 1364 | $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');  | 
                                                        
| 1358 | 1365 | }  | 
                                                        
| 1359 | 1366 | |
@@ -1407,17 +1414,19 @@ discard block  | 
                                                    ||
| 1407 | 1414 | global $geodir_sidebars;  | 
                                                        
| 1408 | 1415 | global $sidebars_widgets;  | 
                                                        
| 1409 | 1416 | |
| 1410 | - if (!is_array($sidebars_widgets))  | 
                                                        |
| 1411 | - $sidebars_widgets = wp_get_sidebars_widgets();  | 
                                                        |
| 1417 | +    if (!is_array($sidebars_widgets)) { | 
                                                        |
| 1418 | + $sidebars_widgets = wp_get_sidebars_widgets();  | 
                                                        |
| 1419 | + }  | 
                                                        |
| 1412 | 1420 | $geodir_old_sidebars = array();  | 
                                                        
| 1413 | 1421 | |
| 1414 | 1422 |      if (is_array($geodir_sidebars)) {
 | 
                                                        
| 1415 | 1423 |          foreach ($geodir_sidebars as $val) {
 | 
                                                        
| 1416 | 1424 |              if (is_array($sidebars_widgets)) {
 | 
                                                        
| 1417 | - if (array_key_exists($val, $sidebars_widgets))  | 
                                                        |
| 1418 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val];  | 
                                                        |
| 1419 | - else  | 
                                                        |
| 1420 | - $geodir_old_sidebars[$val] = array();  | 
                                                        |
| 1425 | +                if (array_key_exists($val, $sidebars_widgets)) { | 
                                                        |
| 1426 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val];  | 
                                                        |
| 1427 | +                } else { | 
                                                        |
| 1428 | + $geodir_old_sidebars[$val] = array();  | 
                                                        |
| 1429 | + }  | 
                                                        |
| 1421 | 1430 | }  | 
                                                        
| 1422 | 1431 | }  | 
                                                        
| 1423 | 1432 | }  | 
                                                        
@@ -1438,16 +1447,19 @@ discard block  | 
                                                    ||
| 1438 | 1447 |  {
 | 
                                                        
| 1439 | 1448 | global $sidebars_widgets;  | 
                                                        
| 1440 | 1449 | |
| 1441 | - if (!is_array($sidebars_widgets))  | 
                                                        |
| 1442 | - $sidebars_widgets = wp_get_sidebars_widgets();  | 
                                                        |
| 1450 | +    if (!is_array($sidebars_widgets)) { | 
                                                        |
| 1451 | + $sidebars_widgets = wp_get_sidebars_widgets();  | 
                                                        |
| 1452 | + }  | 
                                                        |
| 1443 | 1453 | |
| 1444 | 1454 |      if (is_array($sidebars_widgets)) {
 | 
                                                        
| 1445 | 1455 |          $geodir_old_sidebars = get_option('geodir_sidebars');
 | 
                                                        
| 1446 | 1456 |          if (is_array($geodir_old_sidebars)) {
 | 
                                                        
| 1447 | 1457 |              foreach ($geodir_old_sidebars as $key => $val) {
 | 
                                                        
| 1448 | - if(0 === strpos($key, 'geodir_'))// if gd widget  | 
                                                        |
| 1458 | +                if(0 === strpos($key, 'geodir_')) { | 
                                                        |
| 1459 | + // if gd widget  | 
                                                        |
| 1449 | 1460 |                  {
 | 
                                                        
| 1450 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key];  | 
                                                        |
| 1461 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key];  | 
                                                        |
| 1462 | + }  | 
                                                        |
| 1451 | 1463 | }  | 
                                                        
| 1452 | 1464 | |
| 1453 | 1465 | |
@@ -1583,20 +1595,25 @@ discard block  | 
                                                    ||
| 1583 | 1595 | }  | 
                                                        
| 1584 | 1596 | }  | 
                                                        
| 1585 | 1597 | |
| 1586 | - if ($tab == 'post_info')  | 
                                                        |
| 1587 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false;  | 
                                                        |
| 1598 | +    if ($tab == 'post_info') { | 
                                                        |
| 1599 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false;  | 
                                                        |
| 1600 | + }  | 
                                                        |
| 1588 | 1601 | |
| 1589 | - if ($tab == 'post_images')  | 
                                                        |
| 1590 | - $is_display = (!empty($post_images)) ? true : false;  | 
                                                        |
| 1602 | +    if ($tab == 'post_images') { | 
                                                        |
| 1603 | + $is_display = (!empty($post_images)) ? true : false;  | 
                                                        |
| 1604 | + }  | 
                                                        |
| 1591 | 1605 | |
| 1592 | - if ($tab == 'post_video')  | 
                                                        |
| 1593 | - $is_display = (!empty($video)) ? true : false;  | 
                                                        |
| 1606 | +    if ($tab == 'post_video') { | 
                                                        |
| 1607 | + $is_display = (!empty($video)) ? true : false;  | 
                                                        |
| 1608 | + }  | 
                                                        |
| 1594 | 1609 | |
| 1595 | - if ($tab == 'special_offers')  | 
                                                        |
| 1596 | - $is_display = (!empty($special_offers)) ? true : false;  | 
                                                        |
| 1610 | +    if ($tab == 'special_offers') { | 
                                                        |
| 1611 | + $is_display = (!empty($special_offers)) ? true : false;  | 
                                                        |
| 1612 | + }  | 
                                                        |
| 1597 | 1613 | |
| 1598 | - if ($tab == 'reviews')  | 
                                                        |
| 1599 | -        $is_display = (geodir_is_page('detail')) ? true : false;
 | 
                                                        |
| 1614 | +    if ($tab == 'reviews') { | 
                                                        |
| 1615 | +            $is_display = (geodir_is_page('detail')) ? true : false; | 
                                                        |
| 1616 | + }  | 
                                                        |
| 1600 | 1617 | |
| 1601 | 1618 |      if ($tab == 'related_listing') {
 | 
                                                        
| 1602 | 1619 |         $message = __('No listings found which match your selection.', 'geodirectory');
 | 
                                                        
@@ -1830,11 +1847,13 @@ discard block  | 
                                                    ||
| 1830 | 1847 | $region_slug = $default_location->region_slug;  | 
                                                        
| 1831 | 1848 | $city_slug = $default_location->city_slug;  | 
                                                        
| 1832 | 1849 | |
| 1833 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)  | 
                                                        |
| 1834 | - return $slug_exists = true;  | 
                                                        |
| 1850 | +    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) { | 
                                                        |
| 1851 | + return $slug_exists = true;  | 
                                                        |
| 1852 | + }  | 
                                                        |
| 1835 | 1853 | |
| 1836 | -    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
 | 
                                                        |
| 1837 | - return $slug_exists = true;  | 
                                                        |
| 1854 | +    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) { | 
                                                        |
| 1855 | + return $slug_exists = true;  | 
                                                        |
| 1856 | + }  | 
                                                        |
| 1838 | 1857 | |
| 1839 | 1858 | return $slug_exists;  | 
                                                        
| 1840 | 1859 | }  | 
                                                        
@@ -1876,40 +1895,31 @@ discard block  | 
                                                    ||
| 1876 | 1895 |      if(geodir_is_page('home')){
 | 
                                                        
| 1877 | 1896 | $gd_page = 'home';  | 
                                                        
| 1878 | 1897 |          $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
 | 
                                                        
| 1879 | - }  | 
                                                        |
| 1880 | -    elseif(geodir_is_page('detail')){
 | 
                                                        |
| 1898 | +    } elseif(geodir_is_page('detail')){
 | 
                                                        |
| 1881 | 1899 | $gd_page = 'detail';  | 
                                                        
| 1882 | 1900 |          $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
 | 
                                                        
| 1883 | - }  | 
                                                        |
| 1884 | -    elseif(geodir_is_page('pt')){
 | 
                                                        |
| 1901 | +    } elseif(geodir_is_page('pt')){
 | 
                                                        |
| 1885 | 1902 | $gd_page = 'pt';  | 
                                                        
| 1886 | 1903 |          $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
 | 
                                                        
| 1887 | - }  | 
                                                        |
| 1888 | -    elseif(geodir_is_page('listing')){
 | 
                                                        |
| 1904 | +    } elseif(geodir_is_page('listing')){
 | 
                                                        |
| 1889 | 1905 | $gd_page = 'listing';  | 
                                                        
| 1890 | 1906 |          $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
 | 
                                                        
| 1891 | - }  | 
                                                        |
| 1892 | -    elseif(geodir_is_page('location')){
 | 
                                                        |
| 1907 | +    } elseif(geodir_is_page('location')){
 | 
                                                        |
| 1893 | 1908 | $gd_page = 'location';  | 
                                                        
| 1894 | 1909 |          $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
 | 
                                                        
| 1895 | - }  | 
                                                        |
| 1896 | -    elseif(geodir_is_page('search')){
 | 
                                                        |
| 1910 | +    } elseif(geodir_is_page('search')){
 | 
                                                        |
| 1897 | 1911 | $gd_page = 'search';  | 
                                                        
| 1898 | 1912 |          $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
 | 
                                                        
| 1899 | - }  | 
                                                        |
| 1900 | -    elseif(geodir_is_page('add-listing')){
 | 
                                                        |
| 1913 | +    } elseif(geodir_is_page('add-listing')){
 | 
                                                        |
| 1901 | 1914 | $gd_page = 'add-listing';  | 
                                                        
| 1902 | 1915 |          $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
 | 
                                                        
| 1903 | - }  | 
                                                        |
| 1904 | -    elseif(geodir_is_page('author')){
 | 
                                                        |
| 1916 | +    } elseif(geodir_is_page('author')){
 | 
                                                        |
| 1905 | 1917 | $gd_page = 'author';  | 
                                                        
| 1906 | 1918 |          $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
 | 
                                                        
| 1907 | - }  | 
                                                        |
| 1908 | -    elseif(geodir_is_page('login')){
 | 
                                                        |
| 1919 | +    } elseif(geodir_is_page('login')){
 | 
                                                        |
| 1909 | 1920 | $gd_page = 'login';  | 
                                                        
| 1910 | 1921 |          $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
 | 
                                                        
| 1911 | - }  | 
                                                        |
| 1912 | -    elseif(geodir_is_page('listing-success')){
 | 
                                                        |
| 1922 | +    } elseif(geodir_is_page('listing-success')){
 | 
                                                        |
| 1913 | 1923 | $gd_page = 'listing-success';  | 
                                                        
| 1914 | 1924 |          $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
 | 
                                                        
| 1915 | 1925 | }  | 
                                                        
@@ -1987,11 +1997,13 @@ discard block  | 
                                                    ||
| 1987 | 1997 | |
| 1988 | 1998 |      if (!get_option('geodir_remove_url_seperator')) {
 | 
                                                        
| 1989 | 1999 | |
| 1990 | -        if (get_option('geodir_listingurl_separator'))
 | 
                                                        |
| 1991 | -            delete_option('geodir_listingurl_separator');
 | 
                                                        |
| 2000 | +        if (get_option('geodir_listingurl_separator')) { | 
                                                        |
| 2001 | +                    delete_option('geodir_listingurl_separator'); | 
                                                        |
| 2002 | + }  | 
                                                        |
| 1992 | 2003 | |
| 1993 | -        if (get_option('geodir_detailurl_separator'))
 | 
                                                        |
| 1994 | -            delete_option('geodir_detailurl_separator');
 | 
                                                        |
| 2004 | +        if (get_option('geodir_detailurl_separator')) { | 
                                                        |
| 2005 | +                    delete_option('geodir_detailurl_separator'); | 
                                                        |
| 2006 | + }  | 
                                                        |
| 1995 | 2007 | |
| 1996 | 2008 | flush_rewrite_rules(false);  | 
                                                        
| 1997 | 2009 | |
@@ -2015,8 +2027,9 @@ discard block  | 
                                                    ||
| 2015 | 2027 |  {
 | 
                                                        
| 2016 | 2028 |      foreach ($permalink_arr as $key => $value) {
 | 
                                                        
| 2017 | 2029 | |
| 2018 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')  | 
                                                        |
| 2019 | - unset($permalink_arr[$key]);  | 
                                                        |
| 2030 | +        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') { | 
                                                        |
| 2031 | + unset($permalink_arr[$key]);  | 
                                                        |
| 2032 | + }  | 
                                                        |
| 2020 | 2033 | |
| 2021 | 2034 | }  | 
                                                        
| 2022 | 2035 | |
@@ -2151,16 +2164,18 @@ discard block  | 
                                                    ||
| 2151 | 2164 | |
| 2152 | 2165 |              $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)));
 | 
                                                        
| 2153 | 2166 | |
| 2154 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')  | 
                                                        |
| 2155 | - $tabs_arr['post_video']['heading_text'] = $field_title;  | 
                                                        |
| 2167 | +            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') { | 
                                                        |
| 2168 | + $tabs_arr['post_video']['heading_text'] = $field_title;  | 
                                                        |
| 2169 | + }  | 
                                                        |
| 2156 | 2170 | }  | 
                                                        
| 2157 | 2171 | |
| 2158 | 2172 |          if (array_key_exists('special_offers', $tabs_arr)) {
 | 
                                                        
| 2159 | 2173 | |
| 2160 | 2174 |              $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)));
 | 
                                                        
| 2161 | 2175 | |
| 2162 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')  | 
                                                        |
| 2163 | - $tabs_arr['special_offers']['heading_text'] = $field_title;  | 
                                                        |
| 2176 | +            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') { | 
                                                        |
| 2177 | + $tabs_arr['special_offers']['heading_text'] = $field_title;  | 
                                                        |
| 2178 | + }  | 
                                                        |
| 2164 | 2179 | }  | 
                                                        
| 2165 | 2180 | |
| 2166 | 2181 | }  | 
                                                        
@@ -2215,8 +2230,9 @@ discard block  | 
                                                    ||
| 2215 | 2230 | |
| 2216 | 2231 | $all_postypes = geodir_get_posttypes();  | 
                                                        
| 2217 | 2232 | |
| 2218 | - if (!in_array($post_type, $all_postypes) || !is_admin())  | 
                                                        |
| 2219 | - return false;  | 
                                                        |
| 2233 | +        if (!in_array($post_type, $all_postypes) || !is_admin()) { | 
                                                        |
| 2234 | + return false;  | 
                                                        |
| 2235 | + }  | 
                                                        |
| 2220 | 2236 | |
| 2221 | 2237 | $uploads = wp_upload_dir();  | 
                                                        
| 2222 | 2238 | |
@@ -2290,8 +2306,9 @@ discard block  | 
                                                    ||
| 2290 | 2306 | $file_info = pathinfo($attach->file);  | 
                                                        
| 2291 | 2307 | |
| 2292 | 2308 | $sub_dir = '';  | 
                                                        
| 2293 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')  | 
                                                        |
| 2294 | - $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 2309 | +                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { | 
                                                        |
| 2310 | + $sub_dir = stripslashes_deep($file_info['dirname']);  | 
                                                        |
| 2311 | + }  | 
                                                        |
| 2295 | 2312 | |
| 2296 | 2313 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs  | 
                                                        
| 2297 | 2314 | $uploads_path = $uploads['basedir'];  | 
                                                        
@@ -2312,8 +2329,9 @@ discard block  | 
                                                    ||
| 2312 | 2329 | |
| 2313 | 2330 |                      if (!empty($attachment_data)) {
 | 
                                                        
| 2314 | 2331 | |
| 2315 | - if ($attachment_data->ID)  | 
                                                        |
| 2316 | -                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
 | 
                                                        |
| 2332 | +                        if ($attachment_data->ID) { | 
                                                        |
| 2333 | +                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); | 
                                                        |
| 2334 | + }  | 
                                                        |
| 2317 | 2335 | |
| 2318 | 2336 |                      } else {
 | 
                                                        
| 2319 | 2337 | |
@@ -2566,8 +2584,9 @@ discard block  | 
                                                    ||
| 2566 | 2584 | break;  | 
                                                        
| 2567 | 2585 |                          case 'time': {
 | 
                                                        
| 2568 | 2586 | $value = '';  | 
                                                        
| 2569 | -                            if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2570 | -                                $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
 | 
                                                        |
| 2587 | +                            if ($post->{$type['htmlvar_name']} != '') { | 
                                                        |
| 2588 | +                                                            $value = date_i18n(get_option('time_format'), strtotime($post->{$type['htmlvar_name']})); | 
                                                        |
| 2589 | + }  | 
                                                        |
| 2571 | 2590 | |
| 2572 | 2591 |                              if (strpos($field_icon, 'http') !== false) {
 | 
                                                        
| 2573 | 2592 | $field_icon_af = '';  | 
                                                        
@@ -2604,13 +2623,14 @@ discard block  | 
                                                    ||
| 2604 | 2623 | $date_format = str_replace($search, $replace, $date_format);  | 
                                                        
| 2605 | 2624 | |
| 2606 | 2625 |                                  $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
 | 
                                                        
| 2607 | -                            }else{
 | 
                                                        |
| 2626 | +                            } else{
 | 
                                                        |
| 2608 | 2627 |                                  $post_htmlvar_value = $post->{$type['htmlvar_name']};
 | 
                                                        
| 2609 | 2628 | }  | 
                                                        
| 2610 | 2629 | |
| 2611 | 2630 | $value = '';  | 
                                                        
| 2612 | -                            if ($post->{$type['htmlvar_name']} != '')
 | 
                                                        |
| 2613 | - $value = date_i18n($date_format, strtotime($post_htmlvar_value));  | 
                                                        |
| 2631 | +                            if ($post->{$type['htmlvar_name']} != '') { | 
                                                        |
| 2632 | + $value = date_i18n($date_format, strtotime($post_htmlvar_value));  | 
                                                        |
| 2633 | + }  | 
                                                        |
| 2614 | 2634 | |
| 2615 | 2635 |                              if (strpos($field_icon, 'http') !== false) {
 | 
                                                        
| 2616 | 2636 | $field_icon_af = '';  |