@@ -35,23 +35,26 @@ discard block |
||
35 | 35 | |
36 | 36 | /* ---- Delete field ---- */ |
37 | 37 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
38 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
39 | - return; |
|
38 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) { |
|
39 | + return; |
|
40 | + } |
|
40 | 41 | |
41 | 42 | echo geodir_custom_field_delete($field_id); |
42 | 43 | } |
43 | 44 | |
44 | 45 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
45 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
46 | - return; |
|
46 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) { |
|
47 | + return; |
|
48 | + } |
|
47 | 49 | |
48 | 50 | echo geodir_custom_sort_field_delete($field_id); |
49 | 51 | } |
50 | 52 | |
51 | 53 | /* ---- Save field ---- */ |
52 | 54 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
53 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
54 | - return; |
|
55 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) { |
|
56 | + return; |
|
57 | + } |
|
55 | 58 | |
56 | 59 | foreach ($_REQUEST as $pkey => $pval) { |
57 | 60 | if (is_array($_REQUEST[$pkey])) { |
@@ -77,8 +80,9 @@ discard block |
||
77 | 80 | |
78 | 81 | /* ---- Save sort field ---- */ |
79 | 82 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
80 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
81 | - return; |
|
83 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) { |
|
84 | + return; |
|
85 | + } |
|
82 | 86 | |
83 | 87 | foreach ($_REQUEST as $pkey => $pval) { |
84 | 88 | if (is_array($_REQUEST[$pkey])) { |
@@ -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) { |
@@ -23,8 +23,12 @@ |
||
23 | 23 | |
24 | 24 | $collate = ''; |
25 | 25 | if ($wpdb->has_cap('collation')) { |
26 | - if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
27 | - if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate"; |
|
26 | + if (!empty($wpdb->charset)) { |
|
27 | + $collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
28 | + } |
|
29 | + if (!empty($wpdb->collate)) { |
|
30 | + $collate .= " COLLATE $wpdb->collate"; |
|
31 | + } |
|
28 | 32 | } |
29 | 33 | |
30 | 34 | /** |
@@ -32,35 +32,35 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0.0 |
34 | 34 | */ |
35 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
35 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | // rename tables if we need to |
39 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_countries'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_countries'") == 0) { |
|
40 | - $wpdb->query("RENAME TABLE geodir_countries TO " . $wpdb->prefix . "geodir_countries"); |
|
39 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_countries'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_countries'") == 0) { |
|
40 | + $wpdb->query("RENAME TABLE geodir_countries TO ".$wpdb->prefix."geodir_countries"); |
|
41 | 41 | } |
42 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_fields'") == 0) { |
|
43 | - $wpdb->query("RENAME TABLE geodir_custom_fields TO " . $wpdb->prefix . "geodir_custom_fields"); |
|
42 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_custom_fields'") == 0) { |
|
43 | + $wpdb->query("RENAME TABLE geodir_custom_fields TO ".$wpdb->prefix."geodir_custom_fields"); |
|
44 | 44 | } |
45 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_icon'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_icon'") == 0) { |
|
46 | - $wpdb->query("RENAME TABLE geodir_post_icon TO " . $wpdb->prefix . "geodir_post_icon"); |
|
45 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_icon'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_post_icon'") == 0) { |
|
46 | + $wpdb->query("RENAME TABLE geodir_post_icon TO ".$wpdb->prefix."geodir_post_icon"); |
|
47 | 47 | } |
48 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_attachments'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_attachments'") == 0) { |
|
49 | - $wpdb->query("RENAME TABLE geodir_attachments TO " . $wpdb->prefix . "geodir_attachments"); |
|
48 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_attachments'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_attachments'") == 0) { |
|
49 | + $wpdb->query("RENAME TABLE geodir_attachments TO ".$wpdb->prefix."geodir_attachments"); |
|
50 | 50 | } |
51 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_review'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_review'") == 0) { |
|
52 | - $wpdb->query("RENAME TABLE geodir_post_review TO " . $wpdb->prefix . "geodir_post_review"); |
|
51 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_review'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_post_review'") == 0) { |
|
52 | + $wpdb->query("RENAME TABLE geodir_post_review TO ".$wpdb->prefix."geodir_post_review"); |
|
53 | 53 | } |
54 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_sort_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_sort_fields'") == 0) { |
|
55 | - $wpdb->query("RENAME TABLE geodir_custom_sort_fields TO " . $wpdb->prefix . "geodir_custom_sort_fields"); |
|
54 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_sort_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_custom_sort_fields'") == 0) { |
|
55 | + $wpdb->query("RENAME TABLE geodir_custom_sort_fields TO ".$wpdb->prefix."geodir_custom_sort_fields"); |
|
56 | 56 | } |
57 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_gd_place_detail'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_gd_place_detail'") == 0) { |
|
58 | - $wpdb->query("RENAME TABLE geodir_gd_place_detail TO " . $wpdb->prefix . "geodir_gd_place_detail"); |
|
57 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_gd_place_detail'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."geodir_gd_place_detail'") == 0) { |
|
58 | + $wpdb->query("RENAME TABLE geodir_gd_place_detail TO ".$wpdb->prefix."geodir_gd_place_detail"); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | // Table for storing Countries |
63 | - $GEODIR_COUNTRIES_TABLE = "CREATE TABLE " . GEODIR_COUNTRIES_TABLE . " ( |
|
63 | + $GEODIR_COUNTRIES_TABLE = "CREATE TABLE ".GEODIR_COUNTRIES_TABLE." ( |
|
64 | 64 | CountryId smallint AUTO_INCREMENT NOT NULL , |
65 | 65 | Country varchar (50) NOT NULL , |
66 | 66 | FIPS104 varchar (2) NOT NULL , |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | dbDelta($GEODIR_COUNTRIES_TABLE); |
90 | 90 | |
91 | 91 | |
92 | - $country_table_empty = $wpdb->get_var("SELECT COUNT(CountryId) FROM " . GEODIR_COUNTRIES_TABLE . ""); |
|
92 | + $country_table_empty = $wpdb->get_var("SELECT COUNT(CountryId) FROM ".GEODIR_COUNTRIES_TABLE.""); |
|
93 | 93 | |
94 | 94 | if ($country_table_empty == 0) { |
95 | 95 | |
96 | - $countries_insert = "INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (`CountryId`, `Country`, `FIPS104`, `ISO2`, `ISO3`, `ISON`, `Internet`, `Capital`, `MapReference`, `NationalitySingular`, `NationalityPlural`, `Currency`, `CurrencyCode`, `Population`, `Title`, `COMMENT`) VALUES |
|
96 | + $countries_insert = "INSERT INTO ".GEODIR_COUNTRIES_TABLE." (`CountryId`, `Country`, `FIPS104`, `ISO2`, `ISO3`, `ISON`, `Internet`, `Capital`, `MapReference`, `NationalitySingular`, `NationalityPlural`, `Currency`, `CurrencyCode`, `Population`, `Title`, `COMMENT`) VALUES |
|
97 | 97 | (1, 'Afghanistan', 'AF', 'AF', 'AFG', '4', 'AF', 'Kabul ', 'Asia ', 'Afghan', 'Afghans', 'Afghani ', 'AFA', 26813057, 'Afghanistan', ''), |
98 | 98 | (2, 'Albania', 'AL', 'AL', 'ALB', '8', 'AL', 'Tirana ', 'Europe ', 'Albanian', 'Albanians', 'Lek ', 'ALL', 3510484, 'Albania', ''), |
99 | 99 | (3, 'Algeria', 'AG', 'DZ', 'DZA', '12', 'DZ', 'Algiers ', 'Africa ', 'Algerian', 'Algerians', 'Algerian Dinar ', 'DZD', 31736053, 'Algeria', ''), |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | // Table for storing location attribute - these are user defined |
384 | 384 | |
385 | - $icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " ( |
|
385 | + $icon_table = "CREATE TABLE ".GEODIR_ICON_TABLE." ( |
|
386 | 386 | id int NOT NULL AUTO_INCREMENT, |
387 | 387 | post_id int( 10 ) NOT NULL, |
388 | 388 | post_title varchar(254) NOT NULL, |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | // Table for storing post custom fields - these are user defined |
405 | 405 | |
406 | - $post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " ( |
|
406 | + $post_custom_fields = "CREATE TABLE ".GEODIR_CUSTOM_FIELDS_TABLE." ( |
|
407 | 407 | id int(11) NOT NULL AUTO_INCREMENT, |
408 | 408 | post_type varchar(100) NULL, |
409 | 409 | data_type varchar(100) NULL DEFAULT NULL, |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | dbDelta($post_custom_fields); |
449 | 449 | |
450 | 450 | // Table for storing place attribute - these are user defined |
451 | - $post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail ( |
|
451 | + $post_detail = "CREATE TABLE ".$plugin_prefix."gd_place_detail ( |
|
452 | 452 | post_id int(11) NOT NULL, |
453 | 453 | post_title text NULL DEFAULT NULL, |
454 | 454 | post_status varchar(20) NULL DEFAULT NULL, |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | // Table for storing place images - these are user defined |
491 | 491 | |
492 | - $attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " ( |
|
492 | + $attechment_table = "CREATE TABLE ".GEODIR_ATTACHMENT_TABLE." ( |
|
493 | 493 | ID int(11) NOT NULL AUTO_INCREMENT, |
494 | 494 | post_id int(11) NOT NULL, |
495 | 495 | user_id int(11) DEFAULT NULL, |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | dbDelta($attechment_table); |
517 | 517 | |
518 | 518 | |
519 | - $custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " ( |
|
519 | + $custom_sort_fields_table = "CREATE TABLE ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." ( |
|
520 | 520 | id int(11) NOT NULL AUTO_INCREMENT, |
521 | 521 | post_type varchar(255) NOT NULL, |
522 | 522 | data_type varchar(255) NOT NULL, |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | dbDelta($custom_sort_fields_table); |
546 | 546 | |
547 | 547 | |
548 | - $review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " ( |
|
548 | + $review_table = "CREATE TABLE ".GEODIR_REVIEW_TABLE." ( |
|
549 | 549 | id int(11) NOT NULL AUTO_INCREMENT, |
550 | 550 | post_id int(11) DEFAULT NULL, |
551 | 551 | post_title varchar( 255 ) NULL DEFAULT NULL, |
@@ -6,26 +6,26 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | if (!function_exists('geodir_create_tables')) { |
9 | - /** |
|
10 | - * Creates custom db tables for storing GeoDirectory plugin data. |
|
11 | - * |
|
12 | - * @since 1.0.0 |
|
13 | - * @package GeoDirectory |
|
14 | - * @global object $wpdb WordPress Database object. |
|
15 | - * @global string $plugin_prefix GeoDirectory plugin table prefix. |
|
16 | - */ |
|
17 | - function geodir_create_tables() |
|
18 | - { |
|
19 | - |
|
20 | - global $wpdb, $plugin_prefix; |
|
21 | - |
|
22 | - $wpdb->hide_errors(); |
|
23 | - |
|
24 | - $collate = ''; |
|
25 | - if ($wpdb->has_cap('collation')) { |
|
26 | - if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
27 | - if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate"; |
|
28 | - } |
|
9 | + /** |
|
10 | + * Creates custom db tables for storing GeoDirectory plugin data. |
|
11 | + * |
|
12 | + * @since 1.0.0 |
|
13 | + * @package GeoDirectory |
|
14 | + * @global object $wpdb WordPress Database object. |
|
15 | + * @global string $plugin_prefix GeoDirectory plugin table prefix. |
|
16 | + */ |
|
17 | + function geodir_create_tables() |
|
18 | + { |
|
19 | + |
|
20 | + global $wpdb, $plugin_prefix; |
|
21 | + |
|
22 | + $wpdb->hide_errors(); |
|
23 | + |
|
24 | + $collate = ''; |
|
25 | + if ($wpdb->has_cap('collation')) { |
|
26 | + if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
27 | + if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate"; |
|
28 | + } |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Include any functions needed for upgrades. |
@@ -36,31 +36,31 @@ discard block |
||
36 | 36 | |
37 | 37 | |
38 | 38 | // rename tables if we need to |
39 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_countries'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_countries'") == 0) { |
|
40 | - $wpdb->query("RENAME TABLE geodir_countries TO " . $wpdb->prefix . "geodir_countries"); |
|
41 | - } |
|
42 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_fields'") == 0) { |
|
43 | - $wpdb->query("RENAME TABLE geodir_custom_fields TO " . $wpdb->prefix . "geodir_custom_fields"); |
|
44 | - } |
|
45 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_icon'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_icon'") == 0) { |
|
46 | - $wpdb->query("RENAME TABLE geodir_post_icon TO " . $wpdb->prefix . "geodir_post_icon"); |
|
47 | - } |
|
48 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_attachments'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_attachments'") == 0) { |
|
49 | - $wpdb->query("RENAME TABLE geodir_attachments TO " . $wpdb->prefix . "geodir_attachments"); |
|
50 | - } |
|
51 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_review'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_review'") == 0) { |
|
52 | - $wpdb->query("RENAME TABLE geodir_post_review TO " . $wpdb->prefix . "geodir_post_review"); |
|
53 | - } |
|
54 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_sort_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_sort_fields'") == 0) { |
|
55 | - $wpdb->query("RENAME TABLE geodir_custom_sort_fields TO " . $wpdb->prefix . "geodir_custom_sort_fields"); |
|
56 | - } |
|
57 | - if ($wpdb->query("SHOW TABLES LIKE 'geodir_gd_place_detail'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_gd_place_detail'") == 0) { |
|
58 | - $wpdb->query("RENAME TABLE geodir_gd_place_detail TO " . $wpdb->prefix . "geodir_gd_place_detail"); |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - // Table for storing Countries |
|
63 | - $GEODIR_COUNTRIES_TABLE = "CREATE TABLE " . GEODIR_COUNTRIES_TABLE . " ( |
|
39 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_countries'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_countries'") == 0) { |
|
40 | + $wpdb->query("RENAME TABLE geodir_countries TO " . $wpdb->prefix . "geodir_countries"); |
|
41 | + } |
|
42 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_fields'") == 0) { |
|
43 | + $wpdb->query("RENAME TABLE geodir_custom_fields TO " . $wpdb->prefix . "geodir_custom_fields"); |
|
44 | + } |
|
45 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_icon'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_icon'") == 0) { |
|
46 | + $wpdb->query("RENAME TABLE geodir_post_icon TO " . $wpdb->prefix . "geodir_post_icon"); |
|
47 | + } |
|
48 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_attachments'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_attachments'") == 0) { |
|
49 | + $wpdb->query("RENAME TABLE geodir_attachments TO " . $wpdb->prefix . "geodir_attachments"); |
|
50 | + } |
|
51 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_post_review'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_post_review'") == 0) { |
|
52 | + $wpdb->query("RENAME TABLE geodir_post_review TO " . $wpdb->prefix . "geodir_post_review"); |
|
53 | + } |
|
54 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_custom_sort_fields'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_custom_sort_fields'") == 0) { |
|
55 | + $wpdb->query("RENAME TABLE geodir_custom_sort_fields TO " . $wpdb->prefix . "geodir_custom_sort_fields"); |
|
56 | + } |
|
57 | + if ($wpdb->query("SHOW TABLES LIKE 'geodir_gd_place_detail'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "geodir_gd_place_detail'") == 0) { |
|
58 | + $wpdb->query("RENAME TABLE geodir_gd_place_detail TO " . $wpdb->prefix . "geodir_gd_place_detail"); |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + // Table for storing Countries |
|
63 | + $GEODIR_COUNTRIES_TABLE = "CREATE TABLE " . GEODIR_COUNTRIES_TABLE . " ( |
|
64 | 64 | CountryId smallint AUTO_INCREMENT NOT NULL , |
65 | 65 | Country varchar (50) NOT NULL , |
66 | 66 | FIPS104 varchar (2) NOT NULL , |
@@ -79,21 +79,21 @@ discard block |
||
79 | 79 | Comment varchar (255) NULL , |
80 | 80 | PRIMARY KEY (CountryId)) $collate "; |
81 | 81 | |
82 | - /** |
|
83 | - * Filter the SQL query that creates/updates the country DB table structure. |
|
84 | - * |
|
85 | - * @since 1.0.0 |
|
86 | - * @param string $sql The SQL insert query string. |
|
87 | - */ |
|
88 | - $GEODIR_COUNTRIES_TABLE = apply_filters('geodir_before_country_table_create', $GEODIR_COUNTRIES_TABLE); |
|
89 | - dbDelta($GEODIR_COUNTRIES_TABLE); |
|
82 | + /** |
|
83 | + * Filter the SQL query that creates/updates the country DB table structure. |
|
84 | + * |
|
85 | + * @since 1.0.0 |
|
86 | + * @param string $sql The SQL insert query string. |
|
87 | + */ |
|
88 | + $GEODIR_COUNTRIES_TABLE = apply_filters('geodir_before_country_table_create', $GEODIR_COUNTRIES_TABLE); |
|
89 | + dbDelta($GEODIR_COUNTRIES_TABLE); |
|
90 | 90 | |
91 | 91 | |
92 | - $country_table_empty = $wpdb->get_var("SELECT COUNT(CountryId) FROM " . GEODIR_COUNTRIES_TABLE . ""); |
|
92 | + $country_table_empty = $wpdb->get_var("SELECT COUNT(CountryId) FROM " . GEODIR_COUNTRIES_TABLE . ""); |
|
93 | 93 | |
94 | - if ($country_table_empty == 0) { |
|
94 | + if ($country_table_empty == 0) { |
|
95 | 95 | |
96 | - $countries_insert = "INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (`CountryId`, `Country`, `FIPS104`, `ISO2`, `ISO3`, `ISON`, `Internet`, `Capital`, `MapReference`, `NationalitySingular`, `NationalityPlural`, `Currency`, `CurrencyCode`, `Population`, `Title`, `COMMENT`) VALUES |
|
96 | + $countries_insert = "INSERT INTO " . GEODIR_COUNTRIES_TABLE . " (`CountryId`, `Country`, `FIPS104`, `ISO2`, `ISO3`, `ISON`, `Internet`, `Capital`, `MapReference`, `NationalitySingular`, `NationalityPlural`, `Currency`, `CurrencyCode`, `Population`, `Title`, `COMMENT`) VALUES |
|
97 | 97 | (1, 'Afghanistan', 'AF', 'AF', 'AFG', '4', 'AF', 'Kabul ', 'Asia ', 'Afghan', 'Afghans', 'Afghani ', 'AFA', 26813057, 'Afghanistan', ''), |
98 | 98 | (2, 'Albania', 'AL', 'AL', 'ALB', '8', 'AL', 'Tirana ', 'Europe ', 'Albanian', 'Albanians', 'Lek ', 'ALL', 3510484, 'Albania', ''), |
99 | 99 | (3, 'Algeria', 'AG', 'DZ', 'DZA', '12', 'DZ', 'Algiers ', 'Africa ', 'Algerian', 'Algerians', 'Algerian Dinar ', 'DZD', 31736053, 'Algeria', ''), |
@@ -368,21 +368,21 @@ discard block |
||
368 | 368 | (277, 'Caribbean Netherlands', '--', 'BQ', 'BES', '535', 'BQ', '--', 'Central America and the Caribbean', '--', '--', 'United States dollar', 'USD', 21133, 'Caribbean Netherlands', ''), |
369 | 369 | (278, 'Kosovo', 'XK', 'XK', '--', '--', 'XK', 'Pristina', 'Europe', '--', '--', 'Euro', 'EUR', 1859203, 'Caribbean Netherlands', 'Kosovo')"; |
370 | 370 | |
371 | - /** |
|
372 | - * Filter the SQL query that inserts the country DB table data. |
|
373 | - * |
|
374 | - * @since 1.0.0 |
|
375 | - * @param string $sql The SQL insert query string. |
|
376 | - */ |
|
377 | - $countries_insert = apply_filters('geodir_before_country_data_insert', $countries_insert); |
|
378 | - $wpdb->query($countries_insert); |
|
371 | + /** |
|
372 | + * Filter the SQL query that inserts the country DB table data. |
|
373 | + * |
|
374 | + * @since 1.0.0 |
|
375 | + * @param string $sql The SQL insert query string. |
|
376 | + */ |
|
377 | + $countries_insert = apply_filters('geodir_before_country_data_insert', $countries_insert); |
|
378 | + $wpdb->query($countries_insert); |
|
379 | 379 | |
380 | - } |
|
380 | + } |
|
381 | 381 | |
382 | 382 | |
383 | - // Table for storing location attribute - these are user defined |
|
383 | + // Table for storing location attribute - these are user defined |
|
384 | 384 | |
385 | - $icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " ( |
|
385 | + $icon_table = "CREATE TABLE " . GEODIR_ICON_TABLE . " ( |
|
386 | 386 | id int NOT NULL AUTO_INCREMENT, |
387 | 387 | post_id int( 10 ) NOT NULL, |
388 | 388 | post_title varchar(254) NOT NULL, |
@@ -391,19 +391,19 @@ discard block |
||
391 | 391 | PRIMARY KEY (id) |
392 | 392 | ) $collate "; |
393 | 393 | |
394 | - /** |
|
395 | - * Filter the SQL query that creates/updates the post_icon DB table structure. |
|
396 | - * |
|
397 | - * @since 1.0.0 |
|
398 | - * @param string $sql The SQL insert query string. |
|
399 | - */ |
|
400 | - $icon_table = apply_filters('geodir_before_icon_table_create', $icon_table); |
|
394 | + /** |
|
395 | + * Filter the SQL query that creates/updates the post_icon DB table structure. |
|
396 | + * |
|
397 | + * @since 1.0.0 |
|
398 | + * @param string $sql The SQL insert query string. |
|
399 | + */ |
|
400 | + $icon_table = apply_filters('geodir_before_icon_table_create', $icon_table); |
|
401 | 401 | |
402 | - dbDelta($icon_table); |
|
402 | + dbDelta($icon_table); |
|
403 | 403 | |
404 | - // Table for storing post custom fields - these are user defined |
|
404 | + // Table for storing post custom fields - these are user defined |
|
405 | 405 | |
406 | - $post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " ( |
|
406 | + $post_custom_fields = "CREATE TABLE " . GEODIR_CUSTOM_FIELDS_TABLE . " ( |
|
407 | 407 | id int(11) NOT NULL AUTO_INCREMENT, |
408 | 408 | post_type varchar(100) NULL, |
409 | 409 | data_type varchar(100) NULL DEFAULT NULL, |
@@ -439,18 +439,18 @@ discard block |
||
439 | 439 | PRIMARY KEY (id) |
440 | 440 | ) $collate"; |
441 | 441 | |
442 | - /** |
|
443 | - * Filter the SQL query that creates/updates the custom_fields DB table structure. |
|
444 | - * |
|
445 | - * @since 1.0.0 |
|
446 | - * @param string $sql The SQL insert query string. |
|
447 | - */ |
|
448 | - $post_custom_fields = apply_filters('geodir_before_custom_field_table_create', $post_custom_fields); |
|
442 | + /** |
|
443 | + * Filter the SQL query that creates/updates the custom_fields DB table structure. |
|
444 | + * |
|
445 | + * @since 1.0.0 |
|
446 | + * @param string $sql The SQL insert query string. |
|
447 | + */ |
|
448 | + $post_custom_fields = apply_filters('geodir_before_custom_field_table_create', $post_custom_fields); |
|
449 | 449 | |
450 | - dbDelta($post_custom_fields); |
|
450 | + dbDelta($post_custom_fields); |
|
451 | 451 | |
452 | - // Table for storing place attribute - these are user defined |
|
453 | - $post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail ( |
|
452 | + // Table for storing place attribute - these are user defined |
|
453 | + $post_detail = "CREATE TABLE " . $plugin_prefix . "gd_place_detail ( |
|
454 | 454 | post_id int(11) NOT NULL, |
455 | 455 | post_title text NULL DEFAULT NULL, |
456 | 456 | post_status varchar(20) NULL DEFAULT NULL, |
@@ -477,22 +477,22 @@ discard block |
||
477 | 477 | PRIMARY KEY (post_id) |
478 | 478 | ) $collate "; |
479 | 479 | |
480 | - /** |
|
481 | - * Filter the SQL query that creates/updates the post_detail DB table structure. |
|
482 | - * |
|
483 | - * @since 1.0.0 |
|
484 | - * @param string $sql The SQL insert query string. |
|
485 | - */ |
|
486 | - $post_detail = apply_filters('geodir_before_post_detail_table_create', $post_detail); |
|
480 | + /** |
|
481 | + * Filter the SQL query that creates/updates the post_detail DB table structure. |
|
482 | + * |
|
483 | + * @since 1.0.0 |
|
484 | + * @param string $sql The SQL insert query string. |
|
485 | + */ |
|
486 | + $post_detail = apply_filters('geodir_before_post_detail_table_create', $post_detail); |
|
487 | 487 | |
488 | - dbDelta($post_detail); |
|
488 | + dbDelta($post_detail); |
|
489 | 489 | |
490 | - // alter post_title |
|
491 | - //$wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_gd_place_detail MODIFY `post_title` text NULL"); |
|
490 | + // alter post_title |
|
491 | + //$wpdb->query("ALTER TABLE ".$wpdb->prefix."geodir_gd_place_detail MODIFY `post_title` text NULL"); |
|
492 | 492 | |
493 | - // Table for storing place images - these are user defined |
|
493 | + // Table for storing place images - these are user defined |
|
494 | 494 | |
495 | - $attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " ( |
|
495 | + $attechment_table = "CREATE TABLE " . GEODIR_ATTACHMENT_TABLE . " ( |
|
496 | 496 | ID int(11) NOT NULL AUTO_INCREMENT, |
497 | 497 | post_id int(11) NOT NULL, |
498 | 498 | user_id int(11) DEFAULT NULL, |
@@ -508,18 +508,18 @@ discard block |
||
508 | 508 | PRIMARY KEY (ID) |
509 | 509 | ) $collate "; |
510 | 510 | |
511 | - /** |
|
512 | - * Filter the SQL query that creates/updates the attachments DB table structure. |
|
513 | - * |
|
514 | - * @since 1.0.0 |
|
515 | - * @param string $sql The SQL insert query string. |
|
516 | - */ |
|
517 | - $attechment_table = apply_filters('geodir_before_attachment_table_create', $attechment_table); |
|
511 | + /** |
|
512 | + * Filter the SQL query that creates/updates the attachments DB table structure. |
|
513 | + * |
|
514 | + * @since 1.0.0 |
|
515 | + * @param string $sql The SQL insert query string. |
|
516 | + */ |
|
517 | + $attechment_table = apply_filters('geodir_before_attachment_table_create', $attechment_table); |
|
518 | 518 | |
519 | - dbDelta($attechment_table); |
|
519 | + dbDelta($attechment_table); |
|
520 | 520 | |
521 | 521 | |
522 | - $custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " ( |
|
522 | + $custom_sort_fields_table = "CREATE TABLE " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " ( |
|
523 | 523 | id int(11) NOT NULL AUTO_INCREMENT, |
524 | 524 | post_type varchar(255) NOT NULL, |
525 | 525 | data_type varchar(255) NOT NULL, |
@@ -537,18 +537,18 @@ discard block |
||
537 | 537 | PRIMARY KEY (id) |
538 | 538 | ) $collate "; |
539 | 539 | |
540 | - /** |
|
541 | - * Filter the SQL query that creates/updates the custom_sort_fields DB table structure. |
|
542 | - * |
|
543 | - * @since 1.0.0 |
|
544 | - * @param string $sql The SQL insert query string. |
|
545 | - */ |
|
546 | - $custom_sort_fields_table = apply_filters('geodir_before_sort_fields_table_create', $custom_sort_fields_table); |
|
540 | + /** |
|
541 | + * Filter the SQL query that creates/updates the custom_sort_fields DB table structure. |
|
542 | + * |
|
543 | + * @since 1.0.0 |
|
544 | + * @param string $sql The SQL insert query string. |
|
545 | + */ |
|
546 | + $custom_sort_fields_table = apply_filters('geodir_before_sort_fields_table_create', $custom_sort_fields_table); |
|
547 | 547 | |
548 | - dbDelta($custom_sort_fields_table); |
|
548 | + dbDelta($custom_sort_fields_table); |
|
549 | 549 | |
550 | 550 | |
551 | - $review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " ( |
|
551 | + $review_table = "CREATE TABLE " . GEODIR_REVIEW_TABLE . " ( |
|
552 | 552 | id int(11) NOT NULL AUTO_INCREMENT, |
553 | 553 | post_id int(11) DEFAULT NULL, |
554 | 554 | post_title varchar( 255 ) NULL DEFAULT NULL, |
@@ -572,51 +572,51 @@ discard block |
||
572 | 572 | PRIMARY KEY (id) |
573 | 573 | ) $collate "; |
574 | 574 | |
575 | - /** |
|
576 | - * Filter the SQL query that creates the review DB table structure. |
|
577 | - * |
|
578 | - * @since 1.0.0 |
|
579 | - * @param string $sql The SQL insert query string. |
|
580 | - */ |
|
581 | - $review_table = apply_filters('geodir_before_review_table_create', $review_table); |
|
582 | - dbDelta($review_table); |
|
575 | + /** |
|
576 | + * Filter the SQL query that creates the review DB table structure. |
|
577 | + * |
|
578 | + * @since 1.0.0 |
|
579 | + * @param string $sql The SQL insert query string. |
|
580 | + */ |
|
581 | + $review_table = apply_filters('geodir_before_review_table_create', $review_table); |
|
582 | + dbDelta($review_table); |
|
583 | 583 | |
584 | 584 | |
585 | 585 | |
586 | - // Alter terms table |
|
587 | - $term_icon_column = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->terms where field='term_icon'"); |
|
588 | - if (!$term_icon_column) { |
|
589 | - $wpdb->query("ALTER TABLE $wpdb->terms ADD `term_icon` TEXT NULL DEFAULT NULL"); |
|
590 | - } |
|
586 | + // Alter terms table |
|
587 | + $term_icon_column = $wpdb->get_var("SHOW COLUMNS FROM $wpdb->terms where field='term_icon'"); |
|
588 | + if (!$term_icon_column) { |
|
589 | + $wpdb->query("ALTER TABLE $wpdb->terms ADD `term_icon` TEXT NULL DEFAULT NULL"); |
|
590 | + } |
|
591 | 591 | |
592 | - //require_once(geodir_plugin_path() . '/upgrade.php'); |
|
592 | + //require_once(geodir_plugin_path() . '/upgrade.php'); |
|
593 | 593 | |
594 | 594 | |
595 | - } |
|
595 | + } |
|
596 | 596 | } // END MAIN FUNCTION geodir_tables_install |
597 | 597 | |
598 | 598 | if (!function_exists('geodir_create_default_fields')) { |
599 | - /** |
|
600 | - * Inserts default custom fields table data into database. |
|
601 | - * |
|
602 | - * @since 1.0.0 |
|
603 | - * @package GeoDirectory |
|
604 | - */ |
|
605 | - function geodir_create_default_fields() |
|
606 | - { |
|
607 | - |
|
608 | - $fields = geodir_default_custom_fields('gd_place'); |
|
609 | - |
|
610 | - /** |
|
611 | - * Filter the array of default custom fields DB table data. |
|
612 | - * |
|
613 | - * @since 1.0.0 |
|
614 | - * @param string $fields The default custom fields as an array. |
|
615 | - */ |
|
616 | - $fields = apply_filters('geodir_before_default_custom_fields_saved', $fields); |
|
617 | - foreach ($fields as $field_index => $field) { |
|
618 | - geodir_custom_field_save($field); |
|
619 | - |
|
620 | - } |
|
621 | - } |
|
599 | + /** |
|
600 | + * Inserts default custom fields table data into database. |
|
601 | + * |
|
602 | + * @since 1.0.0 |
|
603 | + * @package GeoDirectory |
|
604 | + */ |
|
605 | + function geodir_create_default_fields() |
|
606 | + { |
|
607 | + |
|
608 | + $fields = geodir_default_custom_fields('gd_place'); |
|
609 | + |
|
610 | + /** |
|
611 | + * Filter the array of default custom fields DB table data. |
|
612 | + * |
|
613 | + * @since 1.0.0 |
|
614 | + * @param string $fields The default custom fields as an array. |
|
615 | + */ |
|
616 | + $fields = apply_filters('geodir_before_default_custom_fields_saved', $fields); |
|
617 | + foreach ($fields as $field_index => $field) { |
|
618 | + geodir_custom_field_save($field); |
|
619 | + |
|
620 | + } |
|
621 | + } |
|
622 | 622 | } |
623 | 623 | \ No newline at end of file |
@@ -16,184 +16,184 @@ |
||
16 | 16 | */ |
17 | 17 | $geodir_settings['permalink_settings'] = apply_filters('geodir_permalink_settings', array( |
18 | 18 | |
19 | - /* Listing Permalink Settings start */ |
|
20 | - array('name' => __('Permalink', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set permalink', 'id' => 'geodir_permalink_settings '), |
|
21 | - |
|
22 | - |
|
23 | - array('name' => __('Listing Detail Permalink Settings', 'geodirectory'), |
|
24 | - 'type' => 'sectionstart', |
|
25 | - 'desc' => '', |
|
26 | - 'id' => 'geodir_permalink'), |
|
27 | - |
|
28 | - array( |
|
29 | - 'name' => __('Add location in urls', 'geodirectory'), |
|
30 | - 'desc' => __('Add location slug in listing urls', 'geodirectory'), |
|
31 | - 'id' => 'geodir_add_location_url', |
|
32 | - 'type' => 'checkbox', |
|
33 | - 'std' => '1', |
|
34 | - 'checkboxgroup' => 'start' |
|
35 | - ), |
|
36 | - |
|
37 | - array( |
|
38 | - 'name' => __('Add full location in listing urls', 'geodirectory'), |
|
39 | - 'desc' => __('Add full location info with country, region and city slug in listing urls', 'geodirectory'), |
|
40 | - 'id' => 'geodir_show_location_url', |
|
41 | - 'type' => 'radio', |
|
42 | - 'value' => 'all', |
|
43 | - 'std' => 'all', |
|
44 | - 'radiogroup' => '' |
|
45 | - ), |
|
46 | - |
|
47 | - array( |
|
48 | - 'name' => __('Add country and city slug in listing urls', 'geodirectory'), |
|
49 | - 'desc' => __('Add country and city slug in listing urls (/country/city/)', 'geodirectory'), |
|
50 | - 'id' => 'geodir_show_location_url', |
|
51 | - 'type' => 'radio', |
|
52 | - 'std' => 'all', |
|
53 | - 'value' => 'country_city', |
|
54 | - 'radiogroup' => '' |
|
55 | - ), |
|
56 | - array( |
|
57 | - 'name' => __('Add region and city slug in listing urls', 'geodirectory'), |
|
58 | - 'desc' => __('Add region and city slug in listing urls (/region/city/)', 'geodirectory'), |
|
59 | - 'id' => 'geodir_show_location_url', |
|
60 | - 'type' => 'radio', |
|
61 | - 'std' => 'all', |
|
62 | - 'value' => 'region_city', |
|
63 | - 'radiogroup' => '' |
|
64 | - ), |
|
65 | - array( |
|
66 | - 'name' => __('Add only city in listing urls', 'geodirectory'), |
|
67 | - 'desc' => __('Add city slug in listing urls', 'geodirectory'), |
|
68 | - 'id' => 'geodir_show_location_url', |
|
69 | - 'type' => 'radio', |
|
70 | - 'std' => 'all', |
|
71 | - 'value' => 'city', |
|
72 | - 'radiogroup' => 'end' |
|
73 | - ), |
|
74 | - |
|
75 | - |
|
76 | - |
|
77 | - array( |
|
78 | - 'name' => __('Add category in listing urls', 'geodirectory'), |
|
79 | - 'desc' => __('Add requested category slugs in listing urls', 'geodirectory'), |
|
80 | - 'id' => 'geodir_add_categories_url', |
|
81 | - 'type' => 'checkbox', |
|
82 | - 'std' => '1', |
|
83 | - ), |
|
84 | - |
|
85 | - array( |
|
86 | - 'name' => __('Listing url prefix', 'geodirectory'), |
|
87 | - 'desc' => __('Listing prefix to show in url', 'geodirectory'), |
|
88 | - 'id' => 'geodir_listing_prefix', |
|
89 | - 'type' => 'text', |
|
90 | - 'css' => 'min-width:300px;', |
|
91 | - 'std' => 'places' |
|
92 | - ), |
|
93 | - |
|
94 | - array( |
|
95 | - 'name' => __('Location url prefix', 'geodirectory'), |
|
96 | - 'desc' => __('Depreciated, now uses the location page slug', 'geodirectory'), |
|
97 | - 'id' => 'geodir_location_prefix', |
|
98 | - 'type' => 'text', |
|
99 | - 'css' => 'min-width:300px;', |
|
100 | - 'std' => 'location' // Default value to show home top section |
|
101 | - ), |
|
102 | - |
|
103 | - array( |
|
104 | - 'name' => __('Location and category url separator', 'geodirectory'), |
|
105 | - 'desc' => __('Separator to show between location and category url slugs in listing urls', 'geodirectory'), |
|
106 | - 'id' => 'geodir_listingurl_separator', |
|
107 | - 'type' => 'text', |
|
108 | - 'css' => 'min-width:300px;', |
|
109 | - 'std' => 'C' // Default value to show home top section |
|
110 | - ), |
|
111 | - |
|
112 | - array( |
|
113 | - 'name' => __('Listing detail url separator', 'geodirectory'), |
|
114 | - 'desc' => __('Separator to show before listing slug in listing detail urls', 'geodirectory'), |
|
115 | - 'id' => 'geodir_detailurl_separator', |
|
116 | - 'type' => 'text', |
|
117 | - 'css' => 'min-width:300px;', |
|
118 | - 'std' => 'info' // Default value to show home top section |
|
119 | - ), |
|
120 | - |
|
121 | - |
|
122 | - array('type' => 'sectionend', 'id' => 'geodir_permalink'), |
|
123 | - |
|
124 | - array('name' => __('GeoDirectory Pages', 'geodirectory'), |
|
125 | - 'type' => 'sectionstart', |
|
126 | - 'desc' => '', |
|
127 | - 'id' => 'geodir_pages'), |
|
128 | - |
|
129 | - array( |
|
130 | - 'name' => __('GD Home page', 'geodirectory'), |
|
131 | - 'desc' => __('Select the page to use for the GD homepage (you must also set this page in Settings>Reading>Front page for it to work)', 'geodirectory'), |
|
132 | - 'id' => 'geodir_home_page', |
|
133 | - 'type' => 'single_select_page', |
|
134 | - 'class' => 'chosen_select' |
|
135 | - ), |
|
136 | - |
|
137 | - array( |
|
138 | - 'name' => __('Add listing page', 'geodirectory'), |
|
139 | - 'desc' => __('Select the page to use for adding listings', 'geodirectory'), |
|
140 | - 'id' => 'geodir_add_listing_page', |
|
141 | - 'type' => 'single_select_page', |
|
142 | - 'class' => 'chosen_select' |
|
143 | - ), |
|
144 | - |
|
145 | - array( |
|
146 | - 'name' => __('Listing preview page', 'geodirectory'), |
|
147 | - 'desc' => __('Select the page to use for listing preview', 'geodirectory'), |
|
148 | - 'id' => 'geodir_preview_page', |
|
149 | - 'type' => 'single_select_page', |
|
150 | - 'class' => 'chosen_select' |
|
151 | - ), |
|
152 | - |
|
153 | - array( |
|
154 | - 'name' => __('Listing success page', 'geodirectory'), |
|
155 | - 'desc' => __('Select the page to use for listing success', 'geodirectory'), |
|
156 | - 'id' => 'geodir_success_page', |
|
157 | - 'type' => 'single_select_page', |
|
158 | - 'class' => 'chosen_select' |
|
159 | - ), |
|
160 | - |
|
161 | - array( |
|
162 | - 'name' => __('Location page', 'geodirectory'), |
|
163 | - 'desc' => __('Select the page to use for locations', 'geodirectory'), |
|
164 | - 'id' => 'geodir_location_page', |
|
165 | - 'type' => 'single_select_page', |
|
166 | - 'class' => 'chosen_select' |
|
167 | - ), |
|
168 | - |
|
169 | - array( |
|
170 | - 'name' => __('Terms and Conditions page', 'geodirectory'), |
|
171 | - 'desc' => __('Select the page to use for Terms and Conditions (if enabled)', 'geodirectory'), |
|
172 | - 'id' => 'geodir_term_condition_page', |
|
173 | - 'type' => 'single_select_page', |
|
174 | - 'class' => 'chosen_select' |
|
175 | - ), |
|
176 | - |
|
177 | - array( |
|
178 | - 'name' => __('Info page', 'geodirectory'), |
|
179 | - 'desc' => __('Select the page to use for Gd general Info', 'geodirectory'), |
|
180 | - 'id' => 'geodir_info_page', |
|
181 | - 'type' => 'single_select_page', |
|
182 | - 'class' => 'chosen_select' |
|
183 | - ), |
|
184 | - |
|
185 | - array( |
|
186 | - 'name' => __('Login page', 'geodirectory'), |
|
187 | - 'desc' => __('Select the page to use for Login / Register', 'geodirectory'), |
|
188 | - 'id' => 'geodir_login_page', |
|
189 | - 'type' => 'single_select_page', |
|
190 | - 'class' => 'chosen_select' |
|
191 | - ), |
|
192 | - |
|
193 | - |
|
194 | - array('type' => 'sectionend', 'id' => 'geodir_pages'), |
|
195 | - |
|
196 | - /* Listing Detail Permalink Settings End */ |
|
19 | + /* Listing Permalink Settings start */ |
|
20 | + array('name' => __('Permalink', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set permalink', 'id' => 'geodir_permalink_settings '), |
|
21 | + |
|
22 | + |
|
23 | + array('name' => __('Listing Detail Permalink Settings', 'geodirectory'), |
|
24 | + 'type' => 'sectionstart', |
|
25 | + 'desc' => '', |
|
26 | + 'id' => 'geodir_permalink'), |
|
27 | + |
|
28 | + array( |
|
29 | + 'name' => __('Add location in urls', 'geodirectory'), |
|
30 | + 'desc' => __('Add location slug in listing urls', 'geodirectory'), |
|
31 | + 'id' => 'geodir_add_location_url', |
|
32 | + 'type' => 'checkbox', |
|
33 | + 'std' => '1', |
|
34 | + 'checkboxgroup' => 'start' |
|
35 | + ), |
|
36 | + |
|
37 | + array( |
|
38 | + 'name' => __('Add full location in listing urls', 'geodirectory'), |
|
39 | + 'desc' => __('Add full location info with country, region and city slug in listing urls', 'geodirectory'), |
|
40 | + 'id' => 'geodir_show_location_url', |
|
41 | + 'type' => 'radio', |
|
42 | + 'value' => 'all', |
|
43 | + 'std' => 'all', |
|
44 | + 'radiogroup' => '' |
|
45 | + ), |
|
46 | + |
|
47 | + array( |
|
48 | + 'name' => __('Add country and city slug in listing urls', 'geodirectory'), |
|
49 | + 'desc' => __('Add country and city slug in listing urls (/country/city/)', 'geodirectory'), |
|
50 | + 'id' => 'geodir_show_location_url', |
|
51 | + 'type' => 'radio', |
|
52 | + 'std' => 'all', |
|
53 | + 'value' => 'country_city', |
|
54 | + 'radiogroup' => '' |
|
55 | + ), |
|
56 | + array( |
|
57 | + 'name' => __('Add region and city slug in listing urls', 'geodirectory'), |
|
58 | + 'desc' => __('Add region and city slug in listing urls (/region/city/)', 'geodirectory'), |
|
59 | + 'id' => 'geodir_show_location_url', |
|
60 | + 'type' => 'radio', |
|
61 | + 'std' => 'all', |
|
62 | + 'value' => 'region_city', |
|
63 | + 'radiogroup' => '' |
|
64 | + ), |
|
65 | + array( |
|
66 | + 'name' => __('Add only city in listing urls', 'geodirectory'), |
|
67 | + 'desc' => __('Add city slug in listing urls', 'geodirectory'), |
|
68 | + 'id' => 'geodir_show_location_url', |
|
69 | + 'type' => 'radio', |
|
70 | + 'std' => 'all', |
|
71 | + 'value' => 'city', |
|
72 | + 'radiogroup' => 'end' |
|
73 | + ), |
|
74 | + |
|
75 | + |
|
76 | + |
|
77 | + array( |
|
78 | + 'name' => __('Add category in listing urls', 'geodirectory'), |
|
79 | + 'desc' => __('Add requested category slugs in listing urls', 'geodirectory'), |
|
80 | + 'id' => 'geodir_add_categories_url', |
|
81 | + 'type' => 'checkbox', |
|
82 | + 'std' => '1', |
|
83 | + ), |
|
84 | + |
|
85 | + array( |
|
86 | + 'name' => __('Listing url prefix', 'geodirectory'), |
|
87 | + 'desc' => __('Listing prefix to show in url', 'geodirectory'), |
|
88 | + 'id' => 'geodir_listing_prefix', |
|
89 | + 'type' => 'text', |
|
90 | + 'css' => 'min-width:300px;', |
|
91 | + 'std' => 'places' |
|
92 | + ), |
|
93 | + |
|
94 | + array( |
|
95 | + 'name' => __('Location url prefix', 'geodirectory'), |
|
96 | + 'desc' => __('Depreciated, now uses the location page slug', 'geodirectory'), |
|
97 | + 'id' => 'geodir_location_prefix', |
|
98 | + 'type' => 'text', |
|
99 | + 'css' => 'min-width:300px;', |
|
100 | + 'std' => 'location' // Default value to show home top section |
|
101 | + ), |
|
102 | + |
|
103 | + array( |
|
104 | + 'name' => __('Location and category url separator', 'geodirectory'), |
|
105 | + 'desc' => __('Separator to show between location and category url slugs in listing urls', 'geodirectory'), |
|
106 | + 'id' => 'geodir_listingurl_separator', |
|
107 | + 'type' => 'text', |
|
108 | + 'css' => 'min-width:300px;', |
|
109 | + 'std' => 'C' // Default value to show home top section |
|
110 | + ), |
|
111 | + |
|
112 | + array( |
|
113 | + 'name' => __('Listing detail url separator', 'geodirectory'), |
|
114 | + 'desc' => __('Separator to show before listing slug in listing detail urls', 'geodirectory'), |
|
115 | + 'id' => 'geodir_detailurl_separator', |
|
116 | + 'type' => 'text', |
|
117 | + 'css' => 'min-width:300px;', |
|
118 | + 'std' => 'info' // Default value to show home top section |
|
119 | + ), |
|
120 | + |
|
121 | + |
|
122 | + array('type' => 'sectionend', 'id' => 'geodir_permalink'), |
|
123 | + |
|
124 | + array('name' => __('GeoDirectory Pages', 'geodirectory'), |
|
125 | + 'type' => 'sectionstart', |
|
126 | + 'desc' => '', |
|
127 | + 'id' => 'geodir_pages'), |
|
128 | + |
|
129 | + array( |
|
130 | + 'name' => __('GD Home page', 'geodirectory'), |
|
131 | + 'desc' => __('Select the page to use for the GD homepage (you must also set this page in Settings>Reading>Front page for it to work)', 'geodirectory'), |
|
132 | + 'id' => 'geodir_home_page', |
|
133 | + 'type' => 'single_select_page', |
|
134 | + 'class' => 'chosen_select' |
|
135 | + ), |
|
136 | + |
|
137 | + array( |
|
138 | + 'name' => __('Add listing page', 'geodirectory'), |
|
139 | + 'desc' => __('Select the page to use for adding listings', 'geodirectory'), |
|
140 | + 'id' => 'geodir_add_listing_page', |
|
141 | + 'type' => 'single_select_page', |
|
142 | + 'class' => 'chosen_select' |
|
143 | + ), |
|
144 | + |
|
145 | + array( |
|
146 | + 'name' => __('Listing preview page', 'geodirectory'), |
|
147 | + 'desc' => __('Select the page to use for listing preview', 'geodirectory'), |
|
148 | + 'id' => 'geodir_preview_page', |
|
149 | + 'type' => 'single_select_page', |
|
150 | + 'class' => 'chosen_select' |
|
151 | + ), |
|
152 | + |
|
153 | + array( |
|
154 | + 'name' => __('Listing success page', 'geodirectory'), |
|
155 | + 'desc' => __('Select the page to use for listing success', 'geodirectory'), |
|
156 | + 'id' => 'geodir_success_page', |
|
157 | + 'type' => 'single_select_page', |
|
158 | + 'class' => 'chosen_select' |
|
159 | + ), |
|
160 | + |
|
161 | + array( |
|
162 | + 'name' => __('Location page', 'geodirectory'), |
|
163 | + 'desc' => __('Select the page to use for locations', 'geodirectory'), |
|
164 | + 'id' => 'geodir_location_page', |
|
165 | + 'type' => 'single_select_page', |
|
166 | + 'class' => 'chosen_select' |
|
167 | + ), |
|
168 | + |
|
169 | + array( |
|
170 | + 'name' => __('Terms and Conditions page', 'geodirectory'), |
|
171 | + 'desc' => __('Select the page to use for Terms and Conditions (if enabled)', 'geodirectory'), |
|
172 | + 'id' => 'geodir_term_condition_page', |
|
173 | + 'type' => 'single_select_page', |
|
174 | + 'class' => 'chosen_select' |
|
175 | + ), |
|
176 | + |
|
177 | + array( |
|
178 | + 'name' => __('Info page', 'geodirectory'), |
|
179 | + 'desc' => __('Select the page to use for Gd general Info', 'geodirectory'), |
|
180 | + 'id' => 'geodir_info_page', |
|
181 | + 'type' => 'single_select_page', |
|
182 | + 'class' => 'chosen_select' |
|
183 | + ), |
|
184 | + |
|
185 | + array( |
|
186 | + 'name' => __('Login page', 'geodirectory'), |
|
187 | + 'desc' => __('Select the page to use for Login / Register', 'geodirectory'), |
|
188 | + 'id' => 'geodir_login_page', |
|
189 | + 'type' => 'single_select_page', |
|
190 | + 'class' => 'chosen_select' |
|
191 | + ), |
|
192 | + |
|
193 | + |
|
194 | + array('type' => 'sectionend', 'id' => 'geodir_pages'), |
|
195 | + |
|
196 | + /* Listing Detail Permalink Settings End */ |
|
197 | 197 | |
198 | 198 | |
199 | 199 | )); // End Design settings |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function geodir_divi_signup_body_class($classes) |
20 | 20 | { |
21 | - if (geodir_is_page('login')) { |
|
22 | - $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
23 | - $classes[] = 'divi-gd-signup'; |
|
24 | - } |
|
25 | - return $classes; |
|
21 | + if (geodir_is_page('login')) { |
|
22 | + $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
23 | + $classes[] = 'divi-gd-signup'; |
|
24 | + } |
|
25 | + return $classes; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | add_action('geodir_wrapper_close', 'geodir_divi_action_wrapper_close', 11); |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function geodir_divi_action_wrapper_close() |
36 | 36 | { |
37 | - if (geodir_is_page('login')) { |
|
38 | - // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
39 | - echo '</div></div>'; |
|
40 | - } |
|
37 | + if (geodir_is_page('login')) { |
|
38 | + // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
39 | + echo '</div></div>'; |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | \ No newline at end of file |
@@ -126,8 +126,10 @@ |
||
126 | 126 | $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
127 | 127 | if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
128 | 128 | return $matches[0]; |
129 | - } else return ''; |
|
130 | -} |
|
129 | + } else { |
|
130 | + return ''; |
|
131 | + } |
|
132 | + } |
|
131 | 133 | |
132 | 134 | |
133 | 135 | /** |
@@ -16,36 +16,36 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function multi_news_action_calls() |
18 | 18 | { |
19 | - // REMOVE BREADCRUMB |
|
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | - |
|
27 | - //ADD BREADCRUMS |
|
28 | - add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
29 | - add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
30 | - add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
31 | - add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
32 | - //add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
33 | - add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
34 | - |
|
35 | - |
|
36 | - // fix breadcrums |
|
37 | - add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1); |
|
38 | - |
|
39 | - // REMOVE PAGE TITLES |
|
40 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
41 | - // remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10); |
|
42 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
43 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
44 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
45 | - |
|
46 | - |
|
47 | - add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1); |
|
48 | - add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1); |
|
19 | + // REMOVE BREADCRUMB |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | + |
|
27 | + //ADD BREADCRUMS |
|
28 | + add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
29 | + add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
30 | + add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
31 | + add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
32 | + //add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
33 | + add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
34 | + |
|
35 | + |
|
36 | + // fix breadcrums |
|
37 | + add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1); |
|
38 | + |
|
39 | + // REMOVE PAGE TITLES |
|
40 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
41 | + // remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10); |
|
42 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
43 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
44 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
45 | + |
|
46 | + |
|
47 | + add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1); |
|
48 | + add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | function gd_mn_extra_wrap($page) |
59 | 59 | { |
60 | - if ($page == 'add-listing-page') { |
|
61 | - echo '<div class="site-content page-wrap">'; |
|
62 | - } elseif ($page == 'signup-page') { |
|
63 | - echo '</div><div class="section full-width-section" style="float: left;width:100%;">'; |
|
64 | - } |
|
60 | + if ($page == 'add-listing-page') { |
|
61 | + echo '<div class="site-content page-wrap">'; |
|
62 | + } elseif ($page == 'signup-page') { |
|
63 | + echo '</div><div class="section full-width-section" style="float: left;width:100%;">'; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function gd_mn_extra_wrap_end($page) |
77 | 77 | { |
78 | - if ($page == 'add-listing-page') { |
|
79 | - echo '</div>'; |
|
80 | - } |
|
78 | + if ($page == 'add-listing-page') { |
|
79 | + echo '</div>'; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |
83 | 83 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | function gd_mn_replace_breadcrums() |
92 | 92 | { |
93 | 93 | |
94 | - if (mom_option('breadcrumb') != 0) { ?> |
|
94 | + if (mom_option('breadcrumb') != 0) { ?> |
|
95 | 95 | <?php if (mom_option('cats_bread')) { |
96 | - $cclass = ''; |
|
97 | - if (mom_option('cat_slider') == false) { |
|
98 | - $cclass = 'post-crumbs '; |
|
99 | - } |
|
100 | - ?> |
|
96 | + $cclass = ''; |
|
97 | + if (mom_option('cat_slider') == false) { |
|
98 | + $cclass = 'post-crumbs '; |
|
99 | + } |
|
100 | + ?> |
|
101 | 101 | <div class="<?php echo $cclass; ?>entry-crumbs" xmlns:v="http://rdf.data-vocabulary.org/#"> |
102 | 102 | |
103 | 103 | <?php mom_breadcrumb(); ?> |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function gd_get_breadcrum_links() |
121 | 121 | { |
122 | - ob_start(); |
|
123 | - geodir_breadcrumb(); |
|
124 | - $crums = ob_get_contents(); |
|
125 | - ob_get_clean(); |
|
126 | - $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
|
127 | - if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
|
128 | - return $matches[0]; |
|
129 | - } else return ''; |
|
122 | + ob_start(); |
|
123 | + geodir_breadcrumb(); |
|
124 | + $crums = ob_get_contents(); |
|
125 | + ob_get_clean(); |
|
126 | + $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
|
127 | + if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
|
128 | + return $matches[0]; |
|
129 | + } else return ''; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -140,30 +140,30 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function gd_breadcrumbs_plus_items($items) |
142 | 142 | { //print_r($items);exit; |
143 | - $bits = array(); |
|
144 | - $pieces = gd_get_breadcrum_links(); |
|
145 | - //unset($pieces[0]); |
|
146 | - $bits = $pieces; |
|
143 | + $bits = array(); |
|
144 | + $pieces = gd_get_breadcrum_links(); |
|
145 | + //unset($pieces[0]); |
|
146 | + $bits = $pieces; |
|
147 | 147 | |
148 | - $title = $items['last']; |
|
149 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
148 | + $title = $items['last']; |
|
149 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
150 | 150 | |
151 | - } elseif (geodir_is_page('listing')) { |
|
151 | + } elseif (geodir_is_page('listing')) { |
|
152 | 152 | |
153 | - } elseif (geodir_is_page('detail')) { |
|
154 | - ob_start(); |
|
155 | - geodir_action_page_title(); |
|
156 | - $title = ob_get_contents(); |
|
157 | - ob_end_clean(); |
|
158 | - } elseif (geodir_is_page('search')) { |
|
159 | - } elseif (geodir_is_page('author')) { |
|
160 | - } |
|
153 | + } elseif (geodir_is_page('detail')) { |
|
154 | + ob_start(); |
|
155 | + geodir_action_page_title(); |
|
156 | + $title = ob_get_contents(); |
|
157 | + ob_end_clean(); |
|
158 | + } elseif (geodir_is_page('search')) { |
|
159 | + } elseif (geodir_is_page('author')) { |
|
160 | + } |
|
161 | 161 | |
162 | - $title = strip_tags($title); |
|
163 | - $items = gd_breadcrumbs_plus_items_add($items, $bits, $title); |
|
162 | + $title = strip_tags($title); |
|
163 | + $items = gd_breadcrumbs_plus_items_add($items, $bits, $title); |
|
164 | 164 | |
165 | 165 | |
166 | - return $items; |
|
166 | + return $items; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -179,28 +179,28 @@ discard block |
||
179 | 179 | */ |
180 | 180 | function gd_breadcrumbs_plus_items_add($items, $bits, $last) |
181 | 181 | { |
182 | - //$pieces = explode("</div>", $items[0]); |
|
183 | - if (is_array($bits)) { |
|
184 | - $items = array(); |
|
185 | - $pieces = ''; |
|
186 | - foreach ($bits as $bit) { |
|
187 | - $pieces .= $bit; |
|
188 | - } |
|
189 | - $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>"; |
|
190 | - if (isset($last) && $last) { |
|
191 | - $items['last'] = $last; |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - //print_r($items); |
|
196 | - return $items; |
|
182 | + //$pieces = explode("</div>", $items[0]); |
|
183 | + if (is_array($bits)) { |
|
184 | + $items = array(); |
|
185 | + $pieces = ''; |
|
186 | + foreach ($bits as $bit) { |
|
187 | + $pieces .= $bit; |
|
188 | + } |
|
189 | + $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>"; |
|
190 | + if (isset($last) && $last) { |
|
191 | + $items['last'] = $last; |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + //print_r($items); |
|
196 | + return $items; |
|
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | 200 | add_filter('geodir_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1); |
201 | 201 | add_filter('geodir_location_switcher_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1); |
202 | 202 | function gd_multinews_mobile_menu_caret($html){ |
203 | - $html .= '<i class="responsive-caret"></i>'; |
|
204 | - return $html; |
|
203 | + $html .= '<i class="responsive-caret"></i>'; |
|
204 | + return $html; |
|
205 | 205 | |
206 | 206 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | foreach ($bits as $bit) { |
187 | 187 | $pieces .= $bit; |
188 | 188 | } |
189 | - $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>"; |
|
189 | + $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">'.$pieces."</div>"; |
|
190 | 190 | if (isset($last) && $last) { |
191 | 191 | $items['last'] = $last; |
192 | 192 | } |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | -add_filter('geodir_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1); |
|
201 | -add_filter('geodir_location_switcher_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1); |
|
202 | -function gd_multinews_mobile_menu_caret($html){ |
|
200 | +add_filter('geodir_menu_after_sub_ul', 'gd_multinews_mobile_menu_caret', 10, 1); |
|
201 | +add_filter('geodir_location_switcher_menu_after_sub_ul', 'gd_multinews_mobile_menu_caret', 10, 1); |
|
202 | +function gd_multinews_mobile_menu_caret($html) { |
|
203 | 203 | $html .= '<i class="responsive-caret"></i>'; |
204 | 204 | return $html; |
205 | 205 |
@@ -13,8 +13,8 @@ |
||
13 | 13 | * If user is not signed in, redirect home. |
14 | 14 | */ |
15 | 15 | if (get_current_user_id()) { |
16 | - wp_redirect(home_url(), 302); |
|
17 | - exit; |
|
16 | + wp_redirect(home_url(), 302); |
|
17 | + exit; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | // call header |
@@ -15,29 +15,29 @@ discard block |
||
15 | 15 | <?php |
16 | 16 | |
17 | 17 | |
18 | - global $wpdb; |
|
18 | + global $wpdb; |
|
19 | 19 | |
20 | - $post_id = $_REQUEST['pid']; |
|
21 | - $post_info = get_post($post_id); |
|
20 | + $post_id = $_REQUEST['pid']; |
|
21 | + $post_info = get_post($post_id); |
|
22 | 22 | |
23 | - $posted_date = $post_info->post_date; |
|
24 | - $productlink = get_permalink($post_id); |
|
25 | - $siteName = get_bloginfo('name'); |
|
26 | - $siteurl = home_url(); |
|
27 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
23 | + $posted_date = $post_info->post_date; |
|
24 | + $productlink = get_permalink($post_id); |
|
25 | + $siteName = get_bloginfo('name'); |
|
26 | + $siteurl = home_url(); |
|
27 | + $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
28 | 28 | |
29 | - $loginurl = geodir_login_url(); |
|
30 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
29 | + $loginurl = geodir_login_url(); |
|
30 | + $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
31 | 31 | |
32 | - $post_author = $post_info->post_author; |
|
32 | + $post_author = $post_info->post_author; |
|
33 | 33 | |
34 | - $user_info = get_userdata($post_author); |
|
35 | - $username = $user_info->user_login; |
|
36 | - $user_email = $user_info->user_email; |
|
34 | + $user_info = get_userdata($post_author); |
|
35 | + $username = $user_info->user_login; |
|
36 | + $user_email = $user_info->user_email; |
|
37 | 37 | |
38 | - $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory')); |
|
38 | + $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory')); |
|
39 | 39 | |
40 | - /* |
|
40 | + /* |
|
41 | 41 | * Filter the success page message before variable replacements. |
42 | 42 | * |
43 | 43 | * @since 1.5.7 |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * @param object $post_info Post object. |
46 | 46 | * @param object $user_info User object. |
47 | 47 | */ |
48 | - $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info); |
|
48 | + $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info); |
|
49 | 49 | |
50 | - $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]'); |
|
51 | - $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
|
52 | - $message = str_replace($search_array, $replace_array, $message); |
|
50 | + $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]'); |
|
51 | + $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
|
52 | + $message = str_replace($search_array, $replace_array, $message); |
|
53 | 53 | |
54 | - /* |
|
54 | + /* |
|
55 | 55 | * Filter the success page message after variable replacements. |
56 | 56 | * |
57 | 57 | * @since 1.5.7 |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | * @param object $post_info Post object. |
60 | 60 | * @param object $user_info User object. |
61 | 61 | */ |
62 | - $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info); |
|
62 | + $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info); |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | - ?> |
|
66 | + ?> |
|
67 | 67 | |
68 | 68 | <?php |
69 | 69 | |
70 | - /* |
|
70 | + /* |
|
71 | 71 | * Action called before the success page message wrapper. |
72 | 72 | * |
73 | 73 | * @since 1.5.7 |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @param object $post_info Post object. |
76 | 76 | * @param object $user_info User object. |
77 | 77 | */ |
78 | - do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
79 | - echo '<h5 class="geodir_information">'; |
|
80 | - echo $message; |
|
81 | - echo '</h5>'; |
|
82 | - /* |
|
78 | + do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
79 | + echo '<h5 class="geodir_information">'; |
|
80 | + echo $message; |
|
81 | + echo '</h5>'; |
|
82 | + /* |
|
83 | 83 | * Action called after the success page message wrapper. |
84 | 84 | * |
85 | 85 | * @since 1.5.7 |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * @param object $post_info Post object. |
88 | 88 | * @param object $user_info User object. |
89 | 89 | */ |
90 | - do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
90 | + do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
91 | 91 | |
92 | - ?> |
|
92 | + ?> |
|
93 | 93 | |
94 | 94 | </div> |
95 | 95 | \ No newline at end of file |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | $productlink = get_permalink($post_id); |
25 | 25 | $siteName = get_bloginfo('name'); |
26 | 26 | $siteurl = home_url(); |
27 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
27 | + $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>'; |
|
28 | 28 | |
29 | 29 | $loginurl = geodir_login_url(); |
30 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
30 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
31 | 31 | |
32 | 32 | $post_author = $post_info->post_author; |
33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $username = $user_info->user_login; |
36 | 36 | $user_email = $user_info->user_email; |
37 | 37 | |
38 | - $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory')); |
|
38 | + $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')), 'geodirectory')); |
|
39 | 39 | |
40 | 40 | /* |
41 | 41 | * Filter the success page message before variable replacements. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param object $post_info Post object. |
46 | 46 | * @param object $user_info User object. |
47 | 47 | */ |
48 | - $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info); |
|
48 | + $message = apply_filters('geodir_success_page_msg_before_var_replace', $message, $post_info, $user_info); |
|
49 | 49 | |
50 | 50 | $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]'); |
51 | 51 | $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param object $post_info Post object. |
60 | 60 | * @param object $user_info User object. |
61 | 61 | */ |
62 | - $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info); |
|
62 | + $message = apply_filters('geodir_success_page_msg_after_var_replace', $message, $post_info, $user_info); |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param object $post_info Post object. |
76 | 76 | * @param object $user_info User object. |
77 | 77 | */ |
78 | - do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
78 | + do_action('geodir_before_success_page_msg_wrapper', $message, $post_info, $user_info); |
|
79 | 79 | echo '<h5 class="geodir_information">'; |
80 | 80 | echo $message; |
81 | 81 | echo '</h5>'; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param object $post_info Post object. |
88 | 88 | * @param object $user_info User object. |
89 | 89 | */ |
90 | - do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info); |
|
90 | + do_action('geodir_after_success_page_msg_wrapper', $message, $post_info, $user_info); |
|
91 | 91 | |
92 | 92 | ?> |
93 | 93 |
@@ -190,10 +190,11 @@ discard block |
||
190 | 190 | $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
191 | 191 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
192 | 192 | $instance['character_count'] = $new_instance['character_count']; |
193 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
194 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | - else |
|
196 | - $instance['add_location_filter'] = '0'; |
|
193 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
194 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | + } else { |
|
196 | + $instance['add_location_filter'] = '0'; |
|
197 | + } |
|
197 | 198 | |
198 | 199 | $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
199 | 200 | $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
@@ -319,8 +320,9 @@ discard block |
||
319 | 320 | |
320 | 321 | $all_postypes = geodir_get_posttypes(); |
321 | 322 | |
322 | - if (!in_array($post_type, $all_postypes)) |
|
323 | - $post_type = 'gd_place'; |
|
323 | + if (!in_array($post_type, $all_postypes)) { |
|
324 | + $post_type = 'gd_place'; |
|
325 | + } |
|
324 | 326 | |
325 | 327 | $category_taxonomy = geodir_get_taxonomies($post_type); |
326 | 328 | $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
@@ -335,8 +337,9 @@ discard block |
||
335 | 337 | } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
336 | 338 | <?php foreach ($categories as $category_obj) { |
337 | 339 | $selected = ''; |
338 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
339 | - echo $selected = 'selected="selected"'; |
|
340 | + if (is_array($category) && in_array($category_obj->term_id, $category)) { |
|
341 | + echo $selected = 'selected="selected"'; |
|
342 | + } |
|
340 | 343 | |
341 | 344 | ?> |
342 | 345 | |
@@ -350,7 +353,12 @@ discard block |
||
350 | 353 | |
351 | 354 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
352 | 355 | id="<?php echo $this->get_field_id('category_title'); ?>" |
353 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
356 | + value="<?php if ($category_title != '') { |
|
357 | + echo $category_title; |
|
358 | +} else { |
|
359 | + echo __('All', 'geodirectory'); |
|
360 | +} |
|
361 | +?>"/> |
|
354 | 362 | |
355 | 363 | </label> |
356 | 364 | </p> |
@@ -453,7 +461,10 @@ discard block |
||
453 | 461 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
454 | 462 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
455 | 463 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
456 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
464 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
465 | + echo 'checked="checked"'; |
|
466 | +} |
|
467 | +?> |
|
457 | 468 | value="1"/> |
458 | 469 | </label> |
459 | 470 | </p> |
@@ -461,7 +472,10 @@ discard block |
||
461 | 472 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
462 | 473 | <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
463 | 474 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
464 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
475 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
476 | + echo 'checked="checked"'; |
|
477 | +} |
|
478 | +?> |
|
465 | 479 | value="1"/> |
466 | 480 | </label> |
467 | 481 | </p> |
@@ -469,7 +483,10 @@ discard block |
||
469 | 483 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
470 | 484 | <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
471 | 485 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
472 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
486 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) { |
|
487 | + echo 'checked="checked"'; |
|
488 | +} |
|
489 | +?> |
|
473 | 490 | value="1"/> |
474 | 491 | </label> |
475 | 492 | </p> |
@@ -477,7 +494,10 @@ discard block |
||
477 | 494 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
478 | 495 | <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
479 | 496 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
480 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
497 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) { |
|
498 | + echo 'checked="checked"'; |
|
499 | +} |
|
500 | +?> |
|
481 | 501 | value="1"/> |
482 | 502 | </label> |
483 | 503 | </p> |
@@ -485,7 +505,10 @@ discard block |
||
485 | 505 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
486 | 506 | <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
487 | 507 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
488 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
508 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) { |
|
509 | + echo 'checked="checked"'; |
|
510 | +} |
|
511 | +?> |
|
489 | 512 | value="1"/> |
490 | 513 | </label> |
491 | 514 | </p> |
@@ -14,83 +14,83 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_popular_post_category extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
18 | - * Register the popular post category widget. |
|
19 | - * |
|
20 | - * @since 1.0.0 |
|
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'popular_post_category', // Base ID |
|
27 | - __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Front-end display content for popular post category widget. |
|
34 | - * |
|
35 | - * @since 1.0.0 |
|
36 | - * @since 1.5.1 Declare function public. |
|
37 | - * |
|
38 | - * @param array $args Widget arguments. |
|
39 | - * @param array $instance Saved values from database. |
|
40 | - */ |
|
41 | - public function widget($args, $instance) |
|
42 | - { |
|
43 | - geodir_popular_post_category_output($args, $instance); |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Sanitize popular post category widget form values as they are saved. |
|
48 | - * |
|
49 | - * @since 1.0.0 |
|
50 | - * @since 1.5.1 Declare function public. |
|
51 | - * @since 1.5.1 Added default_post_type parameter. |
|
52 | - * @since 1.6.9 Added parent_only parameter. |
|
53 | - * |
|
54 | - * @param array $new_instance Values just sent to be saved. |
|
55 | - * @param array $old_instance Previously saved values from database. |
|
56 | - * |
|
57 | - * @return array Updated safe values to be saved. |
|
58 | - */ |
|
59 | - public function update($new_instance, $old_instance) |
|
60 | - { |
|
61 | - //save the widget |
|
62 | - $instance = $old_instance; |
|
63 | - $instance['title'] = strip_tags($new_instance['title']); |
|
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
65 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | - $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | - $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | - return $instance; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Back-end popular post category widget settings form. |
|
73 | - * |
|
74 | - * @since 1.0.0 |
|
75 | - * @since 1.5.1 Declare function public. |
|
76 | - * @since 1.5.1 Added option to set default post type. |
|
77 | - * @since 1.6.9 Added option to show parent categories only. |
|
78 | - * |
|
79 | - * @param array $instance Previously saved values from database. |
|
80 | - */ |
|
81 | - public function form($instance) |
|
82 | - { |
|
83 | - //widgetform in backend |
|
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | - |
|
86 | - $title = strip_tags($instance['title']); |
|
87 | - $category_limit = (int)$instance['category_limit']; |
|
88 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | - $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
17 | + /** |
|
18 | + * Register the popular post category widget. |
|
19 | + * |
|
20 | + * @since 1.0.0 |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'popular_post_category', // Base ID |
|
27 | + __('GD > Popular Post Category', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Front-end display content for popular post category widget. |
|
34 | + * |
|
35 | + * @since 1.0.0 |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | + * |
|
38 | + * @param array $args Widget arguments. |
|
39 | + * @param array $instance Saved values from database. |
|
40 | + */ |
|
41 | + public function widget($args, $instance) |
|
42 | + { |
|
43 | + geodir_popular_post_category_output($args, $instance); |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Sanitize popular post category widget form values as they are saved. |
|
48 | + * |
|
49 | + * @since 1.0.0 |
|
50 | + * @since 1.5.1 Declare function public. |
|
51 | + * @since 1.5.1 Added default_post_type parameter. |
|
52 | + * @since 1.6.9 Added parent_only parameter. |
|
53 | + * |
|
54 | + * @param array $new_instance Values just sent to be saved. |
|
55 | + * @param array $old_instance Previously saved values from database. |
|
56 | + * |
|
57 | + * @return array Updated safe values to be saved. |
|
58 | + */ |
|
59 | + public function update($new_instance, $old_instance) |
|
60 | + { |
|
61 | + //save the widget |
|
62 | + $instance = $old_instance; |
|
63 | + $instance['title'] = strip_tags($new_instance['title']); |
|
64 | + $category_limit = (int)$new_instance['category_limit']; |
|
65 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
66 | + $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
67 | + $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
68 | + return $instance; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Back-end popular post category widget settings form. |
|
73 | + * |
|
74 | + * @since 1.0.0 |
|
75 | + * @since 1.5.1 Declare function public. |
|
76 | + * @since 1.5.1 Added option to set default post type. |
|
77 | + * @since 1.6.9 Added option to show parent categories only. |
|
78 | + * |
|
79 | + * @param array $instance Previously saved values from database. |
|
80 | + */ |
|
81 | + public function form($instance) |
|
82 | + { |
|
83 | + //widgetform in backend |
|
84 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | + |
|
86 | + $title = strip_tags($instance['title']); |
|
87 | + $category_limit = (int)$instance['category_limit']; |
|
88 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
89 | + $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
90 | + $parent_only = !empty($instance['parent_only']) ? true: false; |
|
91 | 91 | |
92 | - $post_type_options = geodir_get_posttypes('options'); |
|
93 | - ?> |
|
92 | + $post_type_options = geodir_get_posttypes('options'); |
|
93 | + ?> |
|
94 | 94 | <p> |
95 | 95 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
96 | 96 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/> |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
117 | 117 | </p> |
118 | 118 | <?php |
119 | - } |
|
119 | + } |
|
120 | 120 | } // class geodir_popular_post_category |
121 | 121 | |
122 | 122 | register_widget('geodir_popular_post_category'); |
@@ -130,40 +130,40 @@ discard block |
||
130 | 130 | class geodir_popular_postview extends WP_Widget |
131 | 131 | { |
132 | 132 | |
133 | - /** |
|
133 | + /** |
|
134 | 134 | * Register the popular posts widget. |
135 | 135 | * |
136 | 136 | * @since 1.0.0 |
137 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
137 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
138 | 138 | */ |
139 | - public function __construct() { |
|
140 | - $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | - parent::__construct( |
|
142 | - 'popular_post_view', // Base ID |
|
143 | - __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | - $widget_ops// Args |
|
145 | - ); |
|
146 | - } |
|
139 | + public function __construct() { |
|
140 | + $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory')); |
|
141 | + parent::__construct( |
|
142 | + 'popular_post_view', // Base ID |
|
143 | + __('GD > Popular Post View', 'geodirectory'), // Name |
|
144 | + $widget_ops// Args |
|
145 | + ); |
|
146 | + } |
|
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Front-end display content for popular posts widget. |
150 | 150 | * |
151 | 151 | * @since 1.0.0 |
152 | - * @since 1.5.1 Declare function public. |
|
152 | + * @since 1.5.1 Declare function public. |
|
153 | 153 | * |
154 | 154 | * @param array $args Widget arguments. |
155 | 155 | * @param array $instance Saved values from database. |
156 | 156 | */ |
157 | 157 | public function widget($args, $instance) |
158 | - { |
|
159 | - geodir_popular_postview_output($args, $instance); |
|
160 | - } |
|
158 | + { |
|
159 | + geodir_popular_postview_output($args, $instance); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Sanitize popular posts widget form values as they are saved. |
164 | 164 | * |
165 | 165 | * @since 1.0.0 |
166 | - * @since 1.5.1 Declare function public. |
|
166 | + * @since 1.5.1 Declare function public. |
|
167 | 167 | * |
168 | 168 | * @param array $new_instance Values just sent to be saved. |
169 | 169 | * @param array $old_instance Previously saved values from database. |
@@ -171,99 +171,99 @@ discard block |
||
171 | 171 | * @return array Updated safe values to be saved. |
172 | 172 | */ |
173 | 173 | public function update($new_instance, $old_instance) |
174 | - { |
|
175 | - //save the widget |
|
176 | - $instance = $old_instance; |
|
177 | - |
|
178 | - if ($new_instance['title'] == '') { |
|
179 | - $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | - //$instance['title'] = $title; |
|
181 | - } |
|
182 | - $instance['title'] = strip_tags($new_instance['title']); |
|
183 | - |
|
184 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | - //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | - $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | - $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | - $instance['character_count'] = $new_instance['character_count']; |
|
193 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
194 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | - else |
|
196 | - $instance['add_location_filter'] = '0'; |
|
197 | - |
|
198 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
199 | - $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
200 | - $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
201 | - $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
202 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
203 | - |
|
204 | - return $instance; |
|
205 | - } |
|
174 | + { |
|
175 | + //save the widget |
|
176 | + $instance = $old_instance; |
|
177 | + |
|
178 | + if ($new_instance['title'] == '') { |
|
179 | + $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
180 | + //$instance['title'] = $title; |
|
181 | + } |
|
182 | + $instance['title'] = strip_tags($new_instance['title']); |
|
183 | + |
|
184 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
185 | + //$instance['category'] = strip_tags($new_instance['category']); |
|
186 | + $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
187 | + $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
188 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
189 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
190 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
191 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
192 | + $instance['character_count'] = $new_instance['character_count']; |
|
193 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
194 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
195 | + else |
|
196 | + $instance['add_location_filter'] = '0'; |
|
197 | + |
|
198 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
199 | + $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
200 | + $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
201 | + $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
202 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
203 | + |
|
204 | + return $instance; |
|
205 | + } |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Back-end popular posts widget settings form. |
209 | 209 | * |
210 | 210 | * @since 1.0.0 |
211 | - * @since 1.5.1 Declare function public. |
|
211 | + * @since 1.5.1 Declare function public. |
|
212 | 212 | * |
213 | 213 | * @param array $instance Previously saved values from database. |
214 | 214 | */ |
215 | 215 | public function form($instance) |
216 | - { |
|
217 | - //widgetform in backend |
|
218 | - $instance = wp_parse_args((array)$instance, |
|
219 | - array('title' => '', |
|
220 | - 'post_type' => '', |
|
221 | - 'category' => array(), |
|
222 | - 'category_title' => '', |
|
223 | - 'list_sort' => '', |
|
224 | - 'list_order' => '', |
|
225 | - 'post_number' => '5', |
|
226 | - 'layout' => 'gridview_onehalf', |
|
227 | - 'listing_width' => '', |
|
228 | - 'add_location_filter' => '1', |
|
229 | - 'character_count' => '20', |
|
230 | - 'show_featured_only' => '', |
|
231 | - 'show_special_only' => '', |
|
232 | - 'with_pics_only' => '', |
|
233 | - 'with_videos_only' => '', |
|
234 | - 'use_viewing_post_type' => '' |
|
235 | - ) |
|
236 | - ); |
|
216 | + { |
|
217 | + //widgetform in backend |
|
218 | + $instance = wp_parse_args((array)$instance, |
|
219 | + array('title' => '', |
|
220 | + 'post_type' => '', |
|
221 | + 'category' => array(), |
|
222 | + 'category_title' => '', |
|
223 | + 'list_sort' => '', |
|
224 | + 'list_order' => '', |
|
225 | + 'post_number' => '5', |
|
226 | + 'layout' => 'gridview_onehalf', |
|
227 | + 'listing_width' => '', |
|
228 | + 'add_location_filter' => '1', |
|
229 | + 'character_count' => '20', |
|
230 | + 'show_featured_only' => '', |
|
231 | + 'show_special_only' => '', |
|
232 | + 'with_pics_only' => '', |
|
233 | + 'with_videos_only' => '', |
|
234 | + 'use_viewing_post_type' => '' |
|
235 | + ) |
|
236 | + ); |
|
237 | 237 | |
238 | - $title = strip_tags($instance['title']); |
|
238 | + $title = strip_tags($instance['title']); |
|
239 | 239 | |
240 | - $post_type = strip_tags($instance['post_type']); |
|
240 | + $post_type = strip_tags($instance['post_type']); |
|
241 | 241 | |
242 | - $category = $instance['category']; |
|
242 | + $category = $instance['category']; |
|
243 | 243 | |
244 | - $category_title = strip_tags($instance['category_title']); |
|
244 | + $category_title = strip_tags($instance['category_title']); |
|
245 | 245 | |
246 | - $list_sort = strip_tags($instance['list_sort']); |
|
246 | + $list_sort = strip_tags($instance['list_sort']); |
|
247 | 247 | |
248 | - $list_order = strip_tags($instance['list_order']); |
|
248 | + $list_order = strip_tags($instance['list_order']); |
|
249 | 249 | |
250 | - $post_number = strip_tags($instance['post_number']); |
|
250 | + $post_number = strip_tags($instance['post_number']); |
|
251 | 251 | |
252 | - $layout = strip_tags($instance['layout']); |
|
252 | + $layout = strip_tags($instance['layout']); |
|
253 | 253 | |
254 | - $listing_width = strip_tags($instance['listing_width']); |
|
254 | + $listing_width = strip_tags($instance['listing_width']); |
|
255 | 255 | |
256 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
256 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
257 | 257 | |
258 | - $character_count = $instance['character_count']; |
|
258 | + $character_count = $instance['character_count']; |
|
259 | 259 | |
260 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
261 | - $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
262 | - $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
263 | - $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
264 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
260 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
261 | + $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
262 | + $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
263 | + $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
264 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
265 | 265 | |
266 | - ?> |
|
266 | + ?> |
|
267 | 267 | |
268 | 268 | <p> |
269 | 269 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | <?php foreach ($postypes as $postypes_obj) { ?> |
299 | 299 | |
300 | 300 | <option <?php if ($post_type == $postypes_obj) { |
301 | - echo 'selected="selected"'; |
|
302 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
303 | - echo ucfirst($extvalue[1]); ?></option> |
|
301 | + echo 'selected="selected"'; |
|
302 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
303 | + echo ucfirst($extvalue[1]); ?></option> |
|
304 | 304 | |
305 | 305 | <?php } ?> |
306 | 306 | |
@@ -315,30 +315,30 @@ discard block |
||
315 | 315 | |
316 | 316 | <?php |
317 | 317 | |
318 | - $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
318 | + $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
319 | 319 | |
320 | - $all_postypes = geodir_get_posttypes(); |
|
320 | + $all_postypes = geodir_get_posttypes(); |
|
321 | 321 | |
322 | - if (!in_array($post_type, $all_postypes)) |
|
323 | - $post_type = 'gd_place'; |
|
322 | + if (!in_array($post_type, $all_postypes)) |
|
323 | + $post_type = 'gd_place'; |
|
324 | 324 | |
325 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
326 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
325 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
326 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC')); |
|
327 | 327 | |
328 | - ?> |
|
328 | + ?> |
|
329 | 329 | |
330 | 330 | <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]" |
331 | 331 | onchange="geodir_popular_widget_cat_title(this)"> |
332 | 332 | |
333 | 333 | <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) { |
334 | - echo 'selected="selected"'; |
|
335 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
334 | + echo 'selected="selected"'; |
|
335 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option> |
|
336 | 336 | <?php foreach ($categories as $category_obj) { |
337 | - $selected = ''; |
|
338 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
339 | - echo $selected = 'selected="selected"'; |
|
337 | + $selected = ''; |
|
338 | + if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
339 | + echo $selected = 'selected="selected"'; |
|
340 | 340 | |
341 | - ?> |
|
341 | + ?> |
|
342 | 342 | |
343 | 343 | <option <?php echo $selected; ?> |
344 | 344 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
@@ -363,28 +363,28 @@ discard block |
||
363 | 363 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
364 | 364 | |
365 | 365 | <option <?php if ($list_sort == 'az') { |
366 | - echo 'selected="selected"'; |
|
367 | - } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option> |
|
366 | + echo 'selected="selected"'; |
|
367 | + } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option> |
|
368 | 368 | |
369 | 369 | <option <?php if ($list_sort == 'latest') { |
370 | - echo 'selected="selected"'; |
|
371 | - } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
370 | + echo 'selected="selected"'; |
|
371 | + } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
372 | 372 | |
373 | 373 | <option <?php if ($list_sort == 'featured') { |
374 | - echo 'selected="selected"'; |
|
375 | - } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
374 | + echo 'selected="selected"'; |
|
375 | + } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
376 | 376 | |
377 | 377 | <option <?php if ($list_sort == 'high_review') { |
378 | - echo 'selected="selected"'; |
|
379 | - } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
378 | + echo 'selected="selected"'; |
|
379 | + } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
380 | 380 | |
381 | 381 | <option <?php if ($list_sort == 'high_rating') { |
382 | - echo 'selected="selected"'; |
|
383 | - } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
382 | + echo 'selected="selected"'; |
|
383 | + } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
384 | 384 | |
385 | 385 | <option <?php if ($list_sort == 'random') { |
386 | - echo 'selected="selected"'; |
|
387 | - } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
386 | + echo 'selected="selected"'; |
|
387 | + } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
388 | 388 | |
389 | 389 | </select> |
390 | 390 | </label> |
@@ -407,24 +407,24 @@ discard block |
||
407 | 407 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
408 | 408 | name="<?php echo $this->get_field_name('layout'); ?>"> |
409 | 409 | <option <?php if ($layout == 'gridview_onehalf') { |
410 | - echo 'selected="selected"'; |
|
411 | - } ?> |
|
410 | + echo 'selected="selected"'; |
|
411 | + } ?> |
|
412 | 412 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
413 | 413 | <option <?php if ($layout == 'gridview_onethird') { |
414 | - echo 'selected="selected"'; |
|
415 | - } ?> |
|
414 | + echo 'selected="selected"'; |
|
415 | + } ?> |
|
416 | 416 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
417 | 417 | <option <?php if ($layout == 'gridview_onefourth') { |
418 | - echo 'selected="selected"'; |
|
419 | - } ?> |
|
418 | + echo 'selected="selected"'; |
|
419 | + } ?> |
|
420 | 420 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
421 | 421 | <option <?php if ($layout == 'gridview_onefifth') { |
422 | - echo 'selected="selected"'; |
|
423 | - } ?> |
|
422 | + echo 'selected="selected"'; |
|
423 | + } ?> |
|
424 | 424 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
425 | 425 | <option <?php if ($layout == 'list') { |
426 | - echo 'selected="selected"'; |
|
427 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
426 | + echo 'selected="selected"'; |
|
427 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
428 | 428 | |
429 | 429 | </select> |
430 | 430 | </label> |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
495 | 495 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
496 | 496 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
497 | - echo 'checked="checked"'; |
|
498 | - } ?> value="1"/> |
|
497 | + echo 'checked="checked"'; |
|
498 | + } ?> value="1"/> |
|
499 | 499 | </label> |
500 | 500 | </p> |
501 | 501 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | </script> |
540 | 540 | |
541 | 541 | <?php |
542 | - } |
|
542 | + } |
|
543 | 543 | } // class geodir_popular_postview |
544 | 544 | |
545 | 545 | register_widget('geodir_popular_postview'); |
546 | 546 | \ No newline at end of file |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //save the widget |
62 | 62 | $instance = $old_instance; |
63 | 63 | $instance['title'] = strip_tags($new_instance['title']); |
64 | - $category_limit = (int)$new_instance['category_limit']; |
|
64 | + $category_limit = (int) $new_instance['category_limit']; |
|
65 | 65 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
66 | 66 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
67 | 67 | $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | public function form($instance) |
82 | 82 | { |
83 | 83 | //widgetform in backend |
84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
84 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false)); |
|
85 | 85 | |
86 | 86 | $title = strip_tags($instance['title']); |
87 | - $category_limit = (int)$instance['category_limit']; |
|
87 | + $category_limit = (int) $instance['category_limit']; |
|
88 | 88 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
89 | 89 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
90 | + $parent_only = !empty($instance['parent_only']) ? true : false; |
|
91 | 91 | |
92 | 92 | $post_type_options = geodir_get_posttypes('options'); |
93 | 93 | ?> |
@@ -97,23 +97,23 @@ discard block |
||
97 | 97 | </label> |
98 | 98 | </p> |
99 | 99 | <p> |
100 | - <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?> |
|
100 | + <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?> |
|
101 | 101 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>"> |
102 | 102 | <?php foreach ($post_type_options as $name => $title) { ?> |
103 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
103 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
104 | 104 | <?php } ?> |
105 | 105 | </select> |
106 | 106 | </label> |
107 | 107 | </p> |
108 | 108 | <p> |
109 | 109 | <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?> |
110 | - <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/> |
|
110 | + <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/> |
|
111 | 111 | <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p> |
112 | 112 | </label> |
113 | 113 | </p> |
114 | 114 | <p> |
115 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" /> |
|
116 | - <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label> |
|
115 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" /> |
|
116 | + <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label> |
|
117 | 117 | </p> |
118 | 118 | <?php |
119 | 119 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | public function form($instance) |
216 | 216 | { |
217 | 217 | //widgetform in backend |
218 | - $instance = wp_parse_args((array)$instance, |
|
218 | + $instance = wp_parse_args((array) $instance, |
|
219 | 219 | array('title' => '', |
220 | 220 | 'post_type' => '', |
221 | 221 | 'category' => array(), |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | ?> |
267 | 267 | |
268 | 268 | <p> |
269 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
269 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
270 | 270 | <small>(%posttype_singular_label% , |
271 | - %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>) |
|
271 | + %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>) |
|
272 | 272 | </small> |
273 | 273 | |
274 | 274 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | <p> |
281 | 281 | <label |
282 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
282 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
283 | 283 | |
284 | 284 | <?php $postypes = geodir_get_posttypes(); |
285 | 285 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | <p id="post_type_cats"> |
313 | 313 | <label |
314 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?> |
|
314 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?> |
|
315 | 315 | |
316 | 316 | <?php |
317 | 317 | |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | |
351 | 351 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>" |
352 | 352 | id="<?php echo $this->get_field_id('category_title'); ?>" |
353 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/> |
|
353 | + value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/> |
|
354 | 354 | |
355 | 355 | </label> |
356 | 356 | </p> |
357 | 357 | |
358 | 358 | <p> |
359 | 359 | <label |
360 | - for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
360 | + for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
361 | 361 | |
362 | 362 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
363 | 363 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | <p> |
394 | 394 | |
395 | 395 | <label |
396 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
396 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
397 | 397 | |
398 | 398 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
399 | 399 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | <p> |
405 | 405 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
406 | - <?php _e('Layout:', 'geodirectory');?> |
|
406 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
407 | 407 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
408 | 408 | name="<?php echo $this->get_field_name('layout'); ?>"> |
409 | 409 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | |
433 | 433 | <p> |
434 | 434 | <label |
435 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
435 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
436 | 436 | |
437 | 437 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
438 | 438 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | <p> |
444 | 444 | <label |
445 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
445 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
446 | 446 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
447 | 447 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
448 | 448 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -451,41 +451,41 @@ discard block |
||
451 | 451 | |
452 | 452 | <p> |
453 | 453 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
454 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
454 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
455 | 455 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
456 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
456 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
457 | 457 | value="1"/> |
458 | 458 | </label> |
459 | 459 | </p> |
460 | 460 | <p> |
461 | 461 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>"> |
462 | - <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox" |
|
462 | + <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox" |
|
463 | 463 | id="<?php echo $this->get_field_id('show_featured_only'); ?>" |
464 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?> |
|
464 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?> |
|
465 | 465 | value="1"/> |
466 | 466 | </label> |
467 | 467 | </p> |
468 | 468 | <p> |
469 | 469 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>"> |
470 | - <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox" |
|
470 | + <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox" |
|
471 | 471 | id="<?php echo $this->get_field_id('show_special_only'); ?>" |
472 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?> |
|
472 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?> |
|
473 | 473 | value="1"/> |
474 | 474 | </label> |
475 | 475 | </p> |
476 | 476 | <p> |
477 | 477 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>"> |
478 | - <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox" |
|
478 | + <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox" |
|
479 | 479 | id="<?php echo $this->get_field_id('with_pics_only'); ?>" |
480 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?> |
|
480 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?> |
|
481 | 481 | value="1"/> |
482 | 482 | </label> |
483 | 483 | </p> |
484 | 484 | <p> |
485 | 485 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>"> |
486 | - <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox" |
|
486 | + <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox" |
|
487 | 487 | id="<?php echo $this->get_field_id('with_videos_only'); ?>" |
488 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?> |
|
488 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?> |
|
489 | 489 | value="1"/> |
490 | 490 | </label> |
491 | 491 | </p> |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | |
532 | 532 | } |
533 | 533 | |
534 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?> |
|
534 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?> |
|
535 | 535 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val(); |
536 | 536 | |
537 | 537 | <?php } ?> |
@@ -14,37 +14,37 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_recent_reviews_widget extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * Register the recent reviews widget. |
19 | 19 | * |
20 | 20 | * @since 1.0.0 |
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | 22 | */ |
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'geodir_recent_reviews', // Base ID |
|
27 | - __('GD > Recent Reviews', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'geodir_recent_reviews', // Base ID |
|
27 | + __('GD > Recent Reviews', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Front-end display content for recent reviews widget. |
34 | 34 | * |
35 | 35 | * @since 1.0.0 |
36 | - * @since 1.5.1 Declare function public. |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | 37 | * |
38 | 38 | * @param array $args Widget arguments. |
39 | 39 | * @param array $instance Saved values from database. |
40 | 40 | */ |
41 | 41 | public function widget($args, $instance) |
42 | - { |
|
43 | - // prints the widget |
|
44 | - extract($args, EXTR_SKIP); |
|
42 | + { |
|
43 | + // prints the widget |
|
44 | + extract($args, EXTR_SKIP); |
|
45 | 45 | |
46 | - /** This filter is documented in geodirectory_widgets.php */ |
|
47 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
46 | + /** This filter is documented in geodirectory_widgets.php */ |
|
47 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Filter the number of reviews to display. |
@@ -63,35 +63,35 @@ discard block |
||
63 | 63 | * @param int $g_size Height and width of the avatar image in pixels. Default 30. |
64 | 64 | */ |
65 | 65 | $g_size = apply_filters('geodir_recent_reviews_g_size', 30); |
66 | - /** |
|
67 | - * Filter the excerpt length |
|
68 | - * |
|
69 | - * @since 1.0.0 |
|
70 | - * |
|
71 | - * @param int $excerpt_length Excerpt length. Default 100. |
|
72 | - */ |
|
73 | - $excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100); |
|
74 | - $comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false); |
|
66 | + /** |
|
67 | + * Filter the excerpt length |
|
68 | + * |
|
69 | + * @since 1.0.0 |
|
70 | + * |
|
71 | + * @param int $excerpt_length Excerpt length. Default 100. |
|
72 | + */ |
|
73 | + $excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100); |
|
74 | + $comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false); |
|
75 | 75 | |
76 | - if ($comments_li) { |
|
77 | - echo $before_widget; |
|
78 | - ?> |
|
76 | + if ($comments_li) { |
|
77 | + echo $before_widget; |
|
78 | + ?> |
|
79 | 79 | <div class="widget geodir_recent_reviews_section"> |
80 | 80 | <?php if ($title) { |
81 | - echo $before_title . $title . $after_title; |
|
82 | - } ?> |
|
81 | + echo $before_title . $title . $after_title; |
|
82 | + } ?> |
|
83 | 83 | <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul> |
84 | 84 | </div> |
85 | 85 | <?php |
86 | - echo $after_widget; |
|
87 | - } |
|
88 | - } |
|
86 | + echo $after_widget; |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Sanitize recent reviews widget form values as they are saved. |
92 | 92 | * |
93 | 93 | * @since 1.0.0 |
94 | - * @since 1.5.1 Declare function public. |
|
94 | + * @since 1.5.1 Declare function public. |
|
95 | 95 | * |
96 | 96 | * @param array $new_instance Values just sent to be saved. |
97 | 97 | * @param array $old_instance Previously saved values from database. |
@@ -99,29 +99,29 @@ discard block |
||
99 | 99 | * @return array Updated safe values to be saved. |
100 | 100 | */ |
101 | 101 | public function update($new_instance, $old_instance) |
102 | - { |
|
103 | - //save the widget |
|
104 | - $instance = $old_instance; |
|
105 | - $instance['title'] = strip_tags($new_instance['title']); |
|
106 | - $instance['count'] = strip_tags($new_instance['count']); |
|
107 | - return $instance; |
|
108 | - } |
|
102 | + { |
|
103 | + //save the widget |
|
104 | + $instance = $old_instance; |
|
105 | + $instance['title'] = strip_tags($new_instance['title']); |
|
106 | + $instance['count'] = strip_tags($new_instance['count']); |
|
107 | + return $instance; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Back-end recent reviews widget settings form. |
112 | 112 | * |
113 | 113 | * @since 1.0.0 |
114 | - * @since 1.5.1 Declare function public. |
|
114 | + * @since 1.5.1 Declare function public. |
|
115 | 115 | * |
116 | 116 | * @param array $instance Previously saved values from database. |
117 | 117 | */ |
118 | 118 | public function form($instance) |
119 | - { |
|
120 | - //widgetform in backend |
|
121 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => '')); |
|
122 | - $title = strip_tags($instance['title']); |
|
123 | - $count = strip_tags($instance['count']); |
|
124 | - ?> |
|
119 | + { |
|
120 | + //widgetform in backend |
|
121 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => '')); |
|
122 | + $title = strip_tags($instance['title']); |
|
123 | + $count = strip_tags($instance['count']); |
|
124 | + ?> |
|
125 | 125 | <p><label for="<?php echo $this->get_field_id('title'); ?>">Widget Title: <input class="widefat" |
126 | 126 | id="<?php echo $this->get_field_id('title'); ?>" |
127 | 127 | name="<?php echo $this->get_field_name('title'); ?>" |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | value="<?php echo esc_attr($count); ?>"/></label> |
136 | 136 | </p> |
137 | 137 | <?php |
138 | - } |
|
138 | + } |
|
139 | 139 | } // class geodir_recent_reviews_widget |
140 | 140 | |
141 | 141 | register_widget('geodir_recent_reviews_widget'); |
142 | 142 | \ No newline at end of file |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ?> |
79 | 79 | <div class="widget geodir_recent_reviews_section"> |
80 | 80 | <?php if ($title) { |
81 | - echo $before_title . $title . $after_title; |
|
81 | + echo $before_title.$title.$after_title; |
|
82 | 82 | } ?> |
83 | 83 | <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul> |
84 | 84 | </div> |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function form($instance) |
119 | 119 | { |
120 | 120 | //widgetform in backend |
121 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => '')); |
|
121 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => '')); |
|
122 | 122 | $title = strip_tags($instance['title']); |
123 | 123 | $count = strip_tags($instance['count']); |
124 | 124 | ?> |