@@ -16,100 +16,100 @@ |
||
| 16 | 16 | |
| 17 | 17 | $field_ids = array(); |
| 18 | 18 | if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) { |
| 19 | - foreach ($_REQUEST['licontainer'] as $lic_id) { |
|
| 20 | - $field_ids[] = sanitize_text_field($lic_id); |
|
| 21 | - } |
|
| 19 | + foreach ($_REQUEST['licontainer'] as $lic_id) { |
|
| 20 | + $field_ids[] = sanitize_text_field($lic_id); |
|
| 21 | + } |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /* ------- check nonce field ------- */ |
| 25 | 25 | if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 26 | - echo godir_set_field_order($field_ids); |
|
| 26 | + echo godir_set_field_order($field_ids); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 30 | - $response = godir_set_sort_field_order($field_ids); |
|
| 31 | - if (is_array($response)) { |
|
| 32 | - wp_send_json($response); |
|
| 33 | - } else { |
|
| 34 | - echo $response; |
|
| 35 | - } |
|
| 30 | + $response = godir_set_sort_field_order($field_ids); |
|
| 31 | + if (is_array($response)) { |
|
| 32 | + wp_send_json($response); |
|
| 33 | + } else { |
|
| 34 | + echo $response; |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /* ---- Show field form in admin ---- */ |
| 39 | 39 | if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 40 | - geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 40 | + geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 44 | - geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 44 | + geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /* ---- Delete field ---- */ |
| 48 | 48 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 49 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 50 | - return; |
|
| 49 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 50 | + return; |
|
| 51 | 51 | |
| 52 | - echo geodir_custom_field_delete($field_id); |
|
| 52 | + echo geodir_custom_field_delete($field_id); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 56 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 57 | - return; |
|
| 56 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 57 | + return; |
|
| 58 | 58 | |
| 59 | - echo geodir_custom_sort_field_delete($field_id); |
|
| 59 | + echo geodir_custom_sort_field_delete($field_id); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /* ---- Save field ---- */ |
| 63 | 63 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 64 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 65 | - return; |
|
| 66 | - |
|
| 67 | - foreach ($_REQUEST as $pkey => $pval) { |
|
| 68 | - if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') { |
|
| 69 | - $tags = 'skip_field'; |
|
| 70 | - } else { |
|
| 71 | - $tags = ''; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - if ($tags != 'skip_field') { |
|
| 75 | - $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - $return = geodir_custom_field_save($_REQUEST); |
|
| 80 | - |
|
| 81 | - if (is_int($return)) { |
|
| 82 | - $lastid = $return; |
|
| 83 | - geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key); |
|
| 84 | - } else { |
|
| 85 | - echo $return; |
|
| 86 | - } |
|
| 64 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 65 | + return; |
|
| 66 | + |
|
| 67 | + foreach ($_REQUEST as $pkey => $pval) { |
|
| 68 | + if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') { |
|
| 69 | + $tags = 'skip_field'; |
|
| 70 | + } else { |
|
| 71 | + $tags = ''; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + if ($tags != 'skip_field') { |
|
| 75 | + $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + $return = geodir_custom_field_save($_REQUEST); |
|
| 80 | + |
|
| 81 | + if (is_int($return)) { |
|
| 82 | + $lastid = $return; |
|
| 83 | + geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key); |
|
| 84 | + } else { |
|
| 85 | + echo $return; |
|
| 86 | + } |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /* ---- Save sort field ---- */ |
| 90 | 90 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 91 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 92 | - return; |
|
| 93 | - |
|
| 94 | - foreach ($_REQUEST as $pkey => $pval) { |
|
| 95 | - if (is_array($_REQUEST[$pkey])) { |
|
| 96 | - $tags = 'skip_field'; |
|
| 97 | - } else { |
|
| 98 | - $tags = ''; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - if ($tags != 'skip_field') { |
|
| 102 | - $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $return = geodir_custom_sort_field_save($_REQUEST); |
|
| 107 | - |
|
| 108 | - if (is_int($return)) { |
|
| 109 | - $lastid = $return; |
|
| 110 | - $default = false; |
|
| 111 | - geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default); |
|
| 112 | - } else { |
|
| 113 | - echo $return; |
|
| 114 | - } |
|
| 91 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 92 | + return; |
|
| 93 | + |
|
| 94 | + foreach ($_REQUEST as $pkey => $pval) { |
|
| 95 | + if (is_array($_REQUEST[$pkey])) { |
|
| 96 | + $tags = 'skip_field'; |
|
| 97 | + } else { |
|
| 98 | + $tags = ''; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + if ($tags != 'skip_field') { |
|
| 102 | + $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $return = geodir_custom_sort_field_save($_REQUEST); |
|
| 107 | + |
|
| 108 | + if (is_int($return)) { |
|
| 109 | + $lastid = $return; |
|
| 110 | + $default = false; |
|
| 111 | + geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default); |
|
| 112 | + } else { |
|
| 113 | + echo $return; |
|
| 114 | + } |
|
| 115 | 115 | } |
| 116 | 116 | \ No newline at end of file |
@@ -37,23 +37,23 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | /* ---- Show field form in admin ---- */ |
| 39 | 39 | if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 40 | - geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 40 | + geodir_custom_field_adminhtml($field_type, $field_id, $field_action, $field_type_key); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 44 | - geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 44 | + geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action, $field_type_key); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /* ---- Delete field ---- */ |
| 48 | 48 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 49 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 49 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id)) |
|
| 50 | 50 | return; |
| 51 | 51 | |
| 52 | 52 | echo geodir_custom_field_delete($field_id); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 56 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 56 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id)) |
|
| 57 | 57 | return; |
| 58 | 58 | |
| 59 | 59 | echo geodir_custom_sort_field_delete($field_id); |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | /* ---- Save field ---- */ |
| 63 | 63 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 64 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 64 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id)) |
|
| 65 | 65 | return; |
| 66 | 66 | |
| 67 | 67 | foreach ($_REQUEST as $pkey => $pval) { |
| 68 | - if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') { |
|
| 68 | + if (is_array($_REQUEST[$pkey]) || $pkey == 'default_value') { |
|
| 69 | 69 | $tags = 'skip_field'; |
| 70 | 70 | } else { |
| 71 | 71 | $tags = ''; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | if (is_int($return)) { |
| 82 | 82 | $lastid = $return; |
| 83 | - geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key); |
|
| 83 | + geodir_custom_field_adminhtml($field_type, $lastid, 'submit', $field_type_key); |
|
| 84 | 84 | } else { |
| 85 | 85 | echo $return; |
| 86 | 86 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | /* ---- Save sort field ---- */ |
| 90 | 90 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 91 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 91 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id)) |
|
| 92 | 92 | return; |
| 93 | 93 | |
| 94 | 94 | foreach ($_REQUEST as $pkey => $pval) { |
@@ -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]; |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | $default_query .= " and is_admin = '0' "; |
| 89 | 89 | |
| 90 | 90 | if ($fields_location == 'none') {
|
| 91 | - } else{
|
|
| 92 | - $fields_location = esc_sql( $fields_location ); |
|
| 91 | + } else {
|
|
| 92 | + $fields_location = esc_sql($fields_location); |
|
| 93 | 93 | $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
| 94 | 94 | } |
| 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 | ); |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | * @param string $field_ins_upd When set to "submit" displays form. |
| 163 | 163 | * @param string $field_type_key The key of the custom field. |
| 164 | 164 | */ |
| 165 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 165 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 166 | 166 | {
|
| 167 | 167 | global $wpdb; |
| 168 | 168 | $cf = $result_str; |
| 169 | 169 | if (!is_object($cf)) {
|
| 170 | 170 | |
| 171 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 171 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
|
|
| 172 | 172 | |
| 173 | 173 | } else {
|
| 174 | 174 | $field_info = $cf; |
@@ -202,14 +202,14 @@ discard block |
||
| 202 | 202 | if ($field_id != '') {
|
| 203 | 203 | $cf = trim($field_id, '_'); |
| 204 | 204 | |
| 205 | - if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 206 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 205 | + if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
|
|
| 206 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 207 | 207 | |
| 208 | 208 | $post_type = $field->post_type; |
| 209 | 209 | $htmlvar_name = $field->htmlvar_name; |
| 210 | 210 | |
| 211 | 211 | if ($post_type != '' && $htmlvar_name != '') {
|
| 212 | - $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)));
|
|
| 212 | + $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 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
| 224 | 224 | |
| 225 | 225 | if ($field->field_type == 'address') {
|
| 226 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 227 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 228 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 229 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 230 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 231 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 232 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 233 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 234 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 226 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
|
|
| 227 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
|
|
| 228 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
|
|
| 229 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
|
|
| 230 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
|
|
| 231 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
|
|
| 232 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
|
|
| 233 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
|
|
| 234 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
|
|
| 235 | 235 | } else {
|
| 236 | 236 | if ($field->field_type != 'fieldset') {
|
| 237 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 237 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
|
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
| 306 | 306 | |
| 307 | 307 | // some servers fail if a POST value is VARCHAR so we change it. |
| 308 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 308 | + if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
|
|
| 309 | 309 | $request_field['data_type'] = 'VARCHAR'; |
| 310 | 310 | } |
| 311 | 311 | |
@@ -318,12 +318,12 @@ discard block |
||
| 318 | 318 | $post_type = $request_field['listing_type']; |
| 319 | 319 | |
| 320 | 320 | if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
| 321 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 321 | + $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | $check_html_variable = $wpdb->get_var( |
| 325 | 325 | $wpdb->prepare( |
| 326 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | + "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 327 | 327 | array($cf, $cehhtmlvar_name, $post_type) |
| 328 | 328 | ) |
| 329 | 329 | ); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $post_meta_info = $wpdb->get_row( |
| 337 | 337 | $wpdb->prepare( |
| 338 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 338 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d", |
|
| 339 | 339 | array($cf) |
| 340 | 340 | ) |
| 341 | 341 | ); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if ($post_type == '') $post_type = 'gd_place'; |
| 354 | 354 | |
| 355 | 355 | |
| 356 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 356 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
| 357 | 357 | |
| 358 | 358 | $admin_title = $request_field['admin_title']; |
| 359 | 359 | $site_title = $request_field['site_title']; |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
| 382 | 382 | |
| 383 | 383 | |
| 384 | - if(is_array($show_in)){
|
|
| 384 | + if (is_array($show_in)) {
|
|
| 385 | 385 | $show_in = implode(",", $request_field['show_in']);
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
| 389 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 389 | + $htmlvar_name = 'geodir_'.$htmlvar_name; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $option_values = ''; |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | if ($sort_order == '') {
|
| 429 | 429 | |
| 430 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 430 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 431 | 431 | |
| 432 | - $sort_order = (int)$last_order + 1; |
|
| 432 | + $sort_order = (int) $last_order + 1; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | $default_value_add = ''; |
@@ -441,15 +441,15 @@ discard block |
||
| 441 | 441 | case 'address': |
| 442 | 442 | |
| 443 | 443 | if ($htmlvar_name != '') {
|
| 444 | - $prefix = $htmlvar_name . '_'; |
|
| 444 | + $prefix = $htmlvar_name.'_'; |
|
| 445 | 445 | } |
| 446 | - $old_prefix = $old_html_variable . '_'; |
|
| 446 | + $old_prefix = $old_html_variable.'_'; |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 449 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 450 | 450 | |
| 451 | 451 | if ($default_value != '') {
|
| 452 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 452 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | $wpdb->query($meta_field_add); |
@@ -458,12 +458,12 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 460 | 460 | |
| 461 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 461 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
|
|
| 462 | 462 | if ($is_column) {
|
| 463 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 463 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL"; |
|
| 464 | 464 | |
| 465 | 465 | if ($default_value != '') {
|
| 466 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 466 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | $wpdb->query($meta_field_add); |
@@ -471,9 +471,9 @@ discard block |
||
| 471 | 471 | |
| 472 | 472 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 473 | 473 | if ($default_value != '') {
|
| 474 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 474 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 475 | 475 | } |
| 476 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 476 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 477 | 477 | |
| 478 | 478 | } |
| 479 | 479 | |
@@ -483,36 +483,36 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 485 | 485 | |
| 486 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 486 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
|
|
| 487 | 487 | |
| 488 | 488 | if ($is_column) {
|
| 489 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 489 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL"; |
|
| 490 | 490 | |
| 491 | 491 | if ($default_value != '') {
|
| 492 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 492 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | $wpdb->query($meta_field_add); |
| 496 | 496 | } else {
|
| 497 | 497 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 498 | 498 | if ($default_value != '') {
|
| 499 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 499 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 502 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | } |
| 506 | 506 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 507 | 507 | |
| 508 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 508 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
|
|
| 509 | 509 | |
| 510 | 510 | if ($is_column) {
|
| 511 | 511 | |
| 512 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 512 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL"; |
|
| 513 | 513 | |
| 514 | 514 | if ($default_value != '') {
|
| 515 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 515 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | $wpdb->query($meta_field_add); |
@@ -520,24 +520,24 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 522 | 522 | if ($default_value != '') {
|
| 523 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 523 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 526 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 527 | 527 | |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | } |
| 531 | 531 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 532 | 532 | |
| 533 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 533 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
|
|
| 534 | 534 | |
| 535 | 535 | if ($is_column) {
|
| 536 | 536 | |
| 537 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 537 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL"; |
|
| 538 | 538 | |
| 539 | 539 | if ($default_value != '') {
|
| 540 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 540 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | $wpdb->query($meta_field_add); |
@@ -545,128 +545,128 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 547 | 547 | if ($default_value != '') {
|
| 548 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 548 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 551 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | } |
| 556 | 556 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 557 | 557 | |
| 558 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 558 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
|
|
| 559 | 559 | if ($is_column) {
|
| 560 | 560 | |
| 561 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 561 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 562 | 562 | |
| 563 | 563 | if ($default_value != '') {
|
| 564 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 564 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | $wpdb->query($meta_field_add); |
| 568 | 568 | } else {
|
| 569 | 569 | |
| 570 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 570 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 571 | 571 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 572 | 572 | if ($default_value != '') {
|
| 573 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 573 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 576 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 577 | 577 | |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | |
| 581 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 581 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
|
|
| 582 | 582 | |
| 583 | 583 | if ($is_column) {
|
| 584 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 584 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 585 | 585 | |
| 586 | 586 | if ($default_value != '') {
|
| 587 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 587 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | $wpdb->query($meta_field_add); |
| 591 | 591 | } else {
|
| 592 | 592 | |
| 593 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 593 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 594 | 594 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 595 | 595 | if ($default_value != '') {
|
| 596 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 596 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 599 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | } |
| 603 | 603 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 604 | 604 | |
| 605 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 605 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
|
|
| 606 | 606 | |
| 607 | 607 | if ($is_column) {
|
| 608 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 608 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 609 | 609 | |
| 610 | 610 | if ($default_value != '') {
|
| 611 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 611 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | $wpdb->query($meta_field_add); |
| 615 | 615 | } else {
|
| 616 | 616 | |
| 617 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 617 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 618 | 618 | |
| 619 | 619 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 620 | 620 | if ($default_value != '') {
|
| 621 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 621 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 624 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | |
| 628 | 628 | } |
| 629 | 629 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 630 | 630 | |
| 631 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 631 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
|
|
| 632 | 632 | if ($is_column) {
|
| 633 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 633 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 634 | 634 | |
| 635 | 635 | if ($default_value != '') {
|
| 636 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 636 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | $wpdb->query($meta_field_add); |
| 640 | 640 | |
| 641 | 641 | } else {
|
| 642 | 642 | |
| 643 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 643 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 644 | 644 | |
| 645 | 645 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 646 | 646 | if ($default_value != '') {
|
| 647 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 647 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 650 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | } |
| 654 | 654 | // show lat lng |
| 655 | 655 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 656 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 656 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
|
|
| 657 | 657 | |
| 658 | 658 | if ($is_column) {
|
| 659 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 659 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | 660 | $meta_field_add .= " DEFAULT '1'"; |
| 661 | 661 | |
| 662 | 662 | $wpdb->query($meta_field_add); |
| 663 | 663 | } else {
|
| 664 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 664 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 665 | 665 | |
| 666 | 666 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 667 | 667 | $meta_field_add .= " DEFAULT '1'"; |
| 668 | 668 | |
| 669 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 669 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | } |
@@ -682,30 +682,30 @@ discard block |
||
| 682 | 682 | $op_size = '500'; |
| 683 | 683 | |
| 684 | 684 | // only make the field as big as it needs to be. |
| 685 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 686 | - $option_values_arr = explode(',',$option_values);
|
|
| 687 | - if(is_array($option_values_arr)){
|
|
| 685 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 686 | + $option_values_arr = explode(',', $option_values);
|
|
| 687 | + if (is_array($option_values_arr)) {
|
|
| 688 | 688 | $op_max = 0; |
| 689 | - foreach($option_values_arr as $op_val){
|
|
| 690 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 689 | + foreach ($option_values_arr as $op_val) {
|
|
| 690 | + if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
|
|
| 691 | 691 | } |
| 692 | - if($op_max){$op_size =$op_max; }
|
|
| 692 | + if ($op_max) {$op_size = $op_max; }
|
|
| 693 | 693 | } |
| 694 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 695 | - if(strlen($option_values)){
|
|
| 696 | - $op_size = strlen($option_values); |
|
| 694 | + }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 695 | + if (strlen($option_values)) {
|
|
| 696 | + $op_size = strlen($option_values); |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 700 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL"; |
|
| 701 | 701 | |
| 702 | 702 | if ($default_value != '') {
|
| 703 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 703 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | $alter_result = $wpdb->query($meta_field_add); |
| 707 | - if($alter_result===false){
|
|
| 708 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 707 | + if ($alter_result === false) {
|
|
| 708 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | if (isset($request_field['cat_display_type'])) |
@@ -722,9 +722,9 @@ discard block |
||
| 722 | 722 | case 'url': |
| 723 | 723 | case 'file': |
| 724 | 724 | |
| 725 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 726 | - if($alter_result===false){
|
|
| 727 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 725 | + $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
|
|
| 726 | + if ($alter_result === false) {
|
|
| 727 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 728 | 728 | } |
| 729 | 729 | if (isset($request_field['advanced_editor'])) |
| 730 | 730 | $extra_fields = $request_field['advanced_editor']; |
@@ -738,24 +738,24 @@ discard block |
||
| 738 | 738 | default: |
| 739 | 739 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 740 | 740 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 741 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 741 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL"; |
|
| 742 | 742 | } else {
|
| 743 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 743 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL"; |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | if (is_numeric($default_value) && $default_value != '') {
|
| 747 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 747 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 748 | 748 | } |
| 749 | 749 | } else {
|
| 750 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 750 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL"; |
|
| 751 | 751 | if ($default_value != '') {
|
| 752 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 752 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | $alter_result = $wpdb->query($default_value_add); |
| 757 | - if($alter_result===false){
|
|
| 758 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 757 | + if ($alter_result === false) {
|
|
| 758 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 759 | 759 | } |
| 760 | 760 | break; |
| 761 | 761 | endswitch; |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | $wpdb->prepare( |
| 773 | 773 | |
| 774 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 774 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 775 | 775 | post_type = %s, |
| 776 | 776 | admin_title = %s, |
| 777 | 777 | site_title = %s, |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | for_admin_use = %s |
| 806 | 806 | where id = %d", |
| 807 | 807 | |
| 808 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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) |
|
| 808 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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) |
|
| 809 | 809 | ) |
| 810 | 810 | |
| 811 | 811 | ); |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | |
| 816 | 816 | $wpdb->query( |
| 817 | 817 | $wpdb->prepare( |
| 818 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 818 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 819 | 819 | site_title=%s |
| 820 | 820 | where post_type = %s and htmlvar_name = %s", |
| 821 | 821 | array($site_title, $post_type, $htmlvar_name) |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | |
| 826 | 826 | if ($cat_sort == '') |
| 827 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 827 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 828 | 828 | |
| 829 | 829 | |
| 830 | 830 | /** |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $data_type = ''; |
| 845 | 845 | |
| 846 | 846 | if ($htmlvar_name != '') {
|
| 847 | - $prefix = $htmlvar_name . '_'; |
|
| 847 | + $prefix = $htmlvar_name.'_'; |
|
| 848 | 848 | } |
| 849 | 849 | $old_prefix = $old_html_variable; |
| 850 | 850 | |
@@ -852,109 +852,109 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | $meta_field_add = "VARCHAR( 254 ) NULL"; |
| 854 | 854 | if ($default_value != '') {
|
| 855 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 855 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 858 | + geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add); |
|
| 859 | 859 | //$wpdb->query($meta_field_add); |
| 860 | 860 | |
| 861 | 861 | |
| 862 | 862 | if (!empty($extra_fields)) {
|
| 863 | 863 | |
| 864 | 864 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 865 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 865 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL"; |
|
| 866 | 866 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 867 | 867 | if ($default_value != '') {
|
| 868 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 868 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 871 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 872 | 872 | //$wpdb->query($meta_field_add); |
| 873 | 873 | } |
| 874 | 874 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 875 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 875 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL"; |
|
| 876 | 876 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 877 | 877 | if ($default_value != '') {
|
| 878 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 878 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 881 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 882 | 882 | //$wpdb->query($meta_field_add); |
| 883 | 883 | } |
| 884 | 884 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 885 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 885 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL"; |
|
| 886 | 886 | |
| 887 | 887 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 888 | 888 | if ($default_value != '') {
|
| 889 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 889 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 890 | 890 | } |
| 891 | 891 | |
| 892 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 892 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 893 | 893 | //$wpdb->query($meta_field_add); |
| 894 | 894 | } |
| 895 | 895 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 896 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 896 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL"; |
|
| 897 | 897 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 898 | 898 | if ($default_value != '') {
|
| 899 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 899 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 902 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 903 | 903 | //$wpdb->query($meta_field_add); |
| 904 | 904 | } |
| 905 | 905 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 906 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 906 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 907 | 907 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 908 | 908 | if ($default_value != '') {
|
| 909 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 909 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 912 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 913 | 913 | //$wpdb->query($meta_field_add); |
| 914 | 914 | |
| 915 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 915 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 916 | 916 | |
| 917 | 917 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 918 | 918 | if ($default_value != '') {
|
| 919 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 919 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 922 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 923 | 923 | |
| 924 | 924 | //$wpdb->query($meta_field_add); |
| 925 | 925 | } |
| 926 | 926 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 927 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 927 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 928 | 928 | |
| 929 | 929 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 930 | 930 | if ($default_value != '') {
|
| 931 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 931 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 934 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 935 | 935 | |
| 936 | 936 | //$wpdb->query($meta_field_add); |
| 937 | 937 | } |
| 938 | 938 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 939 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 939 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 940 | 940 | |
| 941 | 941 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 942 | 942 | if ($default_value != '') {
|
| 943 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 943 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 946 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 947 | 947 | |
| 948 | 948 | //$wpdb->query($meta_field_add); |
| 949 | 949 | } |
| 950 | 950 | // show lat lng |
| 951 | 951 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 952 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 952 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 953 | 953 | |
| 954 | 954 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 955 | 955 | $meta_field_add .= " DEFAULT '1'"; |
| 956 | 956 | |
| 957 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 957 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 958 | 958 | //$wpdb->query($meta_field_add); |
| 959 | 959 | } |
| 960 | 960 | } |
@@ -964,8 +964,8 @@ discard block |
||
| 964 | 964 | case 'checkbox': |
| 965 | 965 | $data_type = 'TINYINT'; |
| 966 | 966 | |
| 967 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 968 | - if ((int)$default_value === 1) {
|
|
| 967 | + $meta_field_add = $data_type."( 1 ) NOT NULL "; |
|
| 968 | + if ((int) $default_value === 1) {
|
|
| 969 | 969 | $meta_field_add .= " DEFAULT '1'"; |
| 970 | 970 | } |
| 971 | 971 | |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | } |
| 999 | 999 | } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
| 1000 | 1000 | if (strlen($option_values)) {
|
| 1001 | - $op_size = strlen($option_values); |
|
| 1001 | + $op_size = strlen($option_values); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | if (isset($request_field['multi_display_type'])) {
|
@@ -1006,9 +1006,9 @@ discard block |
||
| 1006 | 1006 | } |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1009 | + $meta_field_add = $data_type."( $op_size ) NULL "; |
|
| 1010 | 1010 | if ($default_value != '') {
|
| 1011 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1011 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
@@ -1023,9 +1023,9 @@ discard block |
||
| 1023 | 1023 | |
| 1024 | 1024 | $data_type = 'TEXT'; |
| 1025 | 1025 | |
| 1026 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1026 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1027 | 1027 | |
| 1028 | - $meta_field_add = $data_type . " NULL "; |
|
| 1028 | + $meta_field_add = $data_type." NULL "; |
|
| 1029 | 1029 | /*if($default_value != '') |
| 1030 | 1030 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1031 | 1031 | |
@@ -1040,9 +1040,9 @@ discard block |
||
| 1040 | 1040 | |
| 1041 | 1041 | $data_type = 'DATE'; |
| 1042 | 1042 | |
| 1043 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1043 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1044 | 1044 | |
| 1045 | - $meta_field_add = $data_type . " NULL "; |
|
| 1045 | + $meta_field_add = $data_type." NULL "; |
|
| 1046 | 1046 | |
| 1047 | 1047 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1048 | 1048 | if ($add_result === false) {
|
@@ -1055,9 +1055,9 @@ discard block |
||
| 1055 | 1055 | |
| 1056 | 1056 | $data_type = 'TIME'; |
| 1057 | 1057 | |
| 1058 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1058 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1059 | 1059 | |
| 1060 | - $meta_field_add = $data_type . " NULL "; |
|
| 1060 | + $meta_field_add = $data_type." NULL "; |
|
| 1061 | 1061 | |
| 1062 | 1062 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1063 | 1063 | if ($add_result === false) {
|
@@ -1069,22 +1069,22 @@ discard block |
||
| 1069 | 1069 | default: |
| 1070 | 1070 | |
| 1071 | 1071 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 1072 | - $meta_field_add = $data_type . " NULL "; |
|
| 1072 | + $meta_field_add = $data_type." NULL "; |
|
| 1073 | 1073 | |
| 1074 | 1074 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 1075 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1075 | + $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL "; |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | if (is_numeric($default_value) && $default_value != '') {
|
| 1079 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1079 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1080 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | } else {
|
| 1083 | 1083 | $meta_field_add = " VARCHAR( 254 ) NULL "; |
| 1084 | 1084 | |
| 1085 | 1085 | if ($default_value != '') {
|
| 1086 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1086 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1087 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | } |
| 1090 | 1090 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | $wpdb->prepare( |
| 1108 | 1108 | |
| 1109 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1109 | + "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1110 | 1110 | post_type = %s, |
| 1111 | 1111 | admin_title = %s, |
| 1112 | 1112 | site_title = %s, |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | validation_msg = %s, |
| 1140 | 1140 | for_admin_use = %s ", |
| 1141 | 1141 | |
| 1142 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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) |
|
| 1142 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $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_in, $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) |
|
| 1143 | 1143 | |
| 1144 | 1144 | ) |
| 1145 | 1145 | |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | |
| 1152 | 1152 | } |
| 1153 | 1153 | |
| 1154 | - return (int)$lastid; |
|
| 1154 | + return (int) $lastid; |
|
| 1155 | 1155 | |
| 1156 | 1156 | |
| 1157 | 1157 | } else {
|
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | |
| 1185 | 1185 | $post_meta_info = $wpdb->query( |
| 1186 | 1186 | $wpdb->prepare( |
| 1187 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1187 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1188 | 1188 | sort_order=%d |
| 1189 | 1189 | where id= %d", |
| 1190 | 1190 | array($count, $cf) |
@@ -1200,11 +1200,11 @@ discard block |
||
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | |
| 1203 | -function geodir_get_cf_value($cf){
|
|
| 1203 | +function geodir_get_cf_value($cf) {
|
|
| 1204 | 1204 | global $gd_session; |
| 1205 | 1205 | $value = ''; |
| 1206 | 1206 | if (is_admin()) {
|
| 1207 | - global $post,$gd_session; |
|
| 1207 | + global $post, $gd_session; |
|
| 1208 | 1208 | |
| 1209 | 1209 | if (isset($_REQUEST['post'])) |
| 1210 | 1210 | $_REQUEST['pid'] = $_REQUEST['post']; |
@@ -1246,16 +1246,16 @@ discard block |
||
| 1246 | 1246 | $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
| 1247 | 1247 | |
| 1248 | 1248 | foreach ($custom_fields as $key => $val) {
|
| 1249 | - if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
|
|
| 1249 | + if (isset($val['extra_fields'])) {$extra_fields = $val['extra_fields']; }
|
|
| 1250 | 1250 | $val = stripslashes_deep($val); // strip slashes from labels |
| 1251 | - if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
|
|
| 1251 | + if (isset($val['extra_fields'])) {$val['extra_fields'] = $extra_fields; }
|
|
| 1252 | 1252 | |
| 1253 | 1253 | $name = $val['name']; |
| 1254 | 1254 | $type = $val['type']; |
| 1255 | 1255 | $is_default = $val['is_default']; |
| 1256 | 1256 | |
| 1257 | 1257 | /* field available to site admin only for edit */ |
| 1258 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1258 | + $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; |
|
| 1259 | 1259 | if ($for_admin_use && !is_super_admin()) {
|
| 1260 | 1260 | continue; |
| 1261 | 1261 | } |
@@ -1280,11 +1280,11 @@ discard block |
||
| 1280 | 1280 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1281 | 1281 | * @see 'geodir_after_custom_form_field_$name' |
| 1282 | 1282 | */ |
| 1283 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1283 | + do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1284 | 1284 | |
| 1285 | 1285 | |
| 1286 | 1286 | $custom_field = $val; |
| 1287 | - $html =''; |
|
| 1287 | + $html = ''; |
|
| 1288 | 1288 | /** |
| 1289 | 1289 | * Filter the output for custom fields. |
| 1290 | 1290 | * |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | * @param string $html The html to be filtered (blank). |
| 1294 | 1294 | * @param array $custom_field The custom field array values. |
| 1295 | 1295 | */ |
| 1296 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1296 | + echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
|
|
| 1297 | 1297 | |
| 1298 | 1298 | |
| 1299 | 1299 | |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1309 | 1309 | * @see 'geodir_before_custom_form_field_$name' |
| 1310 | 1310 | */ |
| 1311 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1311 | + do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1312 | 1312 | |
| 1313 | 1313 | } |
| 1314 | 1314 | |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | |
| 1335 | 1335 | $filter = $wpdb->get_row( |
| 1336 | 1336 | $wpdb->prepare( |
| 1337 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1337 | + "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'", |
|
| 1338 | 1338 | array($geodir_post_type) |
| 1339 | 1339 | ) |
| 1340 | 1340 | ); |
@@ -1349,14 +1349,14 @@ discard block |
||
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | -function geodir_field_icon_proccess($cf){
|
|
| 1352 | +function geodir_field_icon_proccess($cf) {
|
|
| 1353 | 1353 | |
| 1354 | 1354 | |
| 1355 | 1355 | if (strpos($cf['field_icon'], 'http') !== false) {
|
| 1356 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1356 | + $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1357 | 1357 | } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
| 1358 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1359 | - }else{
|
|
| 1358 | + $field_icon = '<i class="'.$cf['field_icon'].'"></i>'; |
|
| 1359 | + } else {
|
|
| 1360 | 1360 | $field_icon = $cf['field_icon']; |
| 1361 | 1361 | } |
| 1362 | 1362 | |
@@ -1401,14 +1401,14 @@ discard block |
||
| 1401 | 1401 | |
| 1402 | 1402 | |
| 1403 | 1403 | foreach ($fields_info as $type) {
|
| 1404 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 1404 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
|
|
| 1405 | 1405 | $type = stripslashes_deep($type); // strip slashes |
| 1406 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 1406 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
|
|
| 1407 | 1407 | $html = ''; |
| 1408 | 1408 | $field_icon = geodir_field_icon_proccess($type); |
| 1409 | 1409 | $filed_type = $type['type']; |
| 1410 | 1410 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
| 1411 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 1411 | + if ($html_var == 'post') {$html_var = 'post_address'; }
|
|
| 1412 | 1412 | |
| 1413 | 1413 | /** |
| 1414 | 1414 | * Filter the output for custom fields. |
@@ -1419,7 +1419,7 @@ discard block |
||
| 1419 | 1419 | * @param string $fields_location The location the field is to be show. |
| 1420 | 1420 | * @param array $type The array of field values. |
| 1421 | 1421 | */ |
| 1422 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1422 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
|
|
| 1423 | 1423 | |
| 1424 | 1424 | $variables_array = array(); |
| 1425 | 1425 | |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | * @param string $fields_location The location the fields are being output. |
| 1480 | 1480 | * @since 1.6.9 |
| 1481 | 1481 | */ |
| 1482 | - return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1482 | + return apply_filters('geodir_show_listing_info', $html, $fields_location);
|
|
| 1483 | 1483 | |
| 1484 | 1484 | } |
| 1485 | 1485 | } |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | |
| 1555 | 1555 | $post_type = get_post_type($post_id); |
| 1556 | 1556 | //echo $field_id; exit; |
| 1557 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1557 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1558 | 1558 | |
| 1559 | 1559 | $postcurr_images = array(); |
| 1560 | 1560 | $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
@@ -1573,13 +1573,13 @@ discard block |
||
| 1573 | 1573 | $geodir_uploadurl = $uploads['url']; |
| 1574 | 1574 | $sub_dir = $uploads['subdir']; |
| 1575 | 1575 | |
| 1576 | - $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'] : '';
|
|
| 1576 | + $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'] : '';
|
|
| 1577 | 1577 | |
| 1578 | 1578 | for ($m = 0; $m < count($post_image); $m++) {
|
| 1579 | 1579 | |
| 1580 | 1580 | /* --------- start ------- */ |
| 1581 | 1581 | |
| 1582 | - 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)))) {
|
|
| 1582 | + 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)))) {
|
|
| 1583 | 1583 | |
| 1584 | 1584 | |
| 1585 | 1585 | $curr_img_url = $post_image[$m]; |
@@ -1605,24 +1605,24 @@ discard block |
||
| 1605 | 1605 | //$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');
|
| 1606 | 1606 | |
| 1607 | 1607 | if (!function_exists('wp_handle_upload'))
|
| 1608 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1608 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1609 | 1609 | |
| 1610 | 1610 | if (!is_dir($geodir_uploadpath)) |
| 1611 | 1611 | mkdir($geodir_uploadpath); |
| 1612 | 1612 | |
| 1613 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1613 | + $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1]; |
|
| 1614 | 1614 | $explode_sub_dir = explode("/", $sub_dir);
|
| 1615 | 1615 | if ($curr_img_dir == end($explode_sub_dir)) {
|
| 1616 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1617 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1616 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1617 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1618 | 1618 | } else {
|
| 1619 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1620 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1619 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1620 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | $uploaded_file = ''; |
| 1624 | 1624 | if (file_exists($img_path)) |
| 1625 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1625 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1626 | 1626 | |
| 1627 | 1627 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 1628 | 1628 | if (file_exists($img_path)) |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | if (!empty($uploaded_file)) |
| 1633 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1633 | + $file_urls = $geodir_uploadurl.'/'.$new_name; |
|
| 1634 | 1634 | |
| 1635 | 1635 | } else {
|
| 1636 | 1636 | $file_urls = $post_image[$m]; |
@@ -1644,8 +1644,8 @@ discard block |
||
| 1644 | 1644 | if (!empty($postcurr_images)) {
|
| 1645 | 1645 | |
| 1646 | 1646 | if ($file_urls != $postcurr_images) {
|
| 1647 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1648 | - $invalid_files = (object)$invalid_files; |
|
| 1647 | + $invalid_files[] = (object) array('src' => $postcurr_images);
|
|
| 1648 | + $invalid_files = (object) $invalid_files; |
|
| 1649 | 1649 | } |
| 1650 | 1650 | } |
| 1651 | 1651 | |
@@ -1697,9 +1697,9 @@ discard block |
||
| 1697 | 1697 | function geodir_upload_dir($upload) |
| 1698 | 1698 | {
|
| 1699 | 1699 | global $current_user; |
| 1700 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1701 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1702 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1700 | + $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID; |
|
| 1701 | + $upload['path'] = $upload['basedir'].$upload['subdir']; |
|
| 1702 | + $upload['url'] = $upload['baseurl'].$upload['subdir']; |
|
| 1703 | 1703 | return $upload; |
| 1704 | 1704 | } |
| 1705 | 1705 | |
@@ -1714,20 +1714,20 @@ discard block |
||
| 1714 | 1714 | // check ajax nonce |
| 1715 | 1715 | $imgid = $_POST["imgid"]; |
| 1716 | 1716 | |
| 1717 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1717 | + check_ajax_referer($imgid.'pluploadan'); |
|
| 1718 | 1718 | |
| 1719 | 1719 | // handle custom file uploaddir |
| 1720 | 1720 | add_filter('upload_dir', 'geodir_upload_dir');
|
| 1721 | 1721 | |
| 1722 | 1722 | // change file orientation if needed |
| 1723 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1723 | + $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']); |
|
| 1724 | 1724 | |
| 1725 | 1725 | // handle file upload |
| 1726 | 1726 | $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
| 1727 | 1727 | // remove handle custom file uploaddir |
| 1728 | 1728 | remove_filter('upload_dir', 'geodir_upload_dir');
|
| 1729 | 1729 | |
| 1730 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1730 | + if (!isset($status['url']) && isset($status['error'])) {
|
|
| 1731 | 1731 | print_r($status); |
| 1732 | 1732 | } |
| 1733 | 1733 | |
@@ -1757,9 +1757,9 @@ discard block |
||
| 1757 | 1757 | |
| 1758 | 1758 | $post_type = get_post_type($post_id); |
| 1759 | 1759 | |
| 1760 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1760 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1761 | 1761 | |
| 1762 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1762 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1763 | 1763 | |
| 1764 | 1764 | if ($results) {
|
| 1765 | 1765 | return $results[0]->geodir_video; |
@@ -1783,9 +1783,9 @@ discard block |
||
| 1783 | 1783 | |
| 1784 | 1784 | $post_type = get_post_type($post_id); |
| 1785 | 1785 | |
| 1786 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1786 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1787 | 1787 | |
| 1788 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1788 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1789 | 1789 | |
| 1790 | 1790 | if ($results) {
|
| 1791 | 1791 | return $results[0]->geodir_special_offers; |
@@ -1803,12 +1803,12 @@ discard block |
||
| 1803 | 1803 | */ |
| 1804 | 1804 | function geodir_max_upload_size() |
| 1805 | 1805 | {
|
| 1806 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1806 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 1807 | 1807 | |
| 1808 | 1808 | if ($max_filesize > 0 && $max_filesize < 1) {
|
| 1809 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1809 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 1810 | 1810 | } else {
|
| 1811 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1811 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 1812 | 1812 | } |
| 1813 | 1813 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 1814 | 1814 | return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
@@ -1840,7 +1840,7 @@ discard block |
||
| 1840 | 1840 | |
| 1841 | 1841 | $custom_fields = $wpdb->get_results( |
| 1842 | 1842 | $wpdb->prepare( |
| 1843 | - "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon 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", |
|
| 1843 | + "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon 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", |
|
| 1844 | 1844 | array($post_type) |
| 1845 | 1845 | ), 'ARRAY_A' |
| 1846 | 1846 | ); |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | |
| 1968 | 1968 | $post_meta_info = $wpdb->query( |
| 1969 | 1969 | $wpdb->prepare( |
| 1970 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1970 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 1971 | 1971 | sort_order=%d |
| 1972 | 1972 | where id= %d", |
| 1973 | 1973 | array($count, $cf) |
@@ -2049,14 +2049,14 @@ discard block |
||
| 2049 | 2049 | |
| 2050 | 2050 | $check_html_variable = $wpdb->get_var( |
| 2051 | 2051 | $wpdb->prepare( |
| 2052 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2052 | + "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2053 | 2053 | array($cehhtmlvar_name, $post_type, $field_type) |
| 2054 | 2054 | ) |
| 2055 | 2055 | ); |
| 2056 | 2056 | |
| 2057 | 2057 | if ($is_default == 1) {
|
| 2058 | 2058 | |
| 2059 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2059 | + $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2060 | 2060 | |
| 2061 | 2061 | } |
| 2062 | 2062 | |
@@ -2067,7 +2067,7 @@ discard block |
||
| 2067 | 2067 | |
| 2068 | 2068 | $wpdb->prepare( |
| 2069 | 2069 | |
| 2070 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2070 | + "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2071 | 2071 | post_type = %s, |
| 2072 | 2072 | data_type = %s, |
| 2073 | 2073 | field_type = %s, |
@@ -2098,7 +2098,7 @@ discard block |
||
| 2098 | 2098 | |
| 2099 | 2099 | $wpdb->prepare( |
| 2100 | 2100 | |
| 2101 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2101 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2102 | 2102 | post_type = %s, |
| 2103 | 2103 | data_type = %s, |
| 2104 | 2104 | field_type = %s, |
@@ -2124,7 +2124,7 @@ discard block |
||
| 2124 | 2124 | } |
| 2125 | 2125 | |
| 2126 | 2126 | |
| 2127 | - return (int)$lastid; |
|
| 2127 | + return (int) $lastid; |
|
| 2128 | 2128 | |
| 2129 | 2129 | } |
| 2130 | 2130 | } |
@@ -2147,7 +2147,7 @@ discard block |
||
| 2147 | 2147 | if ($field_id != '') {
|
| 2148 | 2148 | $cf = trim($field_id, '_'); |
| 2149 | 2149 | |
| 2150 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2150 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 2151 | 2151 | |
| 2152 | 2152 | return $field_id; |
| 2153 | 2153 | |
@@ -2170,12 +2170,12 @@ discard block |
||
| 2170 | 2170 | * @param string $field_ins_upd When set to "submit" displays form. |
| 2171 | 2171 | * @param bool $default when set to true field will be for admin use only. |
| 2172 | 2172 | */ |
| 2173 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2173 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 2174 | 2174 | {
|
| 2175 | 2175 | global $wpdb; |
| 2176 | 2176 | $cf = $result_str; |
| 2177 | 2177 | if (!is_object($cf)) {
|
| 2178 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2178 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
|
|
| 2179 | 2179 | } else {
|
| 2180 | 2180 | $field_info = $cf; |
| 2181 | 2181 | $result_str = $cf->id; |
@@ -2211,18 +2211,18 @@ discard block |
||
| 2211 | 2211 | if ($htmlvar_name == '') |
| 2212 | 2212 | $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
| 2213 | 2213 | |
| 2214 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2214 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 2215 | 2215 | |
| 2216 | 2216 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 2217 | 2217 | $cso_arr = geodir_get_custom_sort_options($post_type); |
| 2218 | 2218 | |
| 2219 | 2219 | $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
| 2220 | - foreach($cso_arr as $cso){
|
|
| 2221 | - if($cur_field_type==$cso['field_type']){
|
|
| 2220 | + foreach ($cso_arr as $cso) {
|
|
| 2221 | + if ($cur_field_type == $cso['field_type']) {
|
|
| 2222 | 2222 | |
| 2223 | 2223 | if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
| 2224 | 2224 | $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
| 2225 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2225 | + }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
|
|
| 2226 | 2226 | $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
| 2227 | 2227 | } |
| 2228 | 2228 | |
@@ -2232,40 +2232,40 @@ discard block |
||
| 2232 | 2232 | $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
| 2233 | 2233 | ?> |
| 2234 | 2234 | |
| 2235 | - <li class="text" id="licontainer_<?php echo $result_str;?>"> |
|
| 2235 | + <li class="text" id="licontainer_<?php echo $result_str; ?>"> |
|
| 2236 | 2236 | <form><!-- we need to wrap in a form so we can use radio buttons with same name --> |
| 2237 | - <div class="title title<?php echo $result_str;?> gt-fieldset" |
|
| 2238 | - title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
|
| 2239 | - ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
|
| 2237 | + <div class="title title<?php echo $result_str; ?> gt-fieldset" |
|
| 2238 | + title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
|
|
| 2239 | + ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
|
| 2240 | 2240 | <?php |
| 2241 | 2241 | |
| 2242 | 2242 | ?> |
| 2243 | 2243 | |
| 2244 | - <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
|
| 2245 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2244 | + <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 2245 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2246 | 2246 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 2247 | 2247 | |
| 2248 | 2248 | |
| 2249 | - <?php echo $field_icon;?> |
|
| 2249 | + <?php echo $field_icon; ?> |
|
| 2250 | 2250 | <b style="cursor:pointer;" |
| 2251 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
|
|
| 2251 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
|
|
| 2252 | 2252 | |
| 2253 | 2253 | </div> |
| 2254 | 2254 | |
| 2255 | - <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
|
| 2255 | + <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
|
| 2256 | 2256 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2257 | 2257 | echo 'block;'; |
| 2258 | 2258 | } else {
|
| 2259 | 2259 | echo 'none;'; |
| 2260 | 2260 | } ?>"> |
| 2261 | 2261 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2262 | - <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
|
| 2263 | - <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
|
| 2264 | - <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
|
| 2262 | + <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
|
| 2263 | + <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
|
| 2264 | + <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/> |
|
| 2265 | 2265 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2266 | 2266 | echo $field_info->data_type; |
| 2267 | 2267 | }?>"/> |
| 2268 | - <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
|
| 2268 | + <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/> |
|
| 2269 | 2269 | |
| 2270 | 2270 | |
| 2271 | 2271 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
@@ -2275,7 +2275,7 @@ discard block |
||
| 2275 | 2275 | <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/> |
| 2276 | 2276 | |
| 2277 | 2277 | <li> |
| 2278 | - <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?> |
|
| 2278 | + <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?> |
|
| 2279 | 2279 | |
| 2280 | 2280 | <label for="asc" class="gd-cf-tooltip-wrap"> |
| 2281 | 2281 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
|
@@ -2285,24 +2285,24 @@ discard block |
||
| 2285 | 2285 | </label> |
| 2286 | 2286 | <div class="gd-cf-input-wrap gd-switch"> |
| 2287 | 2287 | |
| 2288 | - <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled" value="1" |
|
| 2288 | + <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled" value="1" |
|
| 2289 | 2289 | <?php if ($value == '1') {
|
| 2290 | 2290 | echo 'checked'; |
| 2291 | 2291 | } ?>/> |
| 2292 | - <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2292 | + <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2293 | 2293 | |
| 2294 | - <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0" |
|
| 2294 | + <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0" |
|
| 2295 | 2295 | <?php if ($value == '0' || !$value) {
|
| 2296 | 2296 | echo 'checked'; |
| 2297 | 2297 | } ?>/> |
| 2298 | - <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2298 | + <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2299 | 2299 | |
| 2300 | 2300 | </div> |
| 2301 | 2301 | |
| 2302 | 2302 | </li> |
| 2303 | 2303 | |
| 2304 | - <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
|
|
| 2305 | - <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?> |
|
| 2304 | + <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
|
|
| 2305 | + <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?> |
|
| 2306 | 2306 | |
| 2307 | 2307 | <label for="asc_title" class="gd-cf-tooltip-wrap"> |
| 2308 | 2308 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
|
@@ -2312,14 +2312,14 @@ discard block |
||
| 2312 | 2312 | </label> |
| 2313 | 2313 | <div class="gd-cf-input-wrap"> |
| 2314 | 2314 | |
| 2315 | - <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" /> |
|
| 2315 | + <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" /> |
|
| 2316 | 2316 | </div> |
| 2317 | 2317 | |
| 2318 | 2318 | |
| 2319 | 2319 | </li> |
| 2320 | 2320 | |
| 2321 | 2321 | |
| 2322 | - <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
|
|
| 2322 | + <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
|
|
| 2323 | 2323 | |
| 2324 | 2324 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2325 | 2325 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2330,7 +2330,7 @@ discard block |
||
| 2330 | 2330 | <div class="gd-cf-input-wrap"> |
| 2331 | 2331 | |
| 2332 | 2332 | <input type="radio" name="is_default" |
| 2333 | - value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
|
| 2333 | + value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
|
|
| 2334 | 2334 | echo 'checked="checked"'; |
| 2335 | 2335 | } ?>/> |
| 2336 | 2336 | </div> |
@@ -2340,7 +2340,7 @@ discard block |
||
| 2340 | 2340 | |
| 2341 | 2341 | |
| 2342 | 2342 | <li> |
| 2343 | - <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?> |
|
| 2343 | + <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?> |
|
| 2344 | 2344 | |
| 2345 | 2345 | <label for="desc" class="gd-cf-tooltip-wrap"> |
| 2346 | 2346 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
|
@@ -2350,24 +2350,24 @@ discard block |
||
| 2350 | 2350 | </label> |
| 2351 | 2351 | <div class="gd-cf-input-wrap gd-switch"> |
| 2352 | 2352 | |
| 2353 | - <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled" value="1" |
|
| 2353 | + <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled" value="1" |
|
| 2354 | 2354 | <?php if ($value == '1') {
|
| 2355 | 2355 | echo 'checked'; |
| 2356 | 2356 | } ?>/> |
| 2357 | - <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2357 | + <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2358 | 2358 | |
| 2359 | - <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0" |
|
| 2359 | + <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0" |
|
| 2360 | 2360 | <?php if ($value == '0' || !$value) {
|
| 2361 | 2361 | echo 'checked'; |
| 2362 | 2362 | } ?>/> |
| 2363 | - <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2363 | + <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2364 | 2364 | |
| 2365 | 2365 | </div> |
| 2366 | 2366 | |
| 2367 | 2367 | </li> |
| 2368 | 2368 | |
| 2369 | - <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
|
|
| 2370 | - <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?> |
|
| 2369 | + <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
|
|
| 2370 | + <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?> |
|
| 2371 | 2371 | |
| 2372 | 2372 | <label for="desc_title" class="gd-cf-tooltip-wrap"> |
| 2373 | 2373 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
|
@@ -2377,13 +2377,13 @@ discard block |
||
| 2377 | 2377 | </label> |
| 2378 | 2378 | <div class="gd-cf-input-wrap"> |
| 2379 | 2379 | |
| 2380 | - <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" /> |
|
| 2380 | + <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" /> |
|
| 2381 | 2381 | </div> |
| 2382 | 2382 | |
| 2383 | 2383 | |
| 2384 | 2384 | </li> |
| 2385 | 2385 | |
| 2386 | - <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
|
|
| 2386 | + <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
|
|
| 2387 | 2387 | |
| 2388 | 2388 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2389 | 2389 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2394,7 +2394,7 @@ discard block |
||
| 2394 | 2394 | <div class="gd-cf-input-wrap"> |
| 2395 | 2395 | |
| 2396 | 2396 | <input type="radio" name="is_default" |
| 2397 | - value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
|
| 2397 | + value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
|
|
| 2398 | 2398 | echo 'checked="checked"'; |
| 2399 | 2399 | } ?>/> |
| 2400 | 2400 | </div> |
@@ -2419,14 +2419,14 @@ discard block |
||
| 2419 | 2419 | </label> |
| 2420 | 2420 | <div class="gd-cf-input-wrap"> |
| 2421 | 2421 | |
| 2422 | - <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" /> |
|
| 2422 | + <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" /> |
|
| 2423 | 2423 | </div> |
| 2424 | 2424 | |
| 2425 | 2425 | |
| 2426 | 2426 | </li> |
| 2427 | 2427 | |
| 2428 | 2428 | <li> |
| 2429 | - <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?> |
|
| 2429 | + <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?> |
|
| 2430 | 2430 | |
| 2431 | 2431 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2432 | 2432 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2450,7 +2450,7 @@ discard block |
||
| 2450 | 2450 | |
| 2451 | 2451 | |
| 2452 | 2452 | <li> |
| 2453 | - <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?> |
|
| 2453 | + <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?> |
|
| 2454 | 2454 | |
| 2455 | 2455 | <label for="is_active" class="gd-cf-tooltip-wrap"> |
| 2456 | 2456 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
|
@@ -2460,17 +2460,17 @@ discard block |
||
| 2460 | 2460 | </label> |
| 2461 | 2461 | <div class="gd-cf-input-wrap gd-switch"> |
| 2462 | 2462 | |
| 2463 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2463 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2464 | 2464 | <?php if ($value == '1') {
|
| 2465 | 2465 | echo 'checked'; |
| 2466 | 2466 | } ?>/> |
| 2467 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2467 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2468 | 2468 | |
| 2469 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2469 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2470 | 2470 | <?php if ($value == '0' || !$value) {
|
| 2471 | 2471 | echo 'checked'; |
| 2472 | 2472 | } ?>/> |
| 2473 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2473 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2474 | 2474 | |
| 2475 | 2475 | </div> |
| 2476 | 2476 | |
@@ -2491,10 +2491,10 @@ discard block |
||
| 2491 | 2491 | <h3></h3> |
| 2492 | 2492 | </label> |
| 2493 | 2493 | <div class="gd-cf-input-wrap"> |
| 2494 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 2494 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 2495 | 2495 | onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 2496 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 2497 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2496 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 2497 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2498 | 2498 | class="button"/></a> |
| 2499 | 2499 | </div> |
| 2500 | 2500 | </li> |
@@ -2529,7 +2529,7 @@ discard block |
||
| 2529 | 2529 | if (!$package_id || !$field_name || !$post_type) {
|
| 2530 | 2530 | return true; |
| 2531 | 2531 | } |
| 2532 | - $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));
|
|
| 2532 | + $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));
|
|
| 2533 | 2533 | |
| 2534 | 2534 | if ($wpdb->get_var($sql)) {
|
| 2535 | 2535 | return true; |
@@ -2652,13 +2652,13 @@ discard block |
||
| 2652 | 2652 | } |
| 2653 | 2653 | |
| 2654 | 2654 | |
| 2655 | -function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
|
| 2655 | +function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
|
|
| 2656 | 2656 | ob_start(); |
| 2657 | 2657 | |
| 2658 | 2658 | $dt_value = ''; |
| 2659 | 2659 | if (isset($field_info->data_type)) {
|
| 2660 | 2660 | $dt_value = esc_attr($field_info->data_type); |
| 2661 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2661 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 2662 | 2662 | $dt_value = $cf['defaults']['data_type']; |
| 2663 | 2663 | } |
| 2664 | 2664 | ?> |
@@ -2669,15 +2669,15 @@ discard block |
||
| 2669 | 2669 | <select name="data_type" id="data_type" |
| 2670 | 2670 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2671 | 2671 | <option |
| 2672 | - value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2672 | + value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2673 | 2673 | echo 'selected="selected"'; |
| 2674 | 2674 | } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
| 2675 | 2675 | <option |
| 2676 | - value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2676 | + value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2677 | 2677 | echo 'selected="selected"'; |
| 2678 | 2678 | } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
| 2679 | 2679 | <option |
| 2680 | - value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2680 | + value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2681 | 2681 | echo 'selected="selected"'; |
| 2682 | 2682 | } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
| 2683 | 2683 | </select> |
@@ -2690,13 +2690,13 @@ discard block |
||
| 2690 | 2690 | $value = ''; |
| 2691 | 2691 | if (isset($field_info->decimal_point)) {
|
| 2692 | 2692 | $value = esc_attr($field_info->decimal_point); |
| 2693 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2693 | + }elseif (isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']) {
|
|
| 2694 | 2694 | $value = $cf['defaults']['decimal_point']; |
| 2695 | 2695 | } |
| 2696 | 2696 | ?> |
| 2697 | 2697 | |
| 2698 | 2698 | <li class="decimal-point-wrapper" |
| 2699 | - style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2699 | + style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2700 | 2700 | <label for="decimal_point"><?php _e('Select decimal point :', 'geodirectory'); ?></label>
|
| 2701 | 2701 | <div class="gd-cf-input-wrap"> |
| 2702 | 2702 | <select name="decimal_point" id="decimal_point"> |
@@ -2714,41 +2714,41 @@ discard block |
||
| 2714 | 2714 | $output = ob_get_clean(); |
| 2715 | 2715 | return $output; |
| 2716 | 2716 | } |
| 2717 | -add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
|
| 2717 | +add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
|
|
| 2718 | 2718 | |
| 2719 | 2719 | // htmlvar not needed for fieldset and taxonomy |
| 2720 | -add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
|
|
| 2721 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
|
|
| 2720 | +add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
|
|
| 2721 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2722 | 2722 | |
| 2723 | 2723 | |
| 2724 | 2724 | // default_value not needed for textarea, html, file, fieldset, taxonomy, address |
| 2725 | -add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
|
|
| 2726 | -add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
|
|
| 2727 | -add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
|
|
| 2728 | -add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
|
|
| 2725 | +add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
|
|
| 2726 | +add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2727 | +add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
|
|
| 2728 | +add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
|
|
| 2729 | 2729 | |
| 2730 | 2730 | // is_required not needed for fieldset |
| 2731 | -add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
|
|
| 2732 | -add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
|
|
| 2731 | +add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
|
|
| 2732 | +add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
|
|
| 2733 | 2733 | |
| 2734 | 2734 | // field_icon not needed for fieldset |
| 2735 | -add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
|
|
| 2736 | -add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
|
|
| 2735 | +add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
|
|
| 2736 | +add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
|
|
| 2737 | 2737 | |
| 2738 | 2738 | // cat_sort not needed for some fields |
| 2739 | -add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
|
|
| 2740 | -add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
|
|
| 2741 | -add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
|
|
| 2742 | -add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
|
|
| 2743 | -add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
|
|
| 2744 | -add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
|
|
| 2745 | -add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
|
|
| 2746 | -add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
|
|
| 2739 | +add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
|
|
| 2740 | +add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
|
|
| 2741 | +add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
|
|
| 2742 | +add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
|
|
| 2743 | +add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
|
|
| 2744 | +add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
|
|
| 2745 | +add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2746 | +add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
|
|
| 2747 | 2747 | |
| 2748 | 2748 | |
| 2749 | 2749 | |
| 2750 | -function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
|
| 2751 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2750 | +function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
|
|
| 2751 | + if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
|
|
| 2752 | 2752 | ob_start(); |
| 2753 | 2753 | ?> |
| 2754 | 2754 | <li> |
@@ -2779,16 +2779,16 @@ discard block |
||
| 2779 | 2779 | $output = ob_get_clean(); |
| 2780 | 2780 | return $output; |
| 2781 | 2781 | } |
| 2782 | -add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
|
| 2782 | +add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
|
|
| 2783 | 2783 | |
| 2784 | 2784 | |
| 2785 | -function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
|
| 2785 | +function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
|
|
| 2786 | 2786 | ob_start(); |
| 2787 | 2787 | |
| 2788 | 2788 | $value = ''; |
| 2789 | 2789 | if (isset($field_info->validation_pattern)) {
|
| 2790 | 2790 | $value = esc_attr($field_info->validation_pattern); |
| 2791 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2791 | + }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
|
|
| 2792 | 2792 | $value = esc_attr($cf['defaults']['validation_pattern']); |
| 2793 | 2793 | } |
| 2794 | 2794 | ?> |
@@ -2808,7 +2808,7 @@ discard block |
||
| 2808 | 2808 | $value = ''; |
| 2809 | 2809 | if (isset($field_info->validation_msg)) {
|
| 2810 | 2810 | $value = esc_attr($field_info->validation_msg); |
| 2811 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2811 | + }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
|
|
| 2812 | 2812 | $value = esc_attr($cf['defaults']['validation_msg']); |
| 2813 | 2813 | } |
| 2814 | 2814 | ?> |
@@ -2829,10 +2829,10 @@ discard block |
||
| 2829 | 2829 | $output = ob_get_clean(); |
| 2830 | 2830 | return $output; |
| 2831 | 2831 | } |
| 2832 | -add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
|
| 2832 | +add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
|
|
| 2833 | 2833 | |
| 2834 | 2834 | |
| 2835 | -function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
|
| 2835 | +function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
|
|
| 2836 | 2836 | ob_start(); |
| 2837 | 2837 | global $post_type; |
| 2838 | 2838 | |
@@ -2857,7 +2857,7 @@ discard block |
||
| 2857 | 2857 | ?> |
| 2858 | 2858 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2859 | 2859 | echo 'selected="selected"'; |
| 2860 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2860 | + }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php |
|
| 2861 | 2861 | } |
| 2862 | 2862 | ?> |
| 2863 | 2863 | </select> |
@@ -2868,7 +2868,7 @@ discard block |
||
| 2868 | 2868 | <label for="cat_display_type" class="gd-cf-tooltip-wrap"> |
| 2869 | 2869 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
|
| 2870 | 2870 | <div class="gdcf-tooltip"> |
| 2871 | - <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
|
|
| 2871 | + <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
|
|
| 2872 | 2872 | </div> |
| 2873 | 2873 | </label> |
| 2874 | 2874 | <div class="gd-cf-input-wrap"> |
@@ -2876,19 +2876,19 @@ discard block |
||
| 2876 | 2876 | <select name="cat_display_type" id="cat_display_type"> |
| 2877 | 2877 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2878 | 2878 | echo 'selected="selected"'; |
| 2879 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2879 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
|
|
| 2880 | 2880 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2881 | 2881 | echo 'selected="selected"'; |
| 2882 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2882 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 2883 | 2883 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2884 | 2884 | echo 'selected="selected"'; |
| 2885 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2885 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
|
|
| 2886 | 2886 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2887 | 2887 | echo 'selected="selected"'; |
| 2888 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2888 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 2889 | 2889 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2890 | 2890 | echo 'selected="selected"'; |
| 2891 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2891 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 2892 | 2892 | </select> |
| 2893 | 2893 | </div> |
| 2894 | 2894 | </li> |
@@ -2897,10 +2897,10 @@ discard block |
||
| 2897 | 2897 | $output = ob_get_clean(); |
| 2898 | 2898 | return $output; |
| 2899 | 2899 | } |
| 2900 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
|
| 2900 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
|
|
| 2901 | 2901 | |
| 2902 | 2902 | |
| 2903 | -function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
|
| 2903 | +function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
|
|
| 2904 | 2904 | |
| 2905 | 2905 | ob_start(); |
| 2906 | 2906 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -2923,32 +2923,32 @@ discard block |
||
| 2923 | 2923 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
| 2924 | 2924 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
|
| 2925 | 2925 | <div class="gdcf-tooltip"> |
| 2926 | - <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
|
|
| 2926 | + <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
|
|
| 2927 | 2927 | </div> |
| 2928 | 2928 | </label> |
| 2929 | 2929 | <div class="gd-cf-input-wrap gd-switch"> |
| 2930 | 2930 | |
| 2931 | - <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2931 | + <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2932 | 2932 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2933 | 2933 | echo 'checked'; |
| 2934 | 2934 | } ?>/> |
| 2935 | - <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2935 | + <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2936 | 2936 | |
| 2937 | - <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2937 | + <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2938 | 2938 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2939 | 2939 | echo 'checked'; |
| 2940 | 2940 | } ?>/> |
| 2941 | - <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2941 | + <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2942 | 2942 | |
| 2943 | 2943 | |
| 2944 | 2944 | </div> |
| 2945 | 2945 | </li> |
| 2946 | 2946 | |
| 2947 | - <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
|
|
| 2947 | + <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
|
|
| 2948 | 2948 | <label for="zip_lable" class="gd-cf-tooltip-wrap"> |
| 2949 | 2949 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
|
| 2950 | 2950 | <div class="gdcf-tooltip"> |
| 2951 | - <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
|
|
| 2951 | + <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
|
|
| 2952 | 2952 | </div> |
| 2953 | 2953 | </label> |
| 2954 | 2954 | <div class="gd-cf-input-wrap"> |
@@ -2966,7 +2966,7 @@ discard block |
||
| 2966 | 2966 | <label for="map_lable" class="gd-cf-tooltip-wrap"> |
| 2967 | 2967 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
|
| 2968 | 2968 | <div class="gdcf-tooltip"> |
| 2969 | - <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
|
|
| 2969 | + <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
|
|
| 2970 | 2970 | </div> |
| 2971 | 2971 | </label> |
| 2972 | 2972 | <div class="gd-cf-input-wrap"> |
@@ -2981,22 +2981,22 @@ discard block |
||
| 2981 | 2981 | <label for="show_mapzoom" class="gd-cf-tooltip-wrap"> |
| 2982 | 2982 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
|
| 2983 | 2983 | <div class="gdcf-tooltip"> |
| 2984 | - <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
|
|
| 2984 | + <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
|
|
| 2985 | 2985 | </div> |
| 2986 | 2986 | </label> |
| 2987 | 2987 | <div class="gd-cf-input-wrap gd-switch"> |
| 2988 | 2988 | |
| 2989 | - <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2989 | + <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2990 | 2990 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2991 | 2991 | echo 'checked'; |
| 2992 | 2992 | } ?>/> |
| 2993 | - <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2993 | + <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2994 | 2994 | |
| 2995 | - <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2995 | + <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2996 | 2996 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2997 | 2997 | echo 'checked'; |
| 2998 | 2998 | } ?>/> |
| 2999 | - <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2999 | + <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3000 | 3000 | |
| 3001 | 3001 | </div> |
| 3002 | 3002 | </li> |
@@ -3005,22 +3005,22 @@ discard block |
||
| 3005 | 3005 | <label for="show_mapview" class="gd-cf-tooltip-wrap"> |
| 3006 | 3006 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
|
| 3007 | 3007 | <div class="gdcf-tooltip"> |
| 3008 | - <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
|
|
| 3008 | + <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
|
|
| 3009 | 3009 | </div> |
| 3010 | 3010 | </label> |
| 3011 | 3011 | <div class="gd-cf-input-wrap gd-switch"> |
| 3012 | 3012 | |
| 3013 | - <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3013 | + <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3014 | 3014 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 3015 | 3015 | echo 'checked'; |
| 3016 | 3016 | } ?>/> |
| 3017 | - <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3017 | + <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3018 | 3018 | |
| 3019 | - <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3019 | + <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3020 | 3020 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 3021 | 3021 | echo 'checked'; |
| 3022 | 3022 | } ?>/> |
| 3023 | - <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3023 | + <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3024 | 3024 | |
| 3025 | 3025 | </div> |
| 3026 | 3026 | </li> |
@@ -3030,7 +3030,7 @@ discard block |
||
| 3030 | 3030 | <label for="mapview_lable" class="gd-cf-tooltip-wrap"> |
| 3031 | 3031 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
|
| 3032 | 3032 | <div class="gdcf-tooltip"> |
| 3033 | - <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
|
|
| 3033 | + <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
|
|
| 3034 | 3034 | </div> |
| 3035 | 3035 | </label> |
| 3036 | 3036 | <div class="gd-cf-input-wrap"> |
@@ -3044,22 +3044,22 @@ discard block |
||
| 3044 | 3044 | <label for="show_latlng" class="gd-cf-tooltip-wrap"> |
| 3045 | 3045 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
|
| 3046 | 3046 | <div class="gdcf-tooltip"> |
| 3047 | - <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
|
|
| 3047 | + <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
|
|
| 3048 | 3048 | </div> |
| 3049 | 3049 | </label> |
| 3050 | 3050 | <div class="gd-cf-input-wrap gd-switch"> |
| 3051 | 3051 | |
| 3052 | - <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3052 | + <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3053 | 3053 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 3054 | 3054 | echo 'checked'; |
| 3055 | 3055 | } ?>/> |
| 3056 | - <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3056 | + <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3057 | 3057 | |
| 3058 | - <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3058 | + <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3059 | 3059 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 3060 | 3060 | echo 'checked'; |
| 3061 | 3061 | } ?>/> |
| 3062 | - <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3062 | + <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3063 | 3063 | |
| 3064 | 3064 | </div> |
| 3065 | 3065 | </li> |
@@ -3068,17 +3068,17 @@ discard block |
||
| 3068 | 3068 | $html = ob_get_clean(); |
| 3069 | 3069 | return $output.$html; |
| 3070 | 3070 | } |
| 3071 | -add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
|
| 3071 | +add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
|
|
| 3072 | 3072 | |
| 3073 | 3073 | |
| 3074 | -function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
|
| 3074 | +function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
|
|
| 3075 | 3075 | ob_start(); |
| 3076 | 3076 | ?> |
| 3077 | 3077 | <li> |
| 3078 | 3078 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 3079 | 3079 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
| 3080 | 3080 | <div class="gdcf-tooltip"> |
| 3081 | - <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
|
|
| 3081 | + <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
|
|
| 3082 | 3082 | </div> |
| 3083 | 3083 | </label> |
| 3084 | 3084 | <div class="gd-cf-input-wrap"> |
@@ -3086,13 +3086,13 @@ discard block |
||
| 3086 | 3086 | <select name="multi_display_type" id="multi_display_type"> |
| 3087 | 3087 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 3088 | 3088 | echo 'selected="selected"'; |
| 3089 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3089 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 3090 | 3090 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 3091 | 3091 | echo 'selected="selected"'; |
| 3092 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3092 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 3093 | 3093 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 3094 | 3094 | echo 'selected="selected"'; |
| 3095 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3095 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 3096 | 3096 | </select> |
| 3097 | 3097 | |
| 3098 | 3098 | <br/> |
@@ -3103,17 +3103,17 @@ discard block |
||
| 3103 | 3103 | $html = ob_get_clean(); |
| 3104 | 3104 | return $output.$html; |
| 3105 | 3105 | } |
| 3106 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
|
| 3106 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
|
|
| 3107 | 3107 | |
| 3108 | 3108 | |
| 3109 | -function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
|
| 3109 | +function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
|
|
| 3110 | 3110 | |
| 3111 | 3111 | ob_start(); |
| 3112 | 3112 | |
| 3113 | 3113 | $value = ''; |
| 3114 | 3114 | if (isset($field_info->option_values)) {
|
| 3115 | 3115 | $value = esc_attr($field_info->option_values); |
| 3116 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3116 | + }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
|
|
| 3117 | 3117 | $value = esc_attr($cf['defaults']['option_values']); |
| 3118 | 3118 | } |
| 3119 | 3119 | |
@@ -3123,11 +3123,11 @@ discard block |
||
| 3123 | 3123 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 3124 | 3124 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
| 3125 | 3125 | <div class="gdcf-tooltip"> |
| 3126 | - <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
|
|
| 3126 | + <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
|
|
| 3127 | 3127 | <br/> |
| 3128 | - <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
|
|
| 3128 | + <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
|
|
| 3129 | 3129 | <br/> |
| 3130 | - <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
|
|
| 3130 | + <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
|
|
| 3131 | 3131 | <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
|
| 3132 | 3132 | <br/> |
| 3133 | 3133 | <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
|
@@ -3138,7 +3138,7 @@ discard block |
||
| 3138 | 3138 | </label> |
| 3139 | 3139 | <div class="gd-cf-input-wrap"> |
| 3140 | 3140 | <input type="text" name="option_values" id="option_values" |
| 3141 | - value="<?php echo $value;?>"/> |
|
| 3141 | + value="<?php echo $value; ?>"/> |
|
| 3142 | 3142 | <br/> |
| 3143 | 3143 | |
| 3144 | 3144 | </div> |
@@ -3148,12 +3148,12 @@ discard block |
||
| 3148 | 3148 | $html = ob_get_clean(); |
| 3149 | 3149 | return $output.$html; |
| 3150 | 3150 | } |
| 3151 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3152 | -add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3153 | -add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3151 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3152 | +add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3153 | +add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3154 | 3154 | |
| 3155 | 3155 | |
| 3156 | -function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
|
| 3156 | +function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
|
|
| 3157 | 3157 | ob_start(); |
| 3158 | 3158 | $extra = array(); |
| 3159 | 3159 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -3164,7 +3164,7 @@ discard block |
||
| 3164 | 3164 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 3165 | 3165 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
| 3166 | 3166 | <div class="gdcf-tooltip"> |
| 3167 | - <?php _e('Select the date format.', 'geodirectory');?>
|
|
| 3167 | + <?php _e('Select the date format.', 'geodirectory'); ?>
|
|
| 3168 | 3168 | </div> |
| 3169 | 3169 | </label> |
| 3170 | 3170 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
@@ -3184,16 +3184,16 @@ discard block |
||
| 3184 | 3184 | * @since 1.6.5 |
| 3185 | 3185 | * @param array $date_formats The PHP date format array. |
| 3186 | 3186 | */ |
| 3187 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3187 | + $date_formats = apply_filters('geodir_date_formats', $date_formats);
|
|
| 3188 | 3188 | ?> |
| 3189 | 3189 | <select name="extra[date_format]" id="date_format"> |
| 3190 | 3190 | <?php |
| 3191 | - foreach($date_formats as $format){
|
|
| 3191 | + foreach ($date_formats as $format) {
|
|
| 3192 | 3192 | $selected = ''; |
| 3193 | - if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3193 | + if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
|
|
| 3194 | 3194 | $selected = "selected='selected'"; |
| 3195 | 3195 | } |
| 3196 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3196 | + echo "<option $selected value='$format'>$format (".date_i18n($format, time()).")</option>";
|
|
| 3197 | 3197 | } |
| 3198 | 3198 | ?> |
| 3199 | 3199 | </select> |
@@ -3205,10 +3205,10 @@ discard block |
||
| 3205 | 3205 | $html = ob_get_clean(); |
| 3206 | 3206 | return $output.$html; |
| 3207 | 3207 | } |
| 3208 | -add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
|
| 3208 | +add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
|
|
| 3209 | 3209 | |
| 3210 | 3210 | |
| 3211 | -function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
|
| 3211 | +function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
|
|
| 3212 | 3212 | ob_start(); |
| 3213 | 3213 | $allowed_file_types = geodir_allowed_mime_types(); |
| 3214 | 3214 | |
@@ -3219,16 +3219,16 @@ discard block |
||
| 3219 | 3219 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3220 | 3220 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
| 3221 | 3221 | <div class="gdcf-tooltip"> |
| 3222 | - <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
|
|
| 3222 | + <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
|
|
| 3223 | 3223 | </div> |
| 3224 | 3224 | </label> |
| 3225 | 3225 | <div class="gd-cf-input-wrap"> |
| 3226 | 3226 | <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;"> |
| 3227 | - <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
|
|
| 3228 | - <?php foreach ( $allowed_file_types as $format => $types ) { ?>
|
|
| 3229 | - <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
|
|
| 3230 | - <?php foreach ( $types as $ext => $type ) { ?>
|
|
| 3231 | - <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option> |
|
| 3227 | + <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
|
|
| 3228 | + <?php foreach ($allowed_file_types as $format => $types) { ?>
|
|
| 3229 | + <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
|
|
| 3230 | + <?php foreach ($types as $ext => $type) { ?>
|
|
| 3231 | + <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option> |
|
| 3232 | 3232 | <?php } ?> |
| 3233 | 3233 | </optgroup> |
| 3234 | 3234 | <?php } ?> |
@@ -3240,9 +3240,9 @@ discard block |
||
| 3240 | 3240 | $html = ob_get_clean(); |
| 3241 | 3241 | return $output.$html; |
| 3242 | 3242 | } |
| 3243 | -add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
|
|
| 3243 | +add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
|
|
| 3244 | 3244 | |
| 3245 | -function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
|
|
| 3245 | +function geodir_cfa_extra_fields_text($output, $result_str, $cf, $field_info) {
|
|
| 3246 | 3246 | ob_start(); |
| 3247 | 3247 | |
| 3248 | 3248 | $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
@@ -3256,15 +3256,15 @@ discard block |
||
| 3256 | 3256 | $value = ''; |
| 3257 | 3257 | if ($extra_fields && isset($extra_fields['is_price'])) {
|
| 3258 | 3258 | $value = esc_attr($extra_fields['is_price']); |
| 3259 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3259 | + }elseif (isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']) {
|
|
| 3260 | 3260 | $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
| 3261 | 3261 | } |
| 3262 | 3262 | |
| 3263 | - $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3263 | + $show_price_extra = ($value == 1) ? 1 : 0; |
|
| 3264 | 3264 | |
| 3265 | - $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3265 | + $show_price = (isset($field_info->data_type) && ($field_info->data_type == 'INT' && $field_info->data_type == 'FLOAT')) ? 1 : 0; |
|
| 3266 | 3266 | ?> |
| 3267 | - <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
|
|
| 3267 | + <li class="gdcf-price-extra-set" <?php if (!$show_price) { echo "style='display:none;'"; }?>>
|
|
| 3268 | 3268 | <label for="is_price" class="gd-cf-tooltip-wrap"> |
| 3269 | 3269 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
|
| 3270 | 3270 | <div class="gdcf-tooltip"> |
@@ -3273,17 +3273,17 @@ discard block |
||
| 3273 | 3273 | </label> |
| 3274 | 3274 | <div class="gd-cf-input-wrap gd-switch"> |
| 3275 | 3275 | |
| 3276 | - <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3276 | + <input type="radio" id="is_price_yes<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3277 | 3277 | <?php if ($value == '1') {
|
| 3278 | 3278 | echo 'checked'; |
| 3279 | 3279 | } ?>/> |
| 3280 | - <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3280 | + <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3281 | 3281 | |
| 3282 | - <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3282 | + <input type="radio" id="is_price_no<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3283 | 3283 | <?php if ($value == '0' || !$value) {
|
| 3284 | 3284 | echo 'checked'; |
| 3285 | 3285 | } ?>/> |
| 3286 | - <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3286 | + <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3287 | 3287 | |
| 3288 | 3288 | </div> |
| 3289 | 3289 | </li> |
@@ -3293,23 +3293,23 @@ discard block |
||
| 3293 | 3293 | $value = ''; |
| 3294 | 3294 | if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
| 3295 | 3295 | $value = esc_attr($extra_fields['thousand_separator']); |
| 3296 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3296 | + }elseif (isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']) {
|
|
| 3297 | 3297 | $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
| 3298 | 3298 | } |
| 3299 | 3299 | ?> |
| 3300 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3301 | - <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
|
|
| 3300 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3301 | + <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory'); ?>
|
|
| 3302 | 3302 | <div class="gdcf-tooltip"> |
| 3303 | 3303 | <?php _e('Select the thousand separator.', 'geodirectory'); ?>
|
| 3304 | 3304 | </div> |
| 3305 | 3305 | </label> |
| 3306 | 3306 | <div class="gd-cf-input-wrap"> |
| 3307 | 3307 | <select name="extra[thousand_separator]" id="thousand_separator"> |
| 3308 | - <option value="comma" <?php selected(true, $value == 'comma');?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3309 | - <option value="slash" <?php selected(true, $value == "slash");?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3310 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3311 | - <option value="space" <?php selected(true, $value == 'space');?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3312 | - <option value="none" <?php selected(true, $value == 'none');?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3308 | + <option value="comma" <?php selected(true, $value == 'comma'); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3309 | + <option value="slash" <?php selected(true, $value == "slash"); ?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3310 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3311 | + <option value="space" <?php selected(true, $value == 'space'); ?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3312 | + <option value="none" <?php selected(true, $value == 'none'); ?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3313 | 3313 | </select> |
| 3314 | 3314 | </div> |
| 3315 | 3315 | </li> |
@@ -3320,20 +3320,20 @@ discard block |
||
| 3320 | 3320 | $value = ''; |
| 3321 | 3321 | if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
| 3322 | 3322 | $value = esc_attr($extra_fields['decimal_separator']); |
| 3323 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3323 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']) {
|
|
| 3324 | 3324 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
| 3325 | 3325 | } |
| 3326 | 3326 | ?> |
| 3327 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3328 | - <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
|
|
| 3327 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3328 | + <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory'); ?>
|
|
| 3329 | 3329 | <div class="gdcf-tooltip"> |
| 3330 | 3330 | <?php _e('Select the decimal separator.', 'geodirectory'); ?>
|
| 3331 | 3331 | </div> |
| 3332 | 3332 | </label> |
| 3333 | 3333 | <div class="gd-cf-input-wrap"> |
| 3334 | 3334 | <select name="extra[decimal_separator]" id="decimal_separator"> |
| 3335 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3336 | - <option value="comma" <?php selected(true, $value == "comma");?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3335 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3336 | + <option value="comma" <?php selected(true, $value == "comma"); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3337 | 3337 | </select> |
| 3338 | 3338 | </div> |
| 3339 | 3339 | </li> |
@@ -3343,20 +3343,20 @@ discard block |
||
| 3343 | 3343 | $value = ''; |
| 3344 | 3344 | if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
| 3345 | 3345 | $value = esc_attr($extra_fields['decimal_display']); |
| 3346 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3346 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']) {
|
|
| 3347 | 3347 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
| 3348 | 3348 | } |
| 3349 | 3349 | ?> |
| 3350 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3351 | - <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
|
|
| 3350 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3351 | + <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory'); ?>
|
|
| 3352 | 3352 | <div class="gdcf-tooltip"> |
| 3353 | 3353 | <?php _e('Select how the decimal is displayed', 'geodirectory'); ?>
|
| 3354 | 3354 | </div> |
| 3355 | 3355 | </label> |
| 3356 | 3356 | <div class="gd-cf-input-wrap"> |
| 3357 | 3357 | <select name="extra[decimal_display]" id="decimal_display"> |
| 3358 | - <option value="if" <?php selected(true, $value == 'if');?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3359 | - <option value="allways" <?php selected(true, $value == "allways");?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3358 | + <option value="if" <?php selected(true, $value == 'if'); ?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3359 | + <option value="allways" <?php selected(true, $value == "allways"); ?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3360 | 3360 | </select> |
| 3361 | 3361 | </div> |
| 3362 | 3362 | </li> |
@@ -3366,12 +3366,12 @@ discard block |
||
| 3366 | 3366 | $value = ''; |
| 3367 | 3367 | if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
| 3368 | 3368 | $value = esc_attr($extra_fields['currency_symbol']); |
| 3369 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3369 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']) {
|
|
| 3370 | 3370 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
| 3371 | 3371 | } |
| 3372 | 3372 | ?> |
| 3373 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3374 | - <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
|
|
| 3373 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3374 | + <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory'); ?>
|
|
| 3375 | 3375 | <div class="gdcf-tooltip"> |
| 3376 | 3376 | <?php _e('Select the currency symbol.', 'geodirectory'); ?>
|
| 3377 | 3377 | </div> |
@@ -3387,20 +3387,20 @@ discard block |
||
| 3387 | 3387 | $value = ''; |
| 3388 | 3388 | if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
| 3389 | 3389 | $value = esc_attr($extra_fields['currency_symbol_placement']); |
| 3390 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3390 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']) {
|
|
| 3391 | 3391 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
| 3392 | 3392 | } |
| 3393 | 3393 | ?> |
| 3394 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3395 | - <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
|
|
| 3394 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3395 | + <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory'); ?>
|
|
| 3396 | 3396 | <div class="gdcf-tooltip"> |
| 3397 | 3397 | <?php _e('Select the currency symbol placement.', 'geodirectory'); ?>
|
| 3398 | 3398 | </div> |
| 3399 | 3399 | </label> |
| 3400 | 3400 | <div class="gd-cf-input-wrap"> |
| 3401 | 3401 | <select name="extra[currency_symbol_placement]" id="currency_symbol_placement"> |
| 3402 | - <option value="left" <?php selected(true, $value == 'left');?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3403 | - <option value="right" <?php selected(true, $value == "right");?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3402 | + <option value="left" <?php selected(true, $value == 'left'); ?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3403 | + <option value="right" <?php selected(true, $value == "right"); ?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3404 | 3404 | </select> |
| 3405 | 3405 | </div> |
| 3406 | 3406 | </li> |
@@ -3411,11 +3411,11 @@ discard block |
||
| 3411 | 3411 | $html = ob_get_clean(); |
| 3412 | 3412 | return $output.$html; |
| 3413 | 3413 | } |
| 3414 | -add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
|
|
| 3414 | +add_filter('geodir_cfa_extra_fields_text', 'geodir_cfa_extra_fields_text', 10, 4);
|
|
| 3415 | 3415 | |
| 3416 | -function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
|
|
| 3416 | +function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
|
|
| 3417 | 3417 | $fields = array(); |
| 3418 | - $package = ($package_id=='') ? '' : array($package_id); |
|
| 3418 | + $package = ($package_id == '') ? '' : array($package_id); |
|
| 3419 | 3419 | |
| 3420 | 3420 | $fields[] = array('listing_type' => $post_type,
|
| 3421 | 3421 | 'data_type' => 'VARCHAR', |
@@ -3588,7 +3588,7 @@ discard block |
||
| 3588 | 3588 | return $fields; |
| 3589 | 3589 | } |
| 3590 | 3590 | |
| 3591 | -function geodir_currency_format_number($number='',$cf=''){
|
|
| 3591 | +function geodir_currency_format_number($number = '', $cf = '') {
|
|
| 3592 | 3592 | |
| 3593 | 3593 | $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
| 3594 | 3594 | |
@@ -3597,35 +3597,35 @@ discard block |
||
| 3597 | 3597 | $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if'; |
| 3598 | 3598 | $decimalpoint = '.'; |
| 3599 | 3599 | |
| 3600 | - if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3600 | + if (isset($cs['decimal_separator']) && $cs['decimal_separator'] == 'comma') {
|
|
| 3601 | 3601 | $decimalpoint = ','; |
| 3602 | 3602 | } |
| 3603 | 3603 | |
| 3604 | 3604 | $separator = ','; |
| 3605 | 3605 | |
| 3606 | - if(isset($cs['thousand_separator'])){
|
|
| 3607 | - if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3608 | - if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3609 | - if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3610 | - if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3611 | - if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3606 | + if (isset($cs['thousand_separator'])) {
|
|
| 3607 | + if ($cs['thousand_separator'] == 'comma') {$separator = ','; }
|
|
| 3608 | + if ($cs['thousand_separator'] == 'slash') {$separator = '\\'; }
|
|
| 3609 | + if ($cs['thousand_separator'] == 'period') {$separator = '.'; }
|
|
| 3610 | + if ($cs['thousand_separator'] == 'space') {$separator = ' '; }
|
|
| 3611 | + if ($cs['thousand_separator'] == 'none') {$separator = ''; }
|
|
| 3612 | 3612 | } |
| 3613 | 3613 | |
| 3614 | 3614 | $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
| 3615 | 3615 | |
| 3616 | - if($decimals>0 && $decimal_display=='if'){
|
|
| 3617 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3616 | + if ($decimals > 0 && $decimal_display == 'if') {
|
|
| 3617 | + if (is_int($number) || floor($number) == $number) |
|
| 3618 | 3618 | $decimals = 0; |
| 3619 | 3619 | } |
| 3620 | 3620 | |
| 3621 | - $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3621 | + $number = number_format($number, $decimals, $decimalpoint, $separator); |
|
| 3622 | 3622 | |
| 3623 | 3623 | |
| 3624 | 3624 | |
| 3625 | - if($currency_symbol_placement=='left'){
|
|
| 3626 | - $number = $symbol . $number; |
|
| 3627 | - }else{
|
|
| 3628 | - $number = $number . $symbol; |
|
| 3625 | + if ($currency_symbol_placement == 'left') {
|
|
| 3626 | + $number = $symbol.$number; |
|
| 3627 | + } else {
|
|
| 3628 | + $number = $number.$symbol; |
|
| 3629 | 3629 | } |
| 3630 | 3630 | |
| 3631 | 3631 | |
@@ -17,18 +17,18 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function geodir_is_login($redirect = false) |
| 19 | 19 | {
|
| 20 | - global $current_user; |
|
| 21 | - if (!$current_user->ID) {
|
|
| 22 | - if ($redirect) {
|
|
| 23 | - ?> |
|
| 20 | + global $current_user; |
|
| 21 | + if (!$current_user->ID) {
|
|
| 22 | + if ($redirect) {
|
|
| 23 | + ?> |
|
| 24 | 24 | <script type="text/javascript"> |
| 25 | 25 | window.location.href = '<?php echo geodir_login_url();?>'; |
| 26 | 26 | </script> |
| 27 | 27 | <?php |
| 28 | - } else |
|
| 29 | - return false; |
|
| 30 | - } else |
|
| 31 | - return true; |
|
| 28 | + } else |
|
| 29 | + return false; |
|
| 30 | + } else |
|
| 31 | + return true; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -42,25 +42,25 @@ discard block |
||
| 42 | 42 | {
|
| 43 | 43 | |
| 44 | 44 | // Redirect to https login if forced to use SSL |
| 45 | - if (force_ssl_admin() && !is_ssl()) {
|
|
| 46 | - if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
|
|
| 47 | - wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
|
|
| 48 | - exit(); |
|
| 49 | - } else {
|
|
| 50 | - wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
|
| 51 | - exit(); |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Filter the login message. |
|
| 57 | - * |
|
| 58 | - * @since 1.0.0 |
|
| 59 | - * |
|
| 60 | - * @param string $message Login message. |
|
| 61 | - */ |
|
| 62 | - $message = apply_filters('login_message', $message);
|
|
| 63 | - if (!empty($message)) echo $message . "\n"; |
|
| 45 | + if (force_ssl_admin() && !is_ssl()) {
|
|
| 46 | + if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
|
|
| 47 | + wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
|
|
| 48 | + exit(); |
|
| 49 | + } else {
|
|
| 50 | + wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
|
| 51 | + exit(); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Filter the login message. |
|
| 57 | + * |
|
| 58 | + * @since 1.0.0 |
|
| 59 | + * |
|
| 60 | + * @param string $message Login message. |
|
| 61 | + */ |
|
| 62 | + $message = apply_filters('login_message', $message);
|
|
| 63 | + if (!empty($message)) echo $message . "\n"; |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
@@ -73,59 +73,59 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | function geodir_get_site_email_id() |
| 75 | 75 | {
|
| 76 | - if (get_option('site_email')) {
|
|
| 76 | + if (get_option('site_email')) {
|
|
| 77 | 77 | |
| 78 | - return get_option('site_email');
|
|
| 78 | + return get_option('site_email');
|
|
| 79 | 79 | |
| 80 | - } else {
|
|
| 80 | + } else {
|
|
| 81 | 81 | |
| 82 | - return get_option('admin_email');
|
|
| 82 | + return get_option('admin_email');
|
|
| 83 | 83 | |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | if (!function_exists('get_site_emailName')) {
|
| 90 | - /** |
|
| 91 | - * Get site name for sending emails. |
|
| 92 | - * |
|
| 93 | - * @since 1.0.0 |
|
| 94 | - * @package GeoDirectory |
|
| 95 | - * @return string Site name. |
|
| 96 | - */ |
|
| 97 | - function get_site_emailName() |
|
| 90 | + /** |
|
| 91 | + * Get site name for sending emails. |
|
| 92 | + * |
|
| 93 | + * @since 1.0.0 |
|
| 94 | + * @package GeoDirectory |
|
| 95 | + * @return string Site name. |
|
| 96 | + */ |
|
| 97 | + function get_site_emailName() |
|
| 98 | 98 | |
| 99 | - {
|
|
| 99 | + {
|
|
| 100 | 100 | |
| 101 | - if (get_option('site_email_name')) {
|
|
| 101 | + if (get_option('site_email_name')) {
|
|
| 102 | 102 | |
| 103 | - return stripslashes(get_option('site_email_name'));
|
|
| 103 | + return stripslashes(get_option('site_email_name'));
|
|
| 104 | 104 | |
| 105 | - } else {
|
|
| 105 | + } else {
|
|
| 106 | 106 | |
| 107 | - return stripslashes(get_option('blogname'));
|
|
| 107 | + return stripslashes(get_option('blogname'));
|
|
| 108 | 108 | |
| 109 | - } |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if (!function_exists('is_allow_user_register')) {
|
| 115 | - /** |
|
| 116 | - * Checks whether the site allowing user registration or not. |
|
| 117 | - * |
|
| 118 | - * @since 1.0.0 |
|
| 119 | - * @package GeoDirectory |
|
| 120 | - * @return bool|string |
|
| 121 | - */ |
|
| 122 | - function is_allow_user_register() |
|
| 115 | + /** |
|
| 116 | + * Checks whether the site allowing user registration or not. |
|
| 117 | + * |
|
| 118 | + * @since 1.0.0 |
|
| 119 | + * @package GeoDirectory |
|
| 120 | + * @return bool|string |
|
| 121 | + */ |
|
| 122 | + function is_allow_user_register() |
|
| 123 | 123 | |
| 124 | - {
|
|
| 124 | + {
|
|
| 125 | 125 | |
| 126 | - return get_option('users_can_register');
|
|
| 126 | + return get_option('users_can_register');
|
|
| 127 | 127 | |
| 128 | - } |
|
| 128 | + } |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -138,107 +138,107 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | function geodir_retrieve_password() |
| 140 | 140 | {
|
| 141 | - global $wpdb; |
|
| 142 | - |
|
| 143 | - $errors = new WP_Error(); |
|
| 144 | - if (empty($_POST['user_login']) && empty($_POST['user_email'])) |
|
| 145 | - $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
|
|
| 146 | - |
|
| 147 | - if (strpos($_POST['user_login'], '@')) {
|
|
| 148 | - //$user_data = get_user_by_email(trim($_POST['user_login'])); |
|
| 149 | - $user_data = get_user_by('email', trim($_POST['user_login']));
|
|
| 150 | - if (empty($user_data)) |
|
| 151 | - $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
|
|
| 152 | - } else {
|
|
| 153 | - $login = trim($_POST['user_login']); |
|
| 154 | - $user_data = get_user_by('email', $login);
|
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent. |
|
| 159 | - * |
|
| 160 | - * @since 1.0.0 |
|
| 161 | - */ |
|
| 162 | - do_action('lostpassword_post');
|
|
| 163 | - |
|
| 164 | - if ($errors->get_error_code()) |
|
| 165 | - return $errors; |
|
| 166 | - |
|
| 167 | - if (!$user_data) {
|
|
| 168 | - $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
|
|
| 169 | - return $errors; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - // redefining user_login ensures we return the right case in the email |
|
| 173 | - $user_login = $user_data->user_login; |
|
| 174 | - $user_email = $user_data->user_email; |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * Called in the geodir_retrieve_password() function before any emails are sent. |
|
| 178 | - * |
|
| 179 | - * @since 1.0.0 |
|
| 180 | - * @param string $user_login The users username. |
|
| 181 | - */ |
|
| 182 | - do_action('retrieve_password', $user_login);
|
|
| 183 | - |
|
| 184 | - //////////////////////////////////// |
|
| 185 | - $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : ''; |
|
| 186 | - $user_login = $_POST['user_login']; |
|
| 187 | - |
|
| 188 | - $user = $wpdb->get_row( |
|
| 189 | - $wpdb->prepare( |
|
| 190 | - "SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s", |
|
| 191 | - array($user_login, $user_login) |
|
| 192 | - ) |
|
| 193 | - ); |
|
| 194 | - |
|
| 195 | - if (empty($user)) |
|
| 196 | - return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
|
|
| 197 | - |
|
| 198 | - $new_pass = wp_generate_password(12, false); |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * Called in the geodir_retrieve_password() function before any emails are sent. |
|
| 202 | - * |
|
| 203 | - * @since 1.0.0 |
|
| 204 | - * @param object $user The user object. |
|
| 205 | - * @param string $new_pass The new pass being sent to the user. |
|
| 206 | - */ |
|
| 207 | - do_action('password_reset', $user, $new_pass);
|
|
| 208 | - |
|
| 209 | - wp_set_password($new_pass, $user->ID); |
|
| 210 | - update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag. |
|
| 211 | - $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
|
|
| 212 | - $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
|
|
| 213 | - $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
|
|
| 214 | - //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is : ".home_url()."/?ptype=login</p>"; |
|
| 215 | - //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
|
|
| 216 | - $user_email = $user_data->user_email; |
|
| 217 | - $user_name = geodir_get_client_name($user->ID); |
|
| 218 | - $fromEmail = geodir_get_site_email_id(); |
|
| 219 | - $fromEmailName = get_site_emailName(); |
|
| 220 | - $title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
|
|
| 221 | - /** |
|
| 222 | - * Filter the password reset email subject part. |
|
| 223 | - * |
|
| 224 | - * @since 1.0.0 |
|
| 225 | - * |
|
| 226 | - * @param string $title Password reset email subject. |
|
| 227 | - */ |
|
| 228 | - $title = apply_filters('password_reset_title', $title);
|
|
| 229 | - /** |
|
| 230 | - * Filter the password reset email message part. |
|
| 231 | - * |
|
| 232 | - * @since 1.0.0 |
|
| 233 | - * |
|
| 234 | - * @param string $message Password reset email message. |
|
| 235 | - * @param string $new_pass The new password string. |
|
| 236 | - */ |
|
| 237 | - $message = apply_filters('password_reset_message', $message, $new_pass);
|
|
| 238 | - //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email |
|
| 239 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email |
|
| 240 | - |
|
| 241 | - return true; |
|
| 141 | + global $wpdb; |
|
| 142 | + |
|
| 143 | + $errors = new WP_Error(); |
|
| 144 | + if (empty($_POST['user_login']) && empty($_POST['user_email'])) |
|
| 145 | + $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
|
|
| 146 | + |
|
| 147 | + if (strpos($_POST['user_login'], '@')) {
|
|
| 148 | + //$user_data = get_user_by_email(trim($_POST['user_login'])); |
|
| 149 | + $user_data = get_user_by('email', trim($_POST['user_login']));
|
|
| 150 | + if (empty($user_data)) |
|
| 151 | + $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
|
|
| 152 | + } else {
|
|
| 153 | + $login = trim($_POST['user_login']); |
|
| 154 | + $user_data = get_user_by('email', $login);
|
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent. |
|
| 159 | + * |
|
| 160 | + * @since 1.0.0 |
|
| 161 | + */ |
|
| 162 | + do_action('lostpassword_post');
|
|
| 163 | + |
|
| 164 | + if ($errors->get_error_code()) |
|
| 165 | + return $errors; |
|
| 166 | + |
|
| 167 | + if (!$user_data) {
|
|
| 168 | + $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
|
|
| 169 | + return $errors; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + // redefining user_login ensures we return the right case in the email |
|
| 173 | + $user_login = $user_data->user_login; |
|
| 174 | + $user_email = $user_data->user_email; |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * Called in the geodir_retrieve_password() function before any emails are sent. |
|
| 178 | + * |
|
| 179 | + * @since 1.0.0 |
|
| 180 | + * @param string $user_login The users username. |
|
| 181 | + */ |
|
| 182 | + do_action('retrieve_password', $user_login);
|
|
| 183 | + |
|
| 184 | + //////////////////////////////////// |
|
| 185 | + $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : ''; |
|
| 186 | + $user_login = $_POST['user_login']; |
|
| 187 | + |
|
| 188 | + $user = $wpdb->get_row( |
|
| 189 | + $wpdb->prepare( |
|
| 190 | + "SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s", |
|
| 191 | + array($user_login, $user_login) |
|
| 192 | + ) |
|
| 193 | + ); |
|
| 194 | + |
|
| 195 | + if (empty($user)) |
|
| 196 | + return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
|
|
| 197 | + |
|
| 198 | + $new_pass = wp_generate_password(12, false); |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * Called in the geodir_retrieve_password() function before any emails are sent. |
|
| 202 | + * |
|
| 203 | + * @since 1.0.0 |
|
| 204 | + * @param object $user The user object. |
|
| 205 | + * @param string $new_pass The new pass being sent to the user. |
|
| 206 | + */ |
|
| 207 | + do_action('password_reset', $user, $new_pass);
|
|
| 208 | + |
|
| 209 | + wp_set_password($new_pass, $user->ID); |
|
| 210 | + update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag. |
|
| 211 | + $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
|
|
| 212 | + $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
|
|
| 213 | + $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
|
|
| 214 | + //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is : ".home_url()."/?ptype=login</p>"; |
|
| 215 | + //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
|
|
| 216 | + $user_email = $user_data->user_email; |
|
| 217 | + $user_name = geodir_get_client_name($user->ID); |
|
| 218 | + $fromEmail = geodir_get_site_email_id(); |
|
| 219 | + $fromEmailName = get_site_emailName(); |
|
| 220 | + $title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
|
|
| 221 | + /** |
|
| 222 | + * Filter the password reset email subject part. |
|
| 223 | + * |
|
| 224 | + * @since 1.0.0 |
|
| 225 | + * |
|
| 226 | + * @param string $title Password reset email subject. |
|
| 227 | + */ |
|
| 228 | + $title = apply_filters('password_reset_title', $title);
|
|
| 229 | + /** |
|
| 230 | + * Filter the password reset email message part. |
|
| 231 | + * |
|
| 232 | + * @since 1.0.0 |
|
| 233 | + * |
|
| 234 | + * @param string $message Password reset email message. |
|
| 235 | + * @param string $new_pass The new password string. |
|
| 236 | + */ |
|
| 237 | + $message = apply_filters('password_reset_message', $message, $new_pass);
|
|
| 238 | + //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email |
|
| 239 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email |
|
| 240 | + |
|
| 241 | + return true; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -253,80 +253,80 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | function geodir_register_new_user($user_login, $user_email) |
| 255 | 255 | {
|
| 256 | - global $wpdb; |
|
| 257 | - $errors = new WP_Error(); |
|
| 258 | - |
|
| 259 | - |
|
| 260 | - $user_login = sanitize_user($user_login); |
|
| 261 | - $user_login = str_replace(",", "", $user_login);
|
|
| 262 | - $user_email = str_replace(",", "", $user_email);
|
|
| 263 | - /** |
|
| 264 | - * Filter the user registration email. |
|
| 265 | - * |
|
| 266 | - * @since 1.0.0 |
|
| 267 | - * |
|
| 268 | - * @param string $user_email User registration email. |
|
| 269 | - */ |
|
| 270 | - $user_email = apply_filters('user_registration_email', $user_email);
|
|
| 271 | - |
|
| 272 | - |
|
| 273 | - if (get_option('geodir_allow_cpass')) {
|
|
| 274 | - $user_pass = $_REQUEST['user_pass']; |
|
| 275 | - $user_pass2 = $_REQUEST['user_pass2']; |
|
| 276 | - // Check the password |
|
| 277 | - if ($user_pass != $user_pass2) {
|
|
| 278 | - $errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
|
|
| 279 | - } elseif (strlen($user_pass) < 7) {
|
|
| 280 | - $errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
|
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - // Check the username |
|
| 285 | - if ($user_login == '') |
|
| 286 | - $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
|
|
| 287 | - elseif (!validate_username($user_login)) {
|
|
| 288 | - $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.', 'geodirectory'));
|
|
| 289 | - $user_login = ''; |
|
| 290 | - } elseif (username_exists($user_login)) |
|
| 291 | - $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
|
|
| 292 | - |
|
| 293 | - // Check the e-mail address |
|
| 294 | - if ($user_email == '') {
|
|
| 295 | - $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
|
|
| 296 | - } elseif (!is_email($user_email)) {
|
|
| 297 | - $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'geodirectory'));
|
|
| 298 | - $user_email = ''; |
|
| 299 | - } elseif (email_exists($user_email)) |
|
| 300 | - $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
|
|
| 301 | - |
|
| 302 | - /** |
|
| 303 | - * Called when registering a new user. |
|
| 304 | - * |
|
| 305 | - * This is a WordPress core hook. |
|
| 306 | - * |
|
| 307 | - * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post |
|
| 308 | - * @since 1.0.0 |
|
| 309 | - */ |
|
| 310 | - do_action('register_post', $user_login, $user_email, $errors);
|
|
| 311 | - /** |
|
| 312 | - * Filter the registration error messages. |
|
| 313 | - * |
|
| 314 | - * @since 1.0.0 |
|
| 315 | - * |
|
| 316 | - * @param object $errors Registration error messages. |
|
| 317 | - */ |
|
| 318 | - $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
|
|
| 319 | - |
|
| 320 | - if ($errors->get_error_code()) |
|
| 321 | - return $errors; |
|
| 322 | - |
|
| 323 | - |
|
| 324 | - if (!isset($user_pass) || $user_pass == '') {
|
|
| 325 | - $user_pass = wp_generate_password(12, false); |
|
| 326 | - } |
|
| 327 | - $user_id = wp_create_user($user_login, $user_pass, $user_email); |
|
| 328 | - $user_web = ''; |
|
| 329 | - /*$user_add1 = $_POST['user_add1']; |
|
| 256 | + global $wpdb; |
|
| 257 | + $errors = new WP_Error(); |
|
| 258 | + |
|
| 259 | + |
|
| 260 | + $user_login = sanitize_user($user_login); |
|
| 261 | + $user_login = str_replace(",", "", $user_login);
|
|
| 262 | + $user_email = str_replace(",", "", $user_email);
|
|
| 263 | + /** |
|
| 264 | + * Filter the user registration email. |
|
| 265 | + * |
|
| 266 | + * @since 1.0.0 |
|
| 267 | + * |
|
| 268 | + * @param string $user_email User registration email. |
|
| 269 | + */ |
|
| 270 | + $user_email = apply_filters('user_registration_email', $user_email);
|
|
| 271 | + |
|
| 272 | + |
|
| 273 | + if (get_option('geodir_allow_cpass')) {
|
|
| 274 | + $user_pass = $_REQUEST['user_pass']; |
|
| 275 | + $user_pass2 = $_REQUEST['user_pass2']; |
|
| 276 | + // Check the password |
|
| 277 | + if ($user_pass != $user_pass2) {
|
|
| 278 | + $errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
|
|
| 279 | + } elseif (strlen($user_pass) < 7) {
|
|
| 280 | + $errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
|
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + // Check the username |
|
| 285 | + if ($user_login == '') |
|
| 286 | + $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
|
|
| 287 | + elseif (!validate_username($user_login)) {
|
|
| 288 | + $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.', 'geodirectory'));
|
|
| 289 | + $user_login = ''; |
|
| 290 | + } elseif (username_exists($user_login)) |
|
| 291 | + $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
|
|
| 292 | + |
|
| 293 | + // Check the e-mail address |
|
| 294 | + if ($user_email == '') {
|
|
| 295 | + $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
|
|
| 296 | + } elseif (!is_email($user_email)) {
|
|
| 297 | + $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'geodirectory'));
|
|
| 298 | + $user_email = ''; |
|
| 299 | + } elseif (email_exists($user_email)) |
|
| 300 | + $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
|
|
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * Called when registering a new user. |
|
| 304 | + * |
|
| 305 | + * This is a WordPress core hook. |
|
| 306 | + * |
|
| 307 | + * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post |
|
| 308 | + * @since 1.0.0 |
|
| 309 | + */ |
|
| 310 | + do_action('register_post', $user_login, $user_email, $errors);
|
|
| 311 | + /** |
|
| 312 | + * Filter the registration error messages. |
|
| 313 | + * |
|
| 314 | + * @since 1.0.0 |
|
| 315 | + * |
|
| 316 | + * @param object $errors Registration error messages. |
|
| 317 | + */ |
|
| 318 | + $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
|
|
| 319 | + |
|
| 320 | + if ($errors->get_error_code()) |
|
| 321 | + return $errors; |
|
| 322 | + |
|
| 323 | + |
|
| 324 | + if (!isset($user_pass) || $user_pass == '') {
|
|
| 325 | + $user_pass = wp_generate_password(12, false); |
|
| 326 | + } |
|
| 327 | + $user_id = wp_create_user($user_login, $user_pass, $user_email); |
|
| 328 | + $user_web = ''; |
|
| 329 | + /*$user_add1 = $_POST['user_add1']; |
|
| 330 | 330 | $user_add2 = $_POST['user_add2']; |
| 331 | 331 | $user_city = $_POST['user_city']; |
| 332 | 332 | $user_state = $_POST['user_state']; |
@@ -335,77 +335,77 @@ discard block |
||
| 335 | 335 | $user_web = $_POST['user_web']; |
| 336 | 336 | $user_phone = $_POST['user_phone']; |
| 337 | 337 | $user_twitter = $_POST['user_twitter']; */ |
| 338 | - $user_fname = sanitize_user($_POST['user_fname']); |
|
| 339 | - $user_fname = str_replace(",", "", $user_fname);
|
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * Filter the submitted user meta. |
|
| 343 | - * |
|
| 344 | - * @since 1.0.0 |
|
| 345 | - * |
|
| 346 | - * @param int $user_id User ID. |
|
| 347 | - */ |
|
| 348 | - $user_address_info = apply_filters('geodir_manage_user_meta', array(
|
|
| 349 | - "user_add1" => '', |
|
| 350 | - "user_add2" => '', |
|
| 351 | - "user_city" => '', |
|
| 352 | - "user_state" => '', |
|
| 353 | - "user_country" => '', |
|
| 354 | - "user_postalcode" => '', |
|
| 355 | - "user_phone" => '', |
|
| 356 | - "user_twitter" => '', |
|
| 357 | - "first_name" => $user_fname, |
|
| 358 | - "last_name" => '', |
|
| 359 | - ), $user_id); |
|
| 360 | - foreach ($user_address_info as $key => $val) {
|
|
| 361 | - update_user_meta($user_id, $key, $val); // User Address Information Here |
|
| 362 | - } |
|
| 363 | - //update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here |
|
| 364 | - $userName = $user_fname; |
|
| 365 | - update_user_meta($user_id, 'first_name', $userName); // User Address Information Here |
|
| 366 | - //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here |
|
| 367 | - |
|
| 368 | - // Changed by vikas sharma to enable all type of characters in author permalink... |
|
| 369 | - $user_nicename = sanitize_title($userName); |
|
| 370 | - |
|
| 371 | - $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
|
|
| 372 | - |
|
| 373 | - $wpdb->query($updateUsersql); |
|
| 374 | - |
|
| 375 | - if (!$user_id) {
|
|
| 376 | - $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
|
|
| 377 | - return $errors; |
|
| 378 | - } |
|
| 379 | - global $upload_folder_path; |
|
| 380 | - |
|
| 381 | - if ($user_id) {
|
|
| 382 | - |
|
| 383 | - /** |
|
| 384 | - * Called after registering a user and before the registration email is sent. |
|
| 385 | - * |
|
| 386 | - * @since 1.0.0 |
|
| 387 | - * @param int $user_id The user ID of the registered user. |
|
| 388 | - */ |
|
| 389 | - do_action('geodir_user_register', $user_id);
|
|
| 390 | - ///////REGISTRATION EMAIL START////// |
|
| 391 | - $fromEmail = geodir_get_site_email_id(); |
|
| 392 | - $fromEmailName = get_site_emailName(); |
|
| 393 | - $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
|
|
| 338 | + $user_fname = sanitize_user($_POST['user_fname']); |
|
| 339 | + $user_fname = str_replace(",", "", $user_fname);
|
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * Filter the submitted user meta. |
|
| 343 | + * |
|
| 344 | + * @since 1.0.0 |
|
| 345 | + * |
|
| 346 | + * @param int $user_id User ID. |
|
| 347 | + */ |
|
| 348 | + $user_address_info = apply_filters('geodir_manage_user_meta', array(
|
|
| 349 | + "user_add1" => '', |
|
| 350 | + "user_add2" => '', |
|
| 351 | + "user_city" => '', |
|
| 352 | + "user_state" => '', |
|
| 353 | + "user_country" => '', |
|
| 354 | + "user_postalcode" => '', |
|
| 355 | + "user_phone" => '', |
|
| 356 | + "user_twitter" => '', |
|
| 357 | + "first_name" => $user_fname, |
|
| 358 | + "last_name" => '', |
|
| 359 | + ), $user_id); |
|
| 360 | + foreach ($user_address_info as $key => $val) {
|
|
| 361 | + update_user_meta($user_id, $key, $val); // User Address Information Here |
|
| 362 | + } |
|
| 363 | + //update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here |
|
| 364 | + $userName = $user_fname; |
|
| 365 | + update_user_meta($user_id, 'first_name', $userName); // User Address Information Here |
|
| 366 | + //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here |
|
| 367 | + |
|
| 368 | + // Changed by vikas sharma to enable all type of characters in author permalink... |
|
| 369 | + $user_nicename = sanitize_title($userName); |
|
| 370 | + |
|
| 371 | + $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
|
|
| 372 | + |
|
| 373 | + $wpdb->query($updateUsersql); |
|
| 374 | + |
|
| 375 | + if (!$user_id) {
|
|
| 376 | + $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
|
|
| 377 | + return $errors; |
|
| 378 | + } |
|
| 379 | + global $upload_folder_path; |
|
| 380 | + |
|
| 381 | + if ($user_id) {
|
|
| 382 | + |
|
| 383 | + /** |
|
| 384 | + * Called after registering a user and before the registration email is sent. |
|
| 385 | + * |
|
| 386 | + * @since 1.0.0 |
|
| 387 | + * @param int $user_id The user ID of the registered user. |
|
| 388 | + */ |
|
| 389 | + do_action('geodir_user_register', $user_id);
|
|
| 390 | + ///////REGISTRATION EMAIL START////// |
|
| 391 | + $fromEmail = geodir_get_site_email_id(); |
|
| 392 | + $fromEmailName = get_site_emailName(); |
|
| 393 | + $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
|
|
| 394 | 394 | <p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
|
| 395 | 395 | <p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
|
| 396 | 396 | |
| 397 | - /////////////customer email////////////// |
|
| 398 | - //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email |
|
| 399 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email |
|
| 400 | - //////REGISTRATION EMAIL END//////// |
|
| 401 | - } |
|
| 397 | + /////////////customer email////////////// |
|
| 398 | + //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email |
|
| 399 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email |
|
| 400 | + //////REGISTRATION EMAIL END//////// |
|
| 401 | + } |
|
| 402 | 402 | |
| 403 | - if (get_option('ptthemes_auto_login')) {
|
|
| 404 | - $errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
|
|
| 405 | - return $errors; |
|
| 406 | - } |
|
| 403 | + if (get_option('ptthemes_auto_login')) {
|
|
| 404 | + $errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
|
|
| 405 | + return $errors; |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | - return array($user_id, $user_pass); |
|
| 408 | + return array($user_id, $user_pass); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
@@ -418,317 +418,317 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | function geodir_user_signup() |
| 420 | 420 | {
|
| 421 | - global $errors; |
|
| 422 | - $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; |
|
| 423 | - |
|
| 424 | - $errors = new WP_Error(); |
|
| 425 | - |
|
| 426 | - if (isset($_GET['key'])) |
|
| 427 | - $action = 'resetpass'; |
|
| 428 | - |
|
| 429 | - // validate action so as to default to the login screen |
|
| 430 | - if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
|
|
| 431 | - $action = 'login'; |
|
| 432 | - |
|
| 433 | - nocache_headers(); |
|
| 434 | - |
|
| 435 | - if (defined('RELOCATE')) { // Move flag is set
|
|
| 436 | - if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) |
|
| 437 | - $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
|
| 438 | - |
|
| 439 | - $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://'; |
|
| 440 | - if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) |
|
| 441 | - update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
|
|
| 442 | - } |
|
| 443 | - |
|
| 444 | - //Set a cookie now to see if they are supported by the browser. |
|
| 445 | - //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); |
|
| 446 | - if (SITECOOKIEPATH != COOKIEPATH) |
|
| 447 | - setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN); |
|
| 448 | - |
|
| 449 | - /** |
|
| 450 | - * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page. |
|
| 451 | - * |
|
| 452 | - * Used dynamic hook login_form_$action |
|
| 453 | - * |
|
| 454 | - * @since 1.0.0 |
|
| 455 | - */ |
|
| 456 | - do_action('login_form_' . $action);
|
|
| 457 | - |
|
| 458 | - $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
|
|
| 459 | - |
|
| 460 | - switch ($action): |
|
| 461 | - |
|
| 462 | - case 'logout' : |
|
| 463 | - //check_admin_referer('log-out');
|
|
| 464 | - wp_logout(); |
|
| 465 | - |
|
| 466 | - $redirect_to = $_SERVER['HTTP_REFERER']; |
|
| 467 | - //$redirect_to = home_url().'/?ptype=login&loggedout=true'; |
|
| 468 | - if (isset($_REQUEST['redirect_to'])) |
|
| 469 | - $redirect_to = $_REQUEST['redirect_to']; |
|
| 470 | - $redirect_to = home_url(); |
|
| 471 | - wp_safe_redirect($redirect_to); |
|
| 472 | - exit(); |
|
| 473 | - |
|
| 474 | - break; |
|
| 475 | - |
|
| 476 | - case 'lostpassword' : |
|
| 477 | - case 'retrievepassword' : |
|
| 478 | - if ($http_post) {
|
|
| 479 | - $errors = geodir_retrieve_password(); |
|
| 480 | - $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : ''; |
|
| 481 | - if (!is_wp_error($errors)) {
|
|
| 482 | - wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
|
|
| 483 | - gd_die(); |
|
| 484 | - } else {
|
|
| 485 | - wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
|
|
| 486 | - gd_die(); |
|
| 487 | - } |
|
| 488 | - } |
|
| 489 | - if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
|
|
| 490 | - /** |
|
| 491 | - * Called in the geodir_user_signup() function during the lostpassword case. |
|
| 492 | - * |
|
| 493 | - * @since 1.0.0 |
|
| 494 | - */ |
|
| 495 | - do_action('lost_password');
|
|
| 496 | - $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>'; |
|
| 497 | - $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; |
|
| 498 | - |
|
| 499 | - break; |
|
| 500 | - |
|
| 501 | - case 'resetpass' : |
|
| 502 | - case 'rp' : |
|
| 503 | - $errors = reset_password($_GET['key'], $_GET['login']); |
|
| 504 | - |
|
| 505 | - if (!is_wp_error($errors)) {
|
|
| 506 | - wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
|
|
| 507 | - exit(); |
|
| 508 | - } |
|
| 509 | - |
|
| 510 | - wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
|
|
| 511 | - exit(); |
|
| 512 | - |
|
| 513 | - break; |
|
| 514 | - |
|
| 515 | - case 'register' : |
|
| 516 | - ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ############################## |
|
| 517 | - if (!get_option('users_can_register')) {
|
|
| 518 | - wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
|
|
| 519 | - exit(); |
|
| 520 | - } |
|
| 521 | - ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ############################## |
|
| 522 | - global $user_email, $user_fname; |
|
| 523 | - $user_login = ''; |
|
| 524 | - $user_email = ''; |
|
| 525 | - if ($http_post) {
|
|
| 526 | - $user_login = $_POST['user_email']; |
|
| 527 | - $user_email = $_POST['user_email']; |
|
| 528 | - $user_fname = $_POST['user_fname']; |
|
| 529 | - |
|
| 530 | - $errors = geodir_register_new_user($user_login, $user_email); |
|
| 531 | - |
|
| 532 | - /* display error in registration form */ |
|
| 533 | - if (is_wp_error($errors)) {
|
|
| 534 | - $error_code = $errors->get_error_code(); |
|
| 535 | - $error_message = $errors->get_error_message($error_code); |
|
| 536 | - if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
|
|
| 537 | - if ($error_code == 'empty_username') {
|
|
| 538 | - $error_code = 'empty_email'; |
|
| 539 | - } else if ($error_code == 'invalid_username') {
|
|
| 540 | - $error_code = 'invalid_email'; |
|
| 541 | - } else if ($error_code == 'username_exists') {
|
|
| 542 | - $error_code = 'email_exists'; |
|
| 543 | - } |
|
| 544 | - |
|
| 545 | - $error_message = $errors->get_error_message($error_code); |
|
| 546 | - } |
|
| 547 | - global $geodir_signup_error; |
|
| 548 | - $geodir_signup_error = $error_message; |
|
| 549 | - } |
|
| 550 | - |
|
| 551 | - if (!is_wp_error($errors)) {
|
|
| 552 | - $_POST['log'] = $user_login; |
|
| 553 | - $_POST['pwd'] = $errors[1]; |
|
| 554 | - $_POST['testcookie'] = 1; |
|
| 555 | - |
|
| 556 | - $secure_cookie = ''; |
|
| 557 | - // If the user wants ssl but the session is not ssl, force a secure cookie. |
|
| 558 | - if (!empty($_POST['log'])) {
|
|
| 559 | - $user_name = sanitize_user($_POST['log']); |
|
| 560 | - if ($user = get_user_by('email', $user_name)) {
|
|
| 561 | - if (get_user_option('use_ssl', $user->ID)) {
|
|
| 562 | - $secure_cookie = true; |
|
| 563 | - force_ssl_admin(true); |
|
| 564 | - } |
|
| 565 | - } |
|
| 566 | - } |
|
| 567 | - |
|
| 568 | - $redirect_to = $_REQUEST['redirect_to']; |
|
| 569 | - |
|
| 570 | - if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
|
|
| 571 | - if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
|
|
| 572 | - $redirect_to = $_SERVER['HTTP_REFERER']; |
|
| 573 | - } else {
|
|
| 574 | - $redirect_to = home_url(); |
|
| 575 | - } |
|
| 576 | - |
|
| 577 | - } |
|
| 578 | - |
|
| 579 | - if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
|
|
| 580 | - |
|
| 581 | - $redirect_to = $_REQUEST['redirect_add_listing']; |
|
| 582 | - } |
|
| 583 | - |
|
| 584 | - |
|
| 585 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 586 | - $secure_cookie = false; |
|
| 587 | - |
|
| 588 | - $user = wp_signon('', $secure_cookie);
|
|
| 589 | - |
|
| 590 | - $requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''); |
|
| 591 | - /** |
|
| 592 | - * Filter the login redirect URL. |
|
| 593 | - * |
|
| 594 | - * @since 1.4.9 |
|
| 595 | - * @param string $redirect_to The redirect destination URL. |
|
| 596 | - * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
|
| 597 | - * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
| 598 | - */ |
|
| 599 | - $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
|
|
| 600 | - |
|
| 601 | - |
|
| 602 | - if (!is_wp_error($user)) {
|
|
| 603 | - wp_safe_redirect($redirect_to); |
|
| 604 | - exit(); |
|
| 605 | - } |
|
| 606 | - exit(); |
|
| 607 | - } |
|
| 608 | - } |
|
| 609 | - |
|
| 610 | - break; |
|
| 611 | - |
|
| 612 | - case 'login' : |
|
| 613 | - default: |
|
| 614 | - $secure_cookie = ''; |
|
| 615 | - |
|
| 616 | - if (!empty($_POST['log'])) {
|
|
| 617 | - $user_name = sanitize_user($_POST['log']); |
|
| 618 | - if ($user = get_user_by('login', $user_name)) {
|
|
| 619 | - |
|
| 620 | - if (get_user_option('use_ssl', $user->ID)) {
|
|
| 621 | - $secure_cookie = true; |
|
| 622 | - force_ssl_admin(true); |
|
| 623 | - } |
|
| 624 | - } elseif ($user = get_user_by('email', $user_name)) {
|
|
| 625 | - $_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login |
|
| 626 | - if (get_user_option('use_ssl', $user->ID)) {
|
|
| 627 | - $secure_cookie = true; |
|
| 628 | - force_ssl_admin(true); |
|
| 629 | - } |
|
| 630 | - } |
|
| 631 | - } |
|
| 632 | - /////////////////////////// |
|
| 633 | - if (isset($_REQUEST['redirect_add_listing'])) {
|
|
| 634 | - $_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing']; |
|
| 635 | - } |
|
| 636 | - |
|
| 637 | - |
|
| 638 | - if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
|
|
| 639 | - if (is_user_logged_in()) : |
|
| 640 | - $user_ID = isset($user->ID) ? $user->ID : ''; |
|
| 641 | - $author_link = get_author_posts_url($user_ID); |
|
| 642 | - $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
|
|
| 643 | - |
|
| 644 | - /** |
|
| 645 | - * Filter the author link. |
|
| 646 | - * |
|
| 647 | - * @since 1.0.0 |
|
| 648 | - * |
|
| 649 | - * @param string $default_author_link Default author link. |
|
| 650 | - * @param int $user_ID The user ID. |
|
| 651 | - */ |
|
| 652 | - $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
|
|
| 653 | - |
|
| 654 | - $_REQUEST['redirect_to'] = $default_author_link; |
|
| 655 | - else: |
|
| 656 | - $_REQUEST['redirect_to'] = home_url(); |
|
| 657 | - endif; |
|
| 658 | - |
|
| 659 | - } |
|
| 660 | - if (isset($_REQUEST['redirect_to'])) {
|
|
| 661 | - $redirect_to = $_REQUEST['redirect_to']; |
|
| 662 | - // Redirect to https if user wants ssl |
|
| 663 | - if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) |
|
| 664 | - $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
|
| 665 | - } else {
|
|
| 666 | - $redirect_to = admin_url(); |
|
| 667 | - } |
|
| 668 | - |
|
| 669 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 670 | - $secure_cookie = false; |
|
| 671 | - $user = wp_signon('', $secure_cookie);
|
|
| 672 | - |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * Filter the login redirect URL. |
|
| 676 | - * |
|
| 677 | - * @since 1.4.9 |
|
| 678 | - * @param string $redirect_to The redirect destination URL. |
|
| 679 | - * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
| 680 | - */ |
|
| 681 | - $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
|
|
| 682 | - |
|
| 683 | - if (is_wp_error($user)) {
|
|
| 684 | - if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
|
|
| 685 | - wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); |
|
| 686 | - } |
|
| 687 | - } |
|
| 688 | - if (!is_wp_error($user)) {
|
|
| 689 | - |
|
| 690 | - // Some servers are not logging the user in properly after wp_signon, se we set the user here. |
|
| 691 | - //wp_set_current_user($user->ID); |
|
| 692 | - //echo '###';exit; |
|
| 693 | - |
|
| 694 | - if ($redirect_to) {
|
|
| 695 | - wp_redirect($redirect_to); |
|
| 696 | - } else {
|
|
| 697 | - wp_redirect(home_url()); |
|
| 698 | - } |
|
| 699 | - gd_die(); |
|
| 700 | - } |
|
| 701 | - |
|
| 702 | - $errors = $user; |
|
| 703 | - |
|
| 704 | - // Clear errors if loggedout is set. |
|
| 705 | - if (!empty($_GET['loggedout'])) |
|
| 706 | - $errors = new WP_Error(); |
|
| 707 | - // If cookies are disabled we can't log in even with a valid user+pass |
|
| 708 | - if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) |
|
| 709 | - $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
|
|
| 710 | - |
|
| 711 | - // Some parts of this script use the main login form to display a message |
|
| 712 | - if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
|
|
| 713 | - $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; |
|
| 714 | - } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
|
|
| 715 | - $successmsg = USER_REG_NOT_ALLOW_MSG; |
|
| 716 | - } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
|
|
| 717 | - $successmsg = EMAIL_CONFIRM_LINK_MSG; |
|
| 718 | - } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
|
|
| 719 | - $successmsg = NEW_PW_EMAIL_MSG; |
|
| 720 | - } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
|
|
| 721 | - $successmsg = REG_COMPLETE_MSG; |
|
| 722 | - } |
|
| 723 | - |
|
| 724 | - if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
|
|
| 725 | - if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
|
|
| 726 | - wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); |
|
| 727 | - } else {
|
|
| 728 | - wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
|
|
| 729 | - } |
|
| 730 | - gd_die(); |
|
| 731 | - } |
|
| 732 | - break; |
|
| 733 | - endswitch; // end action switch |
|
| 421 | + global $errors; |
|
| 422 | + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; |
|
| 423 | + |
|
| 424 | + $errors = new WP_Error(); |
|
| 425 | + |
|
| 426 | + if (isset($_GET['key'])) |
|
| 427 | + $action = 'resetpass'; |
|
| 428 | + |
|
| 429 | + // validate action so as to default to the login screen |
|
| 430 | + if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
|
|
| 431 | + $action = 'login'; |
|
| 432 | + |
|
| 433 | + nocache_headers(); |
|
| 434 | + |
|
| 435 | + if (defined('RELOCATE')) { // Move flag is set
|
|
| 436 | + if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) |
|
| 437 | + $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
|
| 438 | + |
|
| 439 | + $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://'; |
|
| 440 | + if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) |
|
| 441 | + update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
|
|
| 442 | + } |
|
| 443 | + |
|
| 444 | + //Set a cookie now to see if they are supported by the browser. |
|
| 445 | + //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); |
|
| 446 | + if (SITECOOKIEPATH != COOKIEPATH) |
|
| 447 | + setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN); |
|
| 448 | + |
|
| 449 | + /** |
|
| 450 | + * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page. |
|
| 451 | + * |
|
| 452 | + * Used dynamic hook login_form_$action |
|
| 453 | + * |
|
| 454 | + * @since 1.0.0 |
|
| 455 | + */ |
|
| 456 | + do_action('login_form_' . $action);
|
|
| 457 | + |
|
| 458 | + $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
|
|
| 459 | + |
|
| 460 | + switch ($action): |
|
| 461 | + |
|
| 462 | + case 'logout' : |
|
| 463 | + //check_admin_referer('log-out');
|
|
| 464 | + wp_logout(); |
|
| 465 | + |
|
| 466 | + $redirect_to = $_SERVER['HTTP_REFERER']; |
|
| 467 | + //$redirect_to = home_url().'/?ptype=login&loggedout=true'; |
|
| 468 | + if (isset($_REQUEST['redirect_to'])) |
|
| 469 | + $redirect_to = $_REQUEST['redirect_to']; |
|
| 470 | + $redirect_to = home_url(); |
|
| 471 | + wp_safe_redirect($redirect_to); |
|
| 472 | + exit(); |
|
| 473 | + |
|
| 474 | + break; |
|
| 475 | + |
|
| 476 | + case 'lostpassword' : |
|
| 477 | + case 'retrievepassword' : |
|
| 478 | + if ($http_post) {
|
|
| 479 | + $errors = geodir_retrieve_password(); |
|
| 480 | + $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : ''; |
|
| 481 | + if (!is_wp_error($errors)) {
|
|
| 482 | + wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
|
|
| 483 | + gd_die(); |
|
| 484 | + } else {
|
|
| 485 | + wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
|
|
| 486 | + gd_die(); |
|
| 487 | + } |
|
| 488 | + } |
|
| 489 | + if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
|
|
| 490 | + /** |
|
| 491 | + * Called in the geodir_user_signup() function during the lostpassword case. |
|
| 492 | + * |
|
| 493 | + * @since 1.0.0 |
|
| 494 | + */ |
|
| 495 | + do_action('lost_password');
|
|
| 496 | + $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>'; |
|
| 497 | + $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; |
|
| 498 | + |
|
| 499 | + break; |
|
| 500 | + |
|
| 501 | + case 'resetpass' : |
|
| 502 | + case 'rp' : |
|
| 503 | + $errors = reset_password($_GET['key'], $_GET['login']); |
|
| 504 | + |
|
| 505 | + if (!is_wp_error($errors)) {
|
|
| 506 | + wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
|
|
| 507 | + exit(); |
|
| 508 | + } |
|
| 509 | + |
|
| 510 | + wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
|
|
| 511 | + exit(); |
|
| 512 | + |
|
| 513 | + break; |
|
| 514 | + |
|
| 515 | + case 'register' : |
|
| 516 | + ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ############################## |
|
| 517 | + if (!get_option('users_can_register')) {
|
|
| 518 | + wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
|
|
| 519 | + exit(); |
|
| 520 | + } |
|
| 521 | + ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ############################## |
|
| 522 | + global $user_email, $user_fname; |
|
| 523 | + $user_login = ''; |
|
| 524 | + $user_email = ''; |
|
| 525 | + if ($http_post) {
|
|
| 526 | + $user_login = $_POST['user_email']; |
|
| 527 | + $user_email = $_POST['user_email']; |
|
| 528 | + $user_fname = $_POST['user_fname']; |
|
| 529 | + |
|
| 530 | + $errors = geodir_register_new_user($user_login, $user_email); |
|
| 531 | + |
|
| 532 | + /* display error in registration form */ |
|
| 533 | + if (is_wp_error($errors)) {
|
|
| 534 | + $error_code = $errors->get_error_code(); |
|
| 535 | + $error_message = $errors->get_error_message($error_code); |
|
| 536 | + if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
|
|
| 537 | + if ($error_code == 'empty_username') {
|
|
| 538 | + $error_code = 'empty_email'; |
|
| 539 | + } else if ($error_code == 'invalid_username') {
|
|
| 540 | + $error_code = 'invalid_email'; |
|
| 541 | + } else if ($error_code == 'username_exists') {
|
|
| 542 | + $error_code = 'email_exists'; |
|
| 543 | + } |
|
| 544 | + |
|
| 545 | + $error_message = $errors->get_error_message($error_code); |
|
| 546 | + } |
|
| 547 | + global $geodir_signup_error; |
|
| 548 | + $geodir_signup_error = $error_message; |
|
| 549 | + } |
|
| 550 | + |
|
| 551 | + if (!is_wp_error($errors)) {
|
|
| 552 | + $_POST['log'] = $user_login; |
|
| 553 | + $_POST['pwd'] = $errors[1]; |
|
| 554 | + $_POST['testcookie'] = 1; |
|
| 555 | + |
|
| 556 | + $secure_cookie = ''; |
|
| 557 | + // If the user wants ssl but the session is not ssl, force a secure cookie. |
|
| 558 | + if (!empty($_POST['log'])) {
|
|
| 559 | + $user_name = sanitize_user($_POST['log']); |
|
| 560 | + if ($user = get_user_by('email', $user_name)) {
|
|
| 561 | + if (get_user_option('use_ssl', $user->ID)) {
|
|
| 562 | + $secure_cookie = true; |
|
| 563 | + force_ssl_admin(true); |
|
| 564 | + } |
|
| 565 | + } |
|
| 566 | + } |
|
| 567 | + |
|
| 568 | + $redirect_to = $_REQUEST['redirect_to']; |
|
| 569 | + |
|
| 570 | + if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
|
|
| 571 | + if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
|
|
| 572 | + $redirect_to = $_SERVER['HTTP_REFERER']; |
|
| 573 | + } else {
|
|
| 574 | + $redirect_to = home_url(); |
|
| 575 | + } |
|
| 576 | + |
|
| 577 | + } |
|
| 578 | + |
|
| 579 | + if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
|
|
| 580 | + |
|
| 581 | + $redirect_to = $_REQUEST['redirect_add_listing']; |
|
| 582 | + } |
|
| 583 | + |
|
| 584 | + |
|
| 585 | + if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 586 | + $secure_cookie = false; |
|
| 587 | + |
|
| 588 | + $user = wp_signon('', $secure_cookie);
|
|
| 589 | + |
|
| 590 | + $requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''); |
|
| 591 | + /** |
|
| 592 | + * Filter the login redirect URL. |
|
| 593 | + * |
|
| 594 | + * @since 1.4.9 |
|
| 595 | + * @param string $redirect_to The redirect destination URL. |
|
| 596 | + * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
|
| 597 | + * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
| 598 | + */ |
|
| 599 | + $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
|
|
| 600 | + |
|
| 601 | + |
|
| 602 | + if (!is_wp_error($user)) {
|
|
| 603 | + wp_safe_redirect($redirect_to); |
|
| 604 | + exit(); |
|
| 605 | + } |
|
| 606 | + exit(); |
|
| 607 | + } |
|
| 608 | + } |
|
| 609 | + |
|
| 610 | + break; |
|
| 611 | + |
|
| 612 | + case 'login' : |
|
| 613 | + default: |
|
| 614 | + $secure_cookie = ''; |
|
| 615 | + |
|
| 616 | + if (!empty($_POST['log'])) {
|
|
| 617 | + $user_name = sanitize_user($_POST['log']); |
|
| 618 | + if ($user = get_user_by('login', $user_name)) {
|
|
| 619 | + |
|
| 620 | + if (get_user_option('use_ssl', $user->ID)) {
|
|
| 621 | + $secure_cookie = true; |
|
| 622 | + force_ssl_admin(true); |
|
| 623 | + } |
|
| 624 | + } elseif ($user = get_user_by('email', $user_name)) {
|
|
| 625 | + $_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login |
|
| 626 | + if (get_user_option('use_ssl', $user->ID)) {
|
|
| 627 | + $secure_cookie = true; |
|
| 628 | + force_ssl_admin(true); |
|
| 629 | + } |
|
| 630 | + } |
|
| 631 | + } |
|
| 632 | + /////////////////////////// |
|
| 633 | + if (isset($_REQUEST['redirect_add_listing'])) {
|
|
| 634 | + $_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing']; |
|
| 635 | + } |
|
| 636 | + |
|
| 637 | + |
|
| 638 | + if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
|
|
| 639 | + if (is_user_logged_in()) : |
|
| 640 | + $user_ID = isset($user->ID) ? $user->ID : ''; |
|
| 641 | + $author_link = get_author_posts_url($user_ID); |
|
| 642 | + $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
|
|
| 643 | + |
|
| 644 | + /** |
|
| 645 | + * Filter the author link. |
|
| 646 | + * |
|
| 647 | + * @since 1.0.0 |
|
| 648 | + * |
|
| 649 | + * @param string $default_author_link Default author link. |
|
| 650 | + * @param int $user_ID The user ID. |
|
| 651 | + */ |
|
| 652 | + $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
|
|
| 653 | + |
|
| 654 | + $_REQUEST['redirect_to'] = $default_author_link; |
|
| 655 | + else: |
|
| 656 | + $_REQUEST['redirect_to'] = home_url(); |
|
| 657 | + endif; |
|
| 658 | + |
|
| 659 | + } |
|
| 660 | + if (isset($_REQUEST['redirect_to'])) {
|
|
| 661 | + $redirect_to = $_REQUEST['redirect_to']; |
|
| 662 | + // Redirect to https if user wants ssl |
|
| 663 | + if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) |
|
| 664 | + $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
|
| 665 | + } else {
|
|
| 666 | + $redirect_to = admin_url(); |
|
| 667 | + } |
|
| 668 | + |
|
| 669 | + if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 670 | + $secure_cookie = false; |
|
| 671 | + $user = wp_signon('', $secure_cookie);
|
|
| 672 | + |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * Filter the login redirect URL. |
|
| 676 | + * |
|
| 677 | + * @since 1.4.9 |
|
| 678 | + * @param string $redirect_to The redirect destination URL. |
|
| 679 | + * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
| 680 | + */ |
|
| 681 | + $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
|
|
| 682 | + |
|
| 683 | + if (is_wp_error($user)) {
|
|
| 684 | + if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
|
|
| 685 | + wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); |
|
| 686 | + } |
|
| 687 | + } |
|
| 688 | + if (!is_wp_error($user)) {
|
|
| 689 | + |
|
| 690 | + // Some servers are not logging the user in properly after wp_signon, se we set the user here. |
|
| 691 | + //wp_set_current_user($user->ID); |
|
| 692 | + //echo '###';exit; |
|
| 693 | + |
|
| 694 | + if ($redirect_to) {
|
|
| 695 | + wp_redirect($redirect_to); |
|
| 696 | + } else {
|
|
| 697 | + wp_redirect(home_url()); |
|
| 698 | + } |
|
| 699 | + gd_die(); |
|
| 700 | + } |
|
| 701 | + |
|
| 702 | + $errors = $user; |
|
| 703 | + |
|
| 704 | + // Clear errors if loggedout is set. |
|
| 705 | + if (!empty($_GET['loggedout'])) |
|
| 706 | + $errors = new WP_Error(); |
|
| 707 | + // If cookies are disabled we can't log in even with a valid user+pass |
|
| 708 | + if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) |
|
| 709 | + $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
|
|
| 710 | + |
|
| 711 | + // Some parts of this script use the main login form to display a message |
|
| 712 | + if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
|
|
| 713 | + $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; |
|
| 714 | + } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
|
|
| 715 | + $successmsg = USER_REG_NOT_ALLOW_MSG; |
|
| 716 | + } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
|
|
| 717 | + $successmsg = EMAIL_CONFIRM_LINK_MSG; |
|
| 718 | + } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
|
|
| 719 | + $successmsg = NEW_PW_EMAIL_MSG; |
|
| 720 | + } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
|
|
| 721 | + $successmsg = REG_COMPLETE_MSG; |
|
| 722 | + } |
|
| 723 | + |
|
| 724 | + if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
|
|
| 725 | + if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
|
|
| 726 | + wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); |
|
| 727 | + } else {
|
|
| 728 | + wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
|
|
| 729 | + } |
|
| 730 | + gd_die(); |
|
| 731 | + } |
|
| 732 | + break; |
|
| 733 | + endswitch; // end action switch |
|
| 734 | 734 | } |
| 735 | 735 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | if ($redirect) {
|
| 23 | 23 | ?> |
| 24 | 24 | <script type="text/javascript"> |
| 25 | - window.location.href = '<?php echo geodir_login_url();?>'; |
|
| 25 | + window.location.href = '<?php echo geodir_login_url(); ?>'; |
|
| 26 | 26 | </script> |
| 27 | 27 | <?php |
| 28 | 28 | } else |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
|
| 48 | 48 | exit(); |
| 49 | 49 | } else {
|
| 50 | - wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
|
| 50 | + wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
|
| 51 | 51 | exit(); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param string $message Login message. |
| 61 | 61 | */ |
| 62 | 62 | $message = apply_filters('login_message', $message);
|
| 63 | - if (!empty($message)) echo $message . "\n"; |
|
| 63 | + if (!empty($message)) echo $message."\n"; |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | wp_set_password($new_pass, $user->ID); |
| 210 | 210 | update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag. |
| 211 | - $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
|
|
| 212 | - $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
|
|
| 213 | - $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
|
|
| 211 | + $message = '<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>';
|
|
| 212 | + $message .= '<p>'.sprintf(__('Username: %s', 'geodirectory'), $user->user_login)."</p>";
|
|
| 213 | + $message .= '<p>'.sprintf(__('Password: %s', 'geodirectory'), $new_pass)."</p>";
|
|
| 214 | 214 | //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is : ".home_url()."/?ptype=login</p>"; |
| 215 | 215 | //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
|
| 216 | 216 | $user_email = $user_data->user_email; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | $message = apply_filters('password_reset_message', $message, $new_pass);
|
| 238 | 238 | //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email |
| 239 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email |
|
| 239 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID); ///forgot password email |
|
| 240 | 240 | |
| 241 | 241 | return true; |
| 242 | 242 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @param object $errors Registration error messages. |
| 317 | 317 | */ |
| 318 | - $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
|
|
| 318 | + $errors = apply_filters('registration_errors', $errors, $user_login, $user_email);
|
|
| 319 | 319 | |
| 320 | 320 | if ($errors->get_error_code()) |
| 321 | 321 | return $errors; |
@@ -390,13 +390,13 @@ discard block |
||
| 390 | 390 | ///////REGISTRATION EMAIL START////// |
| 391 | 391 | $fromEmail = geodir_get_site_email_id(); |
| 392 | 392 | $fromEmailName = get_site_emailName(); |
| 393 | - $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
|
|
| 394 | -<p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
|
|
| 395 | -<p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
|
|
| 393 | + $message = __('<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>
|
|
| 394 | +<p>' . __('Username:', 'geodirectory').' '.$user_login.'</p>
|
|
| 395 | +<p>' . __('Password:', 'geodirectory').' '.$user_pass.'</p>');
|
|
| 396 | 396 | |
| 397 | 397 | /////////////customer email////////////// |
| 398 | 398 | //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email |
| 399 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email |
|
| 399 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id); /// registration email |
|
| 400 | 400 | //////REGISTRATION EMAIL END//////// |
| 401 | 401 | } |
| 402 | 402 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $action = 'resetpass'; |
| 428 | 428 | |
| 429 | 429 | // validate action so as to default to the login screen |
| 430 | - if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
|
|
| 430 | + if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_'.$action))
|
|
| 431 | 431 | $action = 'login'; |
| 432 | 432 | |
| 433 | 433 | nocache_headers(); |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
| 438 | 438 | |
| 439 | 439 | $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://'; |
| 440 | - if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) |
|
| 441 | - update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
|
|
| 440 | + if (dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']) != home_url()) |
|
| 441 | + update_option('siteurl', dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']));
|
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | //Set a cookie now to see if they are supported by the browser. |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * |
| 454 | 454 | * @since 1.0.0 |
| 455 | 455 | */ |
| 456 | - do_action('login_form_' . $action);
|
|
| 456 | + do_action('login_form_'.$action);
|
|
| 457 | 457 | |
| 458 | 458 | $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
|
| 459 | 459 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @since 1.0.0 |
| 494 | 494 | */ |
| 495 | 495 | do_action('lost_password');
|
| 496 | - $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>'; |
|
| 496 | + $message = '<div class="sucess_msg">'.ENTER_USER_EMAIL_NEW_PW_MSG.'</div>'; |
|
| 497 | 497 | $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; |
| 498 | 498 | |
| 499 | 499 | break; |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | exit(); |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
|
|
| 510 | + wp_redirect(geodir_login_url(array('error'=>'invalidkey', 'action'=>'lostpassword')));
|
|
| 511 | 511 | exit(); |
| 512 | 512 | |
| 513 | 513 | break; |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | if (is_wp_error($user)) {
|
| 684 | 684 | if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
|
| 685 | - wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); |
|
| 685 | + wp_redirect($_SERVER['HTTP_REFERER'].'&emsg=1'); |
|
| 686 | 686 | } |
| 687 | 687 | } |
| 688 | 688 | if (!is_wp_error($user)) {
|
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | |
| 711 | 711 | // Some parts of this script use the main login form to display a message |
| 712 | 712 | if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
|
| 713 | - $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; |
|
| 713 | + $successmsg = '<div class="sucess_msg">'.YOU_ARE_LOGED_OUT_MSG.'</div>'; |
|
| 714 | 714 | } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
|
| 715 | 715 | $successmsg = USER_REG_NOT_ALLOW_MSG; |
| 716 | 716 | } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
|
@@ -723,9 +723,9 @@ discard block |
||
| 723 | 723 | |
| 724 | 724 | if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
|
| 725 | 725 | if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
|
| 726 | - wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); |
|
| 726 | + wp_redirect($_REQUEST['pagetype'].'&emsg=1'); |
|
| 727 | 727 | } else {
|
| 728 | - wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
|
|
| 728 | + wp_redirect(geodir_login_url(array('logemsg'=>'1', 'redirect_to'=>urlencode($_REQUEST['redirect_to']))));
|
|
| 729 | 729 | } |
| 730 | 730 | gd_die(); |
| 731 | 731 | } |