@@ -1,53 +1,53 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class AuthorPage extends WP_UnitTestCase |
| 3 | 3 | { |
| 4 | - public function setUp() |
|
| 5 | - { |
|
| 6 | - parent::setUp(); |
|
| 7 | - } |
|
| 4 | + public function setUp() |
|
| 5 | + { |
|
| 6 | + parent::setUp(); |
|
| 7 | + } |
|
| 8 | 8 | |
| 9 | - public function testAuthorPage() |
|
| 10 | - { |
|
| 11 | - global $current_user; |
|
| 9 | + public function testAuthorPage() |
|
| 10 | + { |
|
| 11 | + global $current_user; |
|
| 12 | 12 | |
| 13 | - $user_id = $current_user->ID; |
|
| 13 | + $user_id = $current_user->ID; |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | |
| 17 | - // Add listing |
|
| 17 | + // Add listing |
|
| 18 | 18 | |
| 19 | - $args = array( |
|
| 20 | - 'listing_type' => 'gd_place', |
|
| 21 | - 'post_title' => 'Test Listing Title 2', |
|
| 22 | - 'post_desc' => 'Test Desc', |
|
| 23 | - 'post_tags' => 'test1,test2', |
|
| 24 | - 'post_address' => 'New York City Hall', |
|
| 25 | - 'post_zip' => '10007', |
|
| 26 | - 'post_mapview' => 'ROADMAP', |
|
| 27 | - 'post_mapzoom' => '10', |
|
| 28 | - 'geodir_timing' => '10.00 am to 6 pm every day', |
|
| 29 | - 'geodir_contact' => '1234567890', |
|
| 30 | - 'geodir_email' => '[email protected]', |
|
| 31 | - 'geodir_website' => 'http://test.com', |
|
| 32 | - 'geodir_twitter' => 'http://twitter.com/test', |
|
| 33 | - 'geodir_facebook' => 'http://facebook.com/test', |
|
| 34 | - 'geodir_special_offers' => 'Test offer' |
|
| 35 | - ); |
|
| 36 | - $post_id = geodir_save_listing($args, true); |
|
| 19 | + $args = array( |
|
| 20 | + 'listing_type' => 'gd_place', |
|
| 21 | + 'post_title' => 'Test Listing Title 2', |
|
| 22 | + 'post_desc' => 'Test Desc', |
|
| 23 | + 'post_tags' => 'test1,test2', |
|
| 24 | + 'post_address' => 'New York City Hall', |
|
| 25 | + 'post_zip' => '10007', |
|
| 26 | + 'post_mapview' => 'ROADMAP', |
|
| 27 | + 'post_mapzoom' => '10', |
|
| 28 | + 'geodir_timing' => '10.00 am to 6 pm every day', |
|
| 29 | + 'geodir_contact' => '1234567890', |
|
| 30 | + 'geodir_email' => '[email protected]', |
|
| 31 | + 'geodir_website' => 'http://test.com', |
|
| 32 | + 'geodir_twitter' => 'http://twitter.com/test', |
|
| 33 | + 'geodir_facebook' => 'http://facebook.com/test', |
|
| 34 | + 'geodir_special_offers' => 'Test offer' |
|
| 35 | + ); |
|
| 36 | + $post_id = geodir_save_listing($args, true); |
|
| 37 | 37 | |
| 38 | - $this->assertTrue(is_int($post_id)); |
|
| 38 | + $this->assertTrue(is_int($post_id)); |
|
| 39 | 39 | |
| 40 | - $count = count_user_posts( $user_id, "gd_place" ); |
|
| 40 | + $count = count_user_posts( $user_id, "gd_place" ); |
|
| 41 | 41 | |
| 42 | - $this->assertTrue(is_int((int) $count)); |
|
| 42 | + $this->assertTrue(is_int((int) $count)); |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public function tearDown() |
|
| 49 | - { |
|
| 50 | - parent::tearDown(); |
|
| 51 | - } |
|
| 48 | + public function tearDown() |
|
| 49 | + { |
|
| 50 | + parent::tearDown(); |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | ?> |
| 54 | 54 | \ No newline at end of file |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | $this->assertTrue(is_int($post_id)); |
| 39 | 39 | |
| 40 | - $count = count_user_posts( $user_id, "gd_place" ); |
|
| 40 | + $count = count_user_posts($user_id, "gd_place"); |
|
| 41 | 41 | |
| 42 | 42 | $this->assertTrue(is_int((int) $count)); |
| 43 | 43 | |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | ###### SIDEBAR ON LEFT ###### |
| 34 | 34 | if (get_option('geodir_detail_sidebar_left_section')) {
|
| 35 | - /** |
|
| 36 | - * Adds the details page sidebar to the details template page. |
|
| 37 | - * |
|
| 38 | - * @since 1.1.0 |
|
| 39 | - */ |
|
| 40 | - do_action('geodir_detail_sidebar');
|
|
| 35 | + /** |
|
| 36 | + * Adds the details page sidebar to the details template page. |
|
| 37 | + * |
|
| 38 | + * @since 1.1.0 |
|
| 39 | + */ |
|
| 40 | + do_action('geodir_detail_sidebar');
|
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | ###### MAIN CONTENT WRAPPERS OPEN ###### |
@@ -63,29 +63,29 @@ discard block |
||
| 63 | 63 | // this call the main page content |
| 64 | 64 | global $preview; |
| 65 | 65 | if (have_posts() && !$preview) {
|
| 66 | - the_post(); |
|
| 67 | - global $post, $post_images; |
|
| 68 | - /** |
|
| 69 | - * Calls the details page main content on the details template page. |
|
| 70 | - * |
|
| 71 | - * @since 1.1.0 |
|
| 72 | - * @param object $post The current post object. |
|
| 73 | - */ |
|
| 74 | - do_action('geodir_details_main_content', $post);
|
|
| 66 | + the_post(); |
|
| 67 | + global $post, $post_images; |
|
| 68 | + /** |
|
| 69 | + * Calls the details page main content on the details template page. |
|
| 70 | + * |
|
| 71 | + * @since 1.1.0 |
|
| 72 | + * @param object $post The current post object. |
|
| 73 | + */ |
|
| 74 | + do_action('geodir_details_main_content', $post);
|
|
| 75 | 75 | } elseif ($preview) {
|
| 76 | - /** |
|
| 77 | - * Called on the details page if the page is being previewed. |
|
| 78 | - * |
|
| 79 | - * This sets the value of `$post` to the preview values before the main content is called. |
|
| 80 | - * |
|
| 81 | - * @since 1.1.0 |
|
| 82 | - */ |
|
| 83 | - do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
|
|
| 84 | - if (defined( 'GD_TESTING_MODE' )) {
|
|
| 85 | - global $post; |
|
| 86 | - } |
|
| 87 | - /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
| 88 | - do_action('geodir_details_main_content', $post);
|
|
| 76 | + /** |
|
| 77 | + * Called on the details page if the page is being previewed. |
|
| 78 | + * |
|
| 79 | + * This sets the value of `$post` to the preview values before the main content is called. |
|
| 80 | + * |
|
| 81 | + * @since 1.1.0 |
|
| 82 | + */ |
|
| 83 | + do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
|
|
| 84 | + if (defined( 'GD_TESTING_MODE' )) {
|
|
| 85 | + global $post; |
|
| 86 | + } |
|
| 87 | + /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
| 88 | + do_action('geodir_details_main_content', $post);
|
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | ###### SIDEBAR ON RIGHT ###### |
| 109 | 109 | if (!get_option('geodir_detail_sidebar_left_section')) {
|
| 110 | - /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
| 111 | - do_action('geodir_detail_sidebar');
|
|
| 110 | + /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
| 111 | + do_action('geodir_detail_sidebar');
|
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param string $itemtype The itemtype value of the HTML element. |
| 58 | 58 | * @see 'geodir_article_close' |
| 59 | 59 | */ |
| 60 | -do_action('geodir_article_open', 'details-page', 'post-' . get_the_ID(), get_post_class(), '');
|
|
| 60 | +do_action('geodir_article_open', 'details-page', 'post-'.get_the_ID(), get_post_class(), '');
|
|
| 61 | 61 | |
| 62 | 62 | ###### MAIN CONTENT ###### |
| 63 | 63 | // this call the main page content |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @since 1.1.0 |
| 82 | 82 | */ |
| 83 | 83 | do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
|
| 84 | - if (defined( 'GD_TESTING_MODE' )) {
|
|
| 84 | + if (defined('GD_TESTING_MODE')) {
|
|
| 85 | 85 | global $post; |
| 86 | 86 | } |
| 87 | 87 | /** This action is documented in geodirectory-templates/listing-detail.php */ |
@@ -3441,7 +3441,7 @@ discard block |
||
| 3441 | 3441 | * @global object $wpdb WordPress Database object. |
| 3442 | 3442 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 3443 | 3443 | * @param int $post_id The post ID. |
| 3444 | - * @return mixed Returns video. |
|
| 3444 | + * @return string Returns video. |
|
| 3445 | 3445 | */ |
| 3446 | 3446 | function geodir_get_video($post_id) |
| 3447 | 3447 | {
|
@@ -3467,7 +3467,7 @@ discard block |
||
| 3467 | 3467 | * @global object $wpdb WordPress Database object. |
| 3468 | 3468 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 3469 | 3469 | * @param int $post_id The post ID. |
| 3470 | - * @return mixed Returns special offers. |
|
| 3470 | + * @return string Returns special offers. |
|
| 3471 | 3471 | */ |
| 3472 | 3472 | function geodir_get_special_offers($post_id) |
| 3473 | 3473 | {
|
@@ -3491,7 +3491,7 @@ discard block |
||
| 3491 | 3491 | * |
| 3492 | 3492 | * @since 1.0.0 |
| 3493 | 3493 | * @package GeoDirectory |
| 3494 | - * @return mixed|void Returns max upload file size. |
|
| 3494 | + * @return string|null Returns max upload file size. |
|
| 3495 | 3495 | */ |
| 3496 | 3496 | function geodir_max_upload_size() |
| 3497 | 3497 | {
|
@@ -10,52 +10,52 @@ discard block |
||
| 10 | 10 | global $wpdb, $table_prefix; |
| 11 | 11 | |
| 12 | 12 | if (!function_exists('geodir_column_exist')) {
|
| 13 | - /** |
|
| 14 | - * Check table column exist or not. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - * @global object $wpdb WordPress Database object. |
|
| 19 | - * @param string $db The table name. |
|
| 20 | - * @param string $column The column name. |
|
| 21 | - * @return bool If column exists returns true. Otherwise false. |
|
| 22 | - */ |
|
| 23 | - function geodir_column_exist($db, $column) |
|
| 24 | - {
|
|
| 25 | - global $wpdb; |
|
| 26 | - $exists = false; |
|
| 27 | - $columns = $wpdb->get_col("show columns from $db");
|
|
| 28 | - foreach ($columns as $c) {
|
|
| 29 | - if ($c == $column) {
|
|
| 30 | - $exists = true; |
|
| 31 | - break; |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - return $exists; |
|
| 35 | - } |
|
| 13 | + /** |
|
| 14 | + * Check table column exist or not. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + * @global object $wpdb WordPress Database object. |
|
| 19 | + * @param string $db The table name. |
|
| 20 | + * @param string $column The column name. |
|
| 21 | + * @return bool If column exists returns true. Otherwise false. |
|
| 22 | + */ |
|
| 23 | + function geodir_column_exist($db, $column) |
|
| 24 | + {
|
|
| 25 | + global $wpdb; |
|
| 26 | + $exists = false; |
|
| 27 | + $columns = $wpdb->get_col("show columns from $db");
|
|
| 28 | + foreach ($columns as $c) {
|
|
| 29 | + if ($c == $column) {
|
|
| 30 | + $exists = true; |
|
| 31 | + break; |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + return $exists; |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (!function_exists('geodir_add_column_if_not_exist')) {
|
| 39 | - /** |
|
| 40 | - * Add column if table column not exist. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - * @package GeoDirectory |
|
| 44 | - * @global object $wpdb WordPress Database object. |
|
| 45 | - * @param string $db The table name. |
|
| 46 | - * @param string $column The column name. |
|
| 47 | - * @param string $column_attr The column attributes. |
|
| 48 | - */ |
|
| 49 | - function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
| 50 | - {
|
|
| 51 | - global $wpdb; |
|
| 52 | - $result = 0;// no rows affected |
|
| 53 | - if (!geodir_column_exist($db, $column)) {
|
|
| 54 | - if (!empty($db) && !empty($column)) |
|
| 55 | - $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 56 | - } |
|
| 57 | - return $result; |
|
| 58 | - } |
|
| 39 | + /** |
|
| 40 | + * Add column if table column not exist. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + * @package GeoDirectory |
|
| 44 | + * @global object $wpdb WordPress Database object. |
|
| 45 | + * @param string $db The table name. |
|
| 46 | + * @param string $column The column name. |
|
| 47 | + * @param string $column_attr The column attributes. |
|
| 48 | + */ |
|
| 49 | + function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
| 50 | + {
|
|
| 51 | + global $wpdb; |
|
| 52 | + $result = 0;// no rows affected |
|
| 53 | + if (!geodir_column_exist($db, $column)) {
|
|
| 54 | + if (!empty($db) && !empty($column)) |
|
| 55 | + $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 56 | + } |
|
| 57 | + return $result; |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -72,701 +72,701 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none') |
| 74 | 74 | {
|
| 75 | - global $wpdb, $geodir_post_custom_fields_cache; |
|
| 76 | - |
|
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 78 | - |
|
| 79 | - if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
|
| 80 | - return $geodir_post_custom_fields_cache[$cache_stored]; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - $default_query = ''; |
|
| 84 | - |
|
| 85 | - if ($default == 'default') |
|
| 86 | - $default_query = " and is_default IN ('1') ";
|
|
| 87 | - elseif ($default == 'custom') |
|
| 88 | - $default_query = " and is_default = '0' "; |
|
| 89 | - |
|
| 90 | - if ($fields_location == 'detail') {
|
|
| 91 | - $default_query = " and show_on_detail='1' "; |
|
| 92 | - } elseif ($fields_location == 'listing') {
|
|
| 93 | - $default_query = " and show_on_listing='1' "; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $post_meta_info = $wpdb->get_results( |
|
| 97 | - $wpdb->prepare( |
|
| 98 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | - array($post_type) |
|
| 100 | - ) |
|
| 101 | - ); |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - $return_arr = array(); |
|
| 105 | - if ($post_meta_info) {
|
|
| 106 | - |
|
| 107 | - foreach ($post_meta_info as $post_meta_info_obj) {
|
|
| 108 | - |
|
| 109 | - $custom_fields = array( |
|
| 110 | - "name" => $post_meta_info_obj->htmlvar_name, |
|
| 111 | - "label" => $post_meta_info_obj->clabels, |
|
| 112 | - "default" => $post_meta_info_obj->default_value, |
|
| 113 | - "type" => $post_meta_info_obj->field_type, |
|
| 114 | - "desc" => $post_meta_info_obj->admin_desc); |
|
| 115 | - |
|
| 116 | - if ($post_meta_info_obj->field_type) {
|
|
| 117 | - $options = explode(',', $post_meta_info_obj->option_values);
|
|
| 118 | - $custom_fields["options"] = $options; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - foreach ($post_meta_info_obj as $key => $val) {
|
|
| 122 | - $custom_fields[$key] = $val; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - $pricearr = array(); |
|
| 126 | - $pricearr = explode(',', $post_meta_info_obj->packages);
|
|
| 127 | - |
|
| 128 | - if ($package_id != '' && in_array($package_id, $pricearr)) {
|
|
| 129 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 130 | - } elseif ($package_id == '') {
|
|
| 131 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - $geodir_post_custom_fields_cache[$cache_stored] = $return_arr; |
|
| 136 | - |
|
| 137 | - if (has_filter('geodir_filter_geodir_post_custom_fields')) {
|
|
| 138 | - /** |
|
| 139 | - * Filter the post custom fields array. |
|
| 140 | - * |
|
| 141 | - * @since 1.0.0 |
|
| 142 | - * |
|
| 143 | - * @param array $return_arr Post custom fields array. |
|
| 144 | - * @param int|string $package_id The package ID. |
|
| 145 | - * @param string $post_type Optional. The wordpress post type. |
|
| 146 | - * @param string $fields_location Optional. Where exactly are you going to place this custom fields?. |
|
| 147 | - */ |
|
| 148 | - $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
|
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - return $return_arr; |
|
| 75 | + global $wpdb, $geodir_post_custom_fields_cache; |
|
| 76 | + |
|
| 77 | + $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 78 | + |
|
| 79 | + if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
|
| 80 | + return $geodir_post_custom_fields_cache[$cache_stored]; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + $default_query = ''; |
|
| 84 | + |
|
| 85 | + if ($default == 'default') |
|
| 86 | + $default_query = " and is_default IN ('1') ";
|
|
| 87 | + elseif ($default == 'custom') |
|
| 88 | + $default_query = " and is_default = '0' "; |
|
| 89 | + |
|
| 90 | + if ($fields_location == 'detail') {
|
|
| 91 | + $default_query = " and show_on_detail='1' "; |
|
| 92 | + } elseif ($fields_location == 'listing') {
|
|
| 93 | + $default_query = " and show_on_listing='1' "; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $post_meta_info = $wpdb->get_results( |
|
| 97 | + $wpdb->prepare( |
|
| 98 | + "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | + array($post_type) |
|
| 100 | + ) |
|
| 101 | + ); |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + $return_arr = array(); |
|
| 105 | + if ($post_meta_info) {
|
|
| 106 | + |
|
| 107 | + foreach ($post_meta_info as $post_meta_info_obj) {
|
|
| 108 | + |
|
| 109 | + $custom_fields = array( |
|
| 110 | + "name" => $post_meta_info_obj->htmlvar_name, |
|
| 111 | + "label" => $post_meta_info_obj->clabels, |
|
| 112 | + "default" => $post_meta_info_obj->default_value, |
|
| 113 | + "type" => $post_meta_info_obj->field_type, |
|
| 114 | + "desc" => $post_meta_info_obj->admin_desc); |
|
| 115 | + |
|
| 116 | + if ($post_meta_info_obj->field_type) {
|
|
| 117 | + $options = explode(',', $post_meta_info_obj->option_values);
|
|
| 118 | + $custom_fields["options"] = $options; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + foreach ($post_meta_info_obj as $key => $val) {
|
|
| 122 | + $custom_fields[$key] = $val; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + $pricearr = array(); |
|
| 126 | + $pricearr = explode(',', $post_meta_info_obj->packages);
|
|
| 127 | + |
|
| 128 | + if ($package_id != '' && in_array($package_id, $pricearr)) {
|
|
| 129 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 130 | + } elseif ($package_id == '') {
|
|
| 131 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + $geodir_post_custom_fields_cache[$cache_stored] = $return_arr; |
|
| 136 | + |
|
| 137 | + if (has_filter('geodir_filter_geodir_post_custom_fields')) {
|
|
| 138 | + /** |
|
| 139 | + * Filter the post custom fields array. |
|
| 140 | + * |
|
| 141 | + * @since 1.0.0 |
|
| 142 | + * |
|
| 143 | + * @param array $return_arr Post custom fields array. |
|
| 144 | + * @param int|string $package_id The package ID. |
|
| 145 | + * @param string $post_type Optional. The wordpress post type. |
|
| 146 | + * @param string $fields_location Optional. Where exactly are you going to place this custom fields?. |
|
| 147 | + */ |
|
| 148 | + $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
|
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + return $return_arr; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if (!function_exists('geodir_custom_field_adminhtml')) {
|
| 155 | - /** |
|
| 156 | - * Adds admin html for custom fields. |
|
| 157 | - * |
|
| 158 | - * @since 1.0.0 |
|
| 159 | - * @package GeoDirectory |
|
| 160 | - * @global object $wpdb WordPress Database object. |
|
| 161 | - * @param string $field_type The form field type. |
|
| 162 | - * @param object|int $result_str The custom field results object or row id. |
|
| 163 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 164 | - * @param bool $default when set to true field will be for admin use only. |
|
| 165 | - */ |
|
| 166 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
| 167 | - {
|
|
| 168 | - global $wpdb; |
|
| 169 | - $cf = $result_str; |
|
| 170 | - if (!is_object($cf)) {
|
|
| 171 | - |
|
| 172 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 173 | - |
|
| 174 | - } else {
|
|
| 175 | - $field_info = $cf; |
|
| 176 | - $result_str = $cf->id; |
|
| 177 | - } |
|
| 178 | - /** |
|
| 179 | - * Contains custom field html. |
|
| 180 | - * |
|
| 181 | - * @since 1.0.0 |
|
| 182 | - */ |
|
| 183 | - include('custom_field_html.php');
|
|
| 184 | - |
|
| 185 | - } |
|
| 155 | + /** |
|
| 156 | + * Adds admin html for custom fields. |
|
| 157 | + * |
|
| 158 | + * @since 1.0.0 |
|
| 159 | + * @package GeoDirectory |
|
| 160 | + * @global object $wpdb WordPress Database object. |
|
| 161 | + * @param string $field_type The form field type. |
|
| 162 | + * @param object|int $result_str The custom field results object or row id. |
|
| 163 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 164 | + * @param bool $default when set to true field will be for admin use only. |
|
| 165 | + */ |
|
| 166 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
| 167 | + {
|
|
| 168 | + global $wpdb; |
|
| 169 | + $cf = $result_str; |
|
| 170 | + if (!is_object($cf)) {
|
|
| 171 | + |
|
| 172 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 173 | + |
|
| 174 | + } else {
|
|
| 175 | + $field_info = $cf; |
|
| 176 | + $result_str = $cf->id; |
|
| 177 | + } |
|
| 178 | + /** |
|
| 179 | + * Contains custom field html. |
|
| 180 | + * |
|
| 181 | + * @since 1.0.0 |
|
| 182 | + */ |
|
| 183 | + include('custom_field_html.php');
|
|
| 184 | + |
|
| 185 | + } |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if (!function_exists('geodir_custom_field_delete')) {
|
| 189 | - /** |
|
| 190 | - * Delete custom field using field id. |
|
| 191 | - * |
|
| 192 | - * @since 1.0.0 |
|
| 193 | - * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
| 194 | - * @package GeoDirectory |
|
| 195 | - * @global object $wpdb WordPress Database object. |
|
| 196 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 197 | - * @param string $field_id The custom field ID. |
|
| 198 | - * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
| 199 | - */ |
|
| 200 | - function geodir_custom_field_delete($field_id = '') {
|
|
| 201 | - global $wpdb, $plugin_prefix; |
|
| 202 | - |
|
| 203 | - if ($field_id != '') {
|
|
| 204 | - $cf = trim($field_id, '_'); |
|
| 205 | - |
|
| 206 | - if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 207 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 208 | - |
|
| 209 | - $post_type = $field->post_type; |
|
| 210 | - $htmlvar_name = $field->htmlvar_name; |
|
| 211 | - |
|
| 212 | - if ($post_type != '' && $htmlvar_name != '') {
|
|
| 213 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * Called after a custom field is deleted. |
|
| 218 | - * |
|
| 219 | - * @since 1.0.0 |
|
| 220 | - * @param string $cf The fields ID. |
|
| 221 | - * @param string $field->htmlvar_name The html variable name for the field. |
|
| 222 | - * @param string $post_type The post type the field belongs to. |
|
| 223 | - */ |
|
| 224 | - do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
|
| 225 | - |
|
| 226 | - if ($field->field_type == 'address') {
|
|
| 227 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 228 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 229 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 230 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 231 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 232 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 233 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 234 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 235 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 236 | - } else {
|
|
| 237 | - if ($field->field_type != 'fieldset') {
|
|
| 238 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 239 | - } |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - return $field_id; |
|
| 243 | - } else |
|
| 244 | - return 0; |
|
| 245 | - } else |
|
| 246 | - return 0; |
|
| 247 | - } |
|
| 189 | + /** |
|
| 190 | + * Delete custom field using field id. |
|
| 191 | + * |
|
| 192 | + * @since 1.0.0 |
|
| 193 | + * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
| 194 | + * @package GeoDirectory |
|
| 195 | + * @global object $wpdb WordPress Database object. |
|
| 196 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 197 | + * @param string $field_id The custom field ID. |
|
| 198 | + * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
| 199 | + */ |
|
| 200 | + function geodir_custom_field_delete($field_id = '') {
|
|
| 201 | + global $wpdb, $plugin_prefix; |
|
| 202 | + |
|
| 203 | + if ($field_id != '') {
|
|
| 204 | + $cf = trim($field_id, '_'); |
|
| 205 | + |
|
| 206 | + if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 207 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 208 | + |
|
| 209 | + $post_type = $field->post_type; |
|
| 210 | + $htmlvar_name = $field->htmlvar_name; |
|
| 211 | + |
|
| 212 | + if ($post_type != '' && $htmlvar_name != '') {
|
|
| 213 | + $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * Called after a custom field is deleted. |
|
| 218 | + * |
|
| 219 | + * @since 1.0.0 |
|
| 220 | + * @param string $cf The fields ID. |
|
| 221 | + * @param string $field->htmlvar_name The html variable name for the field. |
|
| 222 | + * @param string $post_type The post type the field belongs to. |
|
| 223 | + */ |
|
| 224 | + do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
|
| 225 | + |
|
| 226 | + if ($field->field_type == 'address') {
|
|
| 227 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 228 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 229 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 230 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 231 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 232 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 233 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 234 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 235 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 236 | + } else {
|
|
| 237 | + if ($field->field_type != 'fieldset') {
|
|
| 238 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + return $field_id; |
|
| 243 | + } else |
|
| 244 | + return 0; |
|
| 245 | + } else |
|
| 246 | + return 0; |
|
| 247 | + } |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (!function_exists('geodir_custom_field_save')) {
|
| 251 | - /** |
|
| 252 | - * Save or Update custom fields into the database. |
|
| 253 | - * |
|
| 254 | - * @since 1.0.0 |
|
| 255 | - * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
|
| 256 | - * @package GeoDirectory |
|
| 257 | - * @global object $wpdb WordPress Database object. |
|
| 258 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 259 | - * @param array $request_field {
|
|
| 260 | - * Attributes of the request field array. |
|
| 261 | - * |
|
| 262 | - * @type string $action Ajax Action name. Default "geodir_ajax_action". |
|
| 263 | - * @type string $manage_field_type Field type Default "custom_fields". |
|
| 264 | - * @type string $create_field Create field Default "true". |
|
| 265 | - * @type string $field_ins_upd Field ins upd Default "submit". |
|
| 266 | - * @type string $_wpnonce WP nonce value. |
|
| 267 | - * @type string $listing_type Listing type Example "gd_place". |
|
| 268 | - * @type string $field_type Field type Example "radio". |
|
| 269 | - * @type string $field_id Field id Example "12". |
|
| 270 | - * @type string $data_type Data type Example "VARCHAR". |
|
| 271 | - * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere. |
|
| 272 | - * @type array $show_on_pkg Package list to display this field. |
|
| 273 | - * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings. |
|
| 274 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 275 | - * @type string $admin_desc Section description which will appear in frontend. |
|
| 276 | - * @type string $htmlvar_name Html variable name. This should be a unique name. |
|
| 277 | - * @type string $clabels Section Title which will appear in backend. |
|
| 278 | - * @type string $default_value The default value (for "link" this will be used as the link text). |
|
| 279 | - * @type string $sort_order The display order of this field in backend. e.g. 5. |
|
| 280 | - * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field. |
|
| 281 | - * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field. |
|
| 282 | - * @type string $is_required Use "1" to set field as required. |
|
| 283 | - * @type string $required_msg Enter text for error message if field required and have not full fill requirment. |
|
| 284 | - * @type string $show_on_listing Want to show this on listing page?. |
|
| 285 | - * @type string $show_on_detail Want to show this in More Info tab on detail page?. |
|
| 286 | - * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes. |
|
| 287 | - * @type string $option_values Option Values should be separated by comma. |
|
| 288 | - * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class. |
|
| 289 | - * @type string $css_class Enter custom css class for field custom style. |
|
| 290 | - * |
|
| 291 | - * } |
|
| 292 | - * @param bool $default Not yet implemented. |
|
| 293 | - * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
| 294 | - */ |
|
| 295 | - function geodir_custom_field_save($request_field = array(), $default = false) |
|
| 296 | - {
|
|
| 297 | - |
|
| 298 | - global $wpdb, $plugin_prefix; |
|
| 299 | - |
|
| 300 | - $old_html_variable = ''; |
|
| 301 | - |
|
| 302 | - $data_type = trim($request_field['data_type']); |
|
| 303 | - |
|
| 304 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 305 | - |
|
| 306 | - // some servers fail if a POST value is VARCHAR so we change it. |
|
| 307 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 308 | - $request_field['data_type'] = 'VARCHAR'; |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - $cf = trim($result_str, '_'); |
|
| 312 | - |
|
| 313 | - |
|
| 314 | - /*-------- check dublicate validation --------*/ |
|
| 315 | - |
|
| 316 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 317 | - $post_type = $request_field['listing_type']; |
|
| 318 | - |
|
| 319 | - if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
|
| 320 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - $check_html_variable = $wpdb->get_var( |
|
| 324 | - $wpdb->prepare( |
|
| 325 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | - array($cf, $cehhtmlvar_name, $post_type) |
|
| 327 | - ) |
|
| 328 | - ); |
|
| 329 | - |
|
| 330 | - |
|
| 331 | - if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
|
|
| 332 | - |
|
| 333 | - if ($cf != '') {
|
|
| 334 | - |
|
| 335 | - $post_meta_info = $wpdb->get_row( |
|
| 336 | - $wpdb->prepare( |
|
| 337 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 338 | - array($cf) |
|
| 339 | - ) |
|
| 340 | - ); |
|
| 341 | - |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - if (!empty($post_meta_info)) {
|
|
| 345 | - $post_val = $post_meta_info; |
|
| 346 | - $old_html_variable = $post_val->htmlvar_name; |
|
| 347 | - |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - |
|
| 351 | - |
|
| 352 | - if ($post_type == '') $post_type = 'gd_place'; |
|
| 251 | + /** |
|
| 252 | + * Save or Update custom fields into the database. |
|
| 253 | + * |
|
| 254 | + * @since 1.0.0 |
|
| 255 | + * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
|
| 256 | + * @package GeoDirectory |
|
| 257 | + * @global object $wpdb WordPress Database object. |
|
| 258 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 259 | + * @param array $request_field {
|
|
| 260 | + * Attributes of the request field array. |
|
| 261 | + * |
|
| 262 | + * @type string $action Ajax Action name. Default "geodir_ajax_action". |
|
| 263 | + * @type string $manage_field_type Field type Default "custom_fields". |
|
| 264 | + * @type string $create_field Create field Default "true". |
|
| 265 | + * @type string $field_ins_upd Field ins upd Default "submit". |
|
| 266 | + * @type string $_wpnonce WP nonce value. |
|
| 267 | + * @type string $listing_type Listing type Example "gd_place". |
|
| 268 | + * @type string $field_type Field type Example "radio". |
|
| 269 | + * @type string $field_id Field id Example "12". |
|
| 270 | + * @type string $data_type Data type Example "VARCHAR". |
|
| 271 | + * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere. |
|
| 272 | + * @type array $show_on_pkg Package list to display this field. |
|
| 273 | + * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings. |
|
| 274 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 275 | + * @type string $admin_desc Section description which will appear in frontend. |
|
| 276 | + * @type string $htmlvar_name Html variable name. This should be a unique name. |
|
| 277 | + * @type string $clabels Section Title which will appear in backend. |
|
| 278 | + * @type string $default_value The default value (for "link" this will be used as the link text). |
|
| 279 | + * @type string $sort_order The display order of this field in backend. e.g. 5. |
|
| 280 | + * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field. |
|
| 281 | + * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field. |
|
| 282 | + * @type string $is_required Use "1" to set field as required. |
|
| 283 | + * @type string $required_msg Enter text for error message if field required and have not full fill requirment. |
|
| 284 | + * @type string $show_on_listing Want to show this on listing page?. |
|
| 285 | + * @type string $show_on_detail Want to show this in More Info tab on detail page?. |
|
| 286 | + * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes. |
|
| 287 | + * @type string $option_values Option Values should be separated by comma. |
|
| 288 | + * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class. |
|
| 289 | + * @type string $css_class Enter custom css class for field custom style. |
|
| 290 | + * |
|
| 291 | + * } |
|
| 292 | + * @param bool $default Not yet implemented. |
|
| 293 | + * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
| 294 | + */ |
|
| 295 | + function geodir_custom_field_save($request_field = array(), $default = false) |
|
| 296 | + {
|
|
| 297 | + |
|
| 298 | + global $wpdb, $plugin_prefix; |
|
| 299 | + |
|
| 300 | + $old_html_variable = ''; |
|
| 301 | + |
|
| 302 | + $data_type = trim($request_field['data_type']); |
|
| 303 | + |
|
| 304 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 305 | + |
|
| 306 | + // some servers fail if a POST value is VARCHAR so we change it. |
|
| 307 | + if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 308 | + $request_field['data_type'] = 'VARCHAR'; |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + $cf = trim($result_str, '_'); |
|
| 312 | + |
|
| 313 | + |
|
| 314 | + /*-------- check dublicate validation --------*/ |
|
| 315 | + |
|
| 316 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 317 | + $post_type = $request_field['listing_type']; |
|
| 318 | + |
|
| 319 | + if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
|
| 320 | + $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + $check_html_variable = $wpdb->get_var( |
|
| 324 | + $wpdb->prepare( |
|
| 325 | + "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | + array($cf, $cehhtmlvar_name, $post_type) |
|
| 327 | + ) |
|
| 328 | + ); |
|
| 329 | + |
|
| 330 | + |
|
| 331 | + if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
|
|
| 332 | + |
|
| 333 | + if ($cf != '') {
|
|
| 334 | + |
|
| 335 | + $post_meta_info = $wpdb->get_row( |
|
| 336 | + $wpdb->prepare( |
|
| 337 | + "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 338 | + array($cf) |
|
| 339 | + ) |
|
| 340 | + ); |
|
| 341 | + |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + if (!empty($post_meta_info)) {
|
|
| 345 | + $post_val = $post_meta_info; |
|
| 346 | + $old_html_variable = $post_val->htmlvar_name; |
|
| 347 | + |
|
| 348 | + } |
|
| 349 | + |
|
| 350 | + |
|
| 351 | + |
|
| 352 | + if ($post_type == '') $post_type = 'gd_place'; |
|
| 353 | 353 | |
| 354 | 354 | |
| 355 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 355 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 356 | 356 | |
| 357 | - $admin_title = $request_field['admin_title']; |
|
| 358 | - $site_title = $request_field['site_title']; |
|
| 359 | - $data_type = $request_field['data_type']; |
|
| 360 | - $field_type = $request_field['field_type']; |
|
| 361 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 362 | - $admin_desc = $request_field['admin_desc']; |
|
| 363 | - $clabels = $request_field['clabels']; |
|
| 364 | - $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : ''; |
|
| 365 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : ''; |
|
| 366 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : ''; |
|
| 367 | - $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : ''; |
|
| 368 | - $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : ''; |
|
| 369 | - $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : ''; |
|
| 370 | - $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : ''; |
|
| 371 | - $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : ''; |
|
| 372 | - $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : ''; |
|
| 373 | - $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : ''; |
|
| 374 | - $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type |
|
| 375 | - $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : ''; |
|
| 376 | - $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : ''; |
|
| 377 | - $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : ''; |
|
| 378 | - $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
|
| 357 | + $admin_title = $request_field['admin_title']; |
|
| 358 | + $site_title = $request_field['site_title']; |
|
| 359 | + $data_type = $request_field['data_type']; |
|
| 360 | + $field_type = $request_field['field_type']; |
|
| 361 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 362 | + $admin_desc = $request_field['admin_desc']; |
|
| 363 | + $clabels = $request_field['clabels']; |
|
| 364 | + $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : ''; |
|
| 365 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : ''; |
|
| 366 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : ''; |
|
| 367 | + $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : ''; |
|
| 368 | + $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : ''; |
|
| 369 | + $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : ''; |
|
| 370 | + $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : ''; |
|
| 371 | + $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : ''; |
|
| 372 | + $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : ''; |
|
| 373 | + $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : ''; |
|
| 374 | + $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type |
|
| 375 | + $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : ''; |
|
| 376 | + $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : ''; |
|
| 377 | + $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : ''; |
|
| 378 | + $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
|
| 379 | 379 | |
| 380 | - if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
|
| 381 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 382 | - } |
|
| 380 | + if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
|
| 381 | + $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | - $option_values = ''; |
|
| 385 | - if (isset($request_field['option_values'])) |
|
| 386 | - $option_values = $request_field['option_values']; |
|
| 384 | + $option_values = ''; |
|
| 385 | + if (isset($request_field['option_values'])) |
|
| 386 | + $option_values = $request_field['option_values']; |
|
| 387 | 387 | |
| 388 | - $cat_sort = ''; |
|
| 389 | - if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) |
|
| 390 | - $cat_sort = implode(",", $request_field['cat_sort']);
|
|
| 388 | + $cat_sort = ''; |
|
| 389 | + if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) |
|
| 390 | + $cat_sort = implode(",", $request_field['cat_sort']);
|
|
| 391 | 391 | |
| 392 | - $cat_filter = ''; |
|
| 393 | - if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) |
|
| 394 | - $cat_filter = implode(",", $request_field['cat_filter']);
|
|
| 392 | + $cat_filter = ''; |
|
| 393 | + if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) |
|
| 394 | + $cat_filter = implode(",", $request_field['cat_filter']);
|
|
| 395 | 395 | |
| 396 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 397 | - $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 398 | - else {
|
|
| 399 | - $package_info = array(); |
|
| 396 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 397 | + $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 398 | + else {
|
|
| 399 | + $package_info = array(); |
|
| 400 | 400 | |
| 401 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 402 | - $price_pkg = $package_info->pid; |
|
| 403 | - } |
|
| 401 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 402 | + $price_pkg = $package_info->pid; |
|
| 403 | + } |
|
| 404 | 404 | |
| 405 | 405 | |
| 406 | - if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 407 | - $extra_fields = $request_field['extra']; |
|
| 406 | + if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 407 | + $extra_fields = $request_field['extra']; |
|
| 408 | 408 | |
| 409 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 410 | - $is_default = $request_field['is_default']; |
|
| 411 | - else |
|
| 412 | - $is_default = '0'; |
|
| 409 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 410 | + $is_default = $request_field['is_default']; |
|
| 411 | + else |
|
| 412 | + $is_default = '0'; |
|
| 413 | 413 | |
| 414 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 415 | - $is_admin = $request_field['is_admin']; |
|
| 416 | - else |
|
| 417 | - $is_admin = '0'; |
|
| 414 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 415 | + $is_admin = $request_field['is_admin']; |
|
| 416 | + else |
|
| 417 | + $is_admin = '0'; |
|
| 418 | 418 | |
| 419 | 419 | |
| 420 | - if ($is_active == '') $is_active = 1; |
|
| 421 | - if ($is_required == '') $is_required = 0; |
|
| 420 | + if ($is_active == '') $is_active = 1; |
|
| 421 | + if ($is_required == '') $is_required = 0; |
|
| 422 | 422 | |
| 423 | 423 | |
| 424 | - if ($sort_order == '') {
|
|
| 424 | + if ($sort_order == '') {
|
|
| 425 | 425 | |
| 426 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 426 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 427 | 427 | |
| 428 | - $sort_order = (int)$last_order + 1; |
|
| 429 | - } |
|
| 428 | + $sort_order = (int)$last_order + 1; |
|
| 429 | + } |
|
| 430 | 430 | |
| 431 | - $default_value_add = ''; |
|
| 431 | + $default_value_add = ''; |
|
| 432 | 432 | |
| 433 | - if (!empty($post_meta_info)) {
|
|
| 434 | - switch ($field_type): |
|
| 433 | + if (!empty($post_meta_info)) {
|
|
| 434 | + switch ($field_type): |
|
| 435 | 435 | |
| 436 | - case 'address': |
|
| 436 | + case 'address': |
|
| 437 | 437 | |
| 438 | - if ($htmlvar_name != '') {
|
|
| 439 | - $prefix = $htmlvar_name . '_'; |
|
| 440 | - } |
|
| 441 | - $old_prefix = $old_html_variable . '_'; |
|
| 438 | + if ($htmlvar_name != '') {
|
|
| 439 | + $prefix = $htmlvar_name . '_'; |
|
| 440 | + } |
|
| 441 | + $old_prefix = $old_html_variable . '_'; |
|
| 442 | 442 | |
| 443 | 443 | |
| 444 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 444 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 445 | 445 | |
| 446 | - if ($default_value != '') {
|
|
| 447 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 448 | - } |
|
| 446 | + if ($default_value != '') {
|
|
| 447 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 448 | + } |
|
| 449 | 449 | |
| 450 | - $wpdb->query($meta_field_add); |
|
| 450 | + $wpdb->query($meta_field_add); |
|
| 451 | 451 | |
| 452 | - if ($extra_fields != '') {
|
|
| 452 | + if ($extra_fields != '') {
|
|
| 453 | 453 | |
| 454 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 454 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 455 | 455 | |
| 456 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 457 | - if ($is_column) {
|
|
| 458 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 456 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 457 | + if ($is_column) {
|
|
| 458 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 459 | 459 | |
| 460 | - if ($default_value != '') {
|
|
| 461 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 462 | - } |
|
| 460 | + if ($default_value != '') {
|
|
| 461 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 462 | + } |
|
| 463 | 463 | |
| 464 | - $wpdb->query($meta_field_add); |
|
| 465 | - } else {
|
|
| 464 | + $wpdb->query($meta_field_add); |
|
| 465 | + } else {
|
|
| 466 | 466 | |
| 467 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 468 | - if ($default_value != '') {
|
|
| 469 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 470 | - } |
|
| 471 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 467 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 468 | + if ($default_value != '') {
|
|
| 469 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 470 | + } |
|
| 471 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 472 | 472 | |
| 473 | - } |
|
| 473 | + } |
|
| 474 | 474 | |
| 475 | 475 | |
| 476 | - } |
|
| 476 | + } |
|
| 477 | 477 | |
| 478 | 478 | |
| 479 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 479 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 480 | 480 | |
| 481 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 481 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 482 | 482 | |
| 483 | - if ($is_column) {
|
|
| 484 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 483 | + if ($is_column) {
|
|
| 484 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 485 | 485 | |
| 486 | - if ($default_value != '') {
|
|
| 487 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 488 | - } |
|
| 486 | + if ($default_value != '') {
|
|
| 487 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 488 | + } |
|
| 489 | 489 | |
| 490 | - $wpdb->query($meta_field_add); |
|
| 491 | - } else {
|
|
| 492 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 493 | - if ($default_value != '') {
|
|
| 494 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 495 | - } |
|
| 490 | + $wpdb->query($meta_field_add); |
|
| 491 | + } else {
|
|
| 492 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 493 | + if ($default_value != '') {
|
|
| 494 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 495 | + } |
|
| 496 | 496 | |
| 497 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 498 | - } |
|
| 497 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 498 | + } |
|
| 499 | 499 | |
| 500 | - } |
|
| 501 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 500 | + } |
|
| 501 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 502 | 502 | |
| 503 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 503 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 504 | 504 | |
| 505 | - if ($is_column) {
|
|
| 505 | + if ($is_column) {
|
|
| 506 | 506 | |
| 507 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 507 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 508 | 508 | |
| 509 | - if ($default_value != '') {
|
|
| 510 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 511 | - } |
|
| 509 | + if ($default_value != '') {
|
|
| 510 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 511 | + } |
|
| 512 | 512 | |
| 513 | - $wpdb->query($meta_field_add); |
|
| 514 | - } else {
|
|
| 513 | + $wpdb->query($meta_field_add); |
|
| 514 | + } else {
|
|
| 515 | 515 | |
| 516 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 517 | - if ($default_value != '') {
|
|
| 518 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 519 | - } |
|
| 516 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 517 | + if ($default_value != '') {
|
|
| 518 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 519 | + } |
|
| 520 | 520 | |
| 521 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 521 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 522 | 522 | |
| 523 | - } |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | - } |
|
| 526 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 525 | + } |
|
| 526 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 527 | + |
|
| 528 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 529 | + |
|
| 530 | + if ($is_column) {
|
|
| 527 | 531 | |
| 528 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 532 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 533 | + |
|
| 534 | + if ($default_value != '') {
|
|
| 535 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 536 | + } |
|
| 529 | 537 | |
| 530 | - if ($is_column) {
|
|
| 538 | + $wpdb->query($meta_field_add); |
|
| 539 | + } else {
|
|
| 531 | 540 | |
| 532 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 541 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 542 | + if ($default_value != '') {
|
|
| 543 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 544 | + } |
|
| 533 | 545 | |
| 534 | - if ($default_value != '') {
|
|
| 535 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 536 | - } |
|
| 546 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 537 | 547 | |
| 538 | - $wpdb->query($meta_field_add); |
|
| 539 | - } else {
|
|
| 548 | + } |
|
| 540 | 549 | |
| 541 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 542 | - if ($default_value != '') {
|
|
| 543 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 544 | - } |
|
| 550 | + } |
|
| 551 | + if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 545 | 552 | |
| 546 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 553 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 554 | + if ($is_column) {
|
|
| 547 | 555 | |
| 548 | - } |
|
| 556 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 549 | 557 | |
| 550 | - } |
|
| 551 | - if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 558 | + if ($default_value != '') {
|
|
| 559 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 560 | + } |
|
| 552 | 561 | |
| 553 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 554 | - if ($is_column) {
|
|
| 562 | + $wpdb->query($meta_field_add); |
|
| 563 | + } else {
|
|
| 555 | 564 | |
| 556 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 565 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 566 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 567 | + if ($default_value != '') {
|
|
| 568 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 569 | + } |
|
| 557 | 570 | |
| 558 | - if ($default_value != '') {
|
|
| 559 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 560 | - } |
|
| 571 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 561 | 572 | |
| 562 | - $wpdb->query($meta_field_add); |
|
| 563 | - } else {
|
|
| 573 | + } |
|
| 564 | 574 | |
| 565 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 566 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 567 | - if ($default_value != '') {
|
|
| 568 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 569 | - } |
|
| 570 | 575 | |
| 571 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 576 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 572 | 577 | |
| 573 | - } |
|
| 578 | + if ($is_column) {
|
|
| 579 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 574 | 580 | |
| 581 | + if ($default_value != '') {
|
|
| 582 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 583 | + } |
|
| 575 | 584 | |
| 576 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 585 | + $wpdb->query($meta_field_add); |
|
| 586 | + } else {
|
|
| 577 | 587 | |
| 578 | - if ($is_column) {
|
|
| 579 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 588 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 589 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 590 | + if ($default_value != '') {
|
|
| 591 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 592 | + } |
|
| 580 | 593 | |
| 581 | - if ($default_value != '') {
|
|
| 582 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 583 | - } |
|
| 594 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 595 | + } |
|
| 584 | 596 | |
| 585 | - $wpdb->query($meta_field_add); |
|
| 586 | - } else {
|
|
| 597 | + } |
|
| 598 | + if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 587 | 599 | |
| 588 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 589 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 590 | - if ($default_value != '') {
|
|
| 591 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 592 | - } |
|
| 600 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 593 | 601 | |
| 594 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 595 | - } |
|
| 602 | + if ($is_column) {
|
|
| 603 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 596 | 604 | |
| 597 | - } |
|
| 598 | - if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 605 | + if ($default_value != '') {
|
|
| 606 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 607 | + } |
|
| 599 | 608 | |
| 600 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 609 | + $wpdb->query($meta_field_add); |
|
| 610 | + } else {
|
|
| 601 | 611 | |
| 602 | - if ($is_column) {
|
|
| 603 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 612 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 604 | 613 | |
| 605 | - if ($default_value != '') {
|
|
| 606 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 607 | - } |
|
| 614 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 615 | + if ($default_value != '') {
|
|
| 616 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 617 | + } |
|
| 608 | 618 | |
| 609 | - $wpdb->query($meta_field_add); |
|
| 610 | - } else {
|
|
| 619 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 620 | + } |
|
| 611 | 621 | |
| 612 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 613 | 622 | |
| 614 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 615 | - if ($default_value != '') {
|
|
| 616 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 617 | - } |
|
| 623 | + } |
|
| 624 | + if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 618 | 625 | |
| 619 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 620 | - } |
|
| 626 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 627 | + if ($is_column) {
|
|
| 628 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 621 | 629 | |
| 630 | + if ($default_value != '') {
|
|
| 631 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 632 | + } |
|
| 622 | 633 | |
| 623 | - } |
|
| 624 | - if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 634 | + $wpdb->query($meta_field_add); |
|
| 625 | 635 | |
| 626 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 627 | - if ($is_column) {
|
|
| 628 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 636 | + } else {
|
|
| 629 | 637 | |
| 630 | - if ($default_value != '') {
|
|
| 631 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 632 | - } |
|
| 638 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 633 | 639 | |
| 634 | - $wpdb->query($meta_field_add); |
|
| 640 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 641 | + if ($default_value != '') {
|
|
| 642 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 643 | + } |
|
| 635 | 644 | |
| 636 | - } else {
|
|
| 645 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 646 | + } |
|
| 637 | 647 | |
| 638 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 648 | + } |
|
| 649 | + // show lat lng |
|
| 650 | + if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 651 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 639 | 652 | |
| 640 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 641 | - if ($default_value != '') {
|
|
| 642 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 643 | - } |
|
| 653 | + if ($is_column) {
|
|
| 654 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 655 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 644 | 656 | |
| 645 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 646 | - } |
|
| 657 | + $wpdb->query($meta_field_add); |
|
| 658 | + } else {
|
|
| 659 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 647 | 660 | |
| 648 | - } |
|
| 649 | - // show lat lng |
|
| 650 | - if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 651 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 661 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 662 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 652 | 663 | |
| 653 | - if ($is_column) {
|
|
| 654 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 655 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 664 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 665 | + } |
|
| 656 | 666 | |
| 657 | - $wpdb->query($meta_field_add); |
|
| 658 | - } else {
|
|
| 659 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 667 | + } |
|
| 668 | + }// end extra |
|
| 660 | 669 | |
| 661 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 662 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 670 | + break; |
|
| 663 | 671 | |
| 664 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 665 | - } |
|
| 672 | + case 'checkbox': |
|
| 673 | + case 'multiselect': |
|
| 674 | + case 'select': |
|
| 675 | + case 'taxonomy': |
|
| 666 | 676 | |
| 667 | - } |
|
| 668 | - }// end extra |
|
| 677 | + $op_size = '500'; |
|
| 669 | 678 | |
| 670 | - break; |
|
| 679 | + // only make the field as big as it needs to be. |
|
| 680 | + if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 681 | + $option_values_arr = explode(',',$option_values);
|
|
| 682 | + if(is_array($option_values_arr)){
|
|
| 683 | + $op_max = 0; |
|
| 684 | + foreach($option_values_arr as $op_val){
|
|
| 685 | + if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 686 | + } |
|
| 687 | + if($op_max){$op_size =$op_max; }
|
|
| 688 | + } |
|
| 689 | + }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 690 | + if(strlen($option_values)){
|
|
| 691 | + $op_size = strlen($option_values); |
|
| 692 | + } |
|
| 693 | + } |
|
| 671 | 694 | |
| 672 | - case 'checkbox': |
|
| 673 | - case 'multiselect': |
|
| 674 | - case 'select': |
|
| 675 | - case 'taxonomy': |
|
| 695 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 676 | 696 | |
| 677 | - $op_size = '500'; |
|
| 697 | + if ($default_value != '') {
|
|
| 698 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 699 | + } |
|
| 678 | 700 | |
| 679 | - // only make the field as big as it needs to be. |
|
| 680 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 681 | - $option_values_arr = explode(',',$option_values);
|
|
| 682 | - if(is_array($option_values_arr)){
|
|
| 683 | - $op_max = 0; |
|
| 684 | - foreach($option_values_arr as $op_val){
|
|
| 685 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 686 | - } |
|
| 687 | - if($op_max){$op_size =$op_max; }
|
|
| 688 | - } |
|
| 689 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 690 | - if(strlen($option_values)){
|
|
| 691 | - $op_size = strlen($option_values); |
|
| 692 | - } |
|
| 693 | - } |
|
| 701 | + $alter_result = $wpdb->query($meta_field_add); |
|
| 702 | + if($alter_result===false){
|
|
| 703 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 704 | + } |
|
| 694 | 705 | |
| 695 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 706 | + if (isset($request_field['cat_display_type'])) |
|
| 707 | + $extra_fields = $request_field['cat_display_type']; |
|
| 696 | 708 | |
| 697 | - if ($default_value != '') {
|
|
| 698 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 699 | - } |
|
| 709 | + if (isset($request_field['multi_display_type'])) |
|
| 710 | + $extra_fields = $request_field['multi_display_type']; |
|
| 700 | 711 | |
| 701 | - $alter_result = $wpdb->query($meta_field_add); |
|
| 702 | - if($alter_result===false){
|
|
| 703 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 704 | - } |
|
| 705 | 712 | |
| 706 | - if (isset($request_field['cat_display_type'])) |
|
| 707 | - $extra_fields = $request_field['cat_display_type']; |
|
| 713 | + break; |
|
| 708 | 714 | |
| 709 | - if (isset($request_field['multi_display_type'])) |
|
| 710 | - $extra_fields = $request_field['multi_display_type']; |
|
| 715 | + case 'textarea': |
|
| 716 | + case 'html': |
|
| 717 | + case 'url': |
|
| 718 | + case 'file': |
|
| 711 | 719 | |
| 720 | + $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 721 | + if($alter_result===false){
|
|
| 722 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 723 | + } |
|
| 724 | + if (isset($request_field['advanced_editor'])) |
|
| 725 | + $extra_fields = $request_field['advanced_editor']; |
|
| 712 | 726 | |
| 713 | - break; |
|
| 727 | + break; |
|
| 714 | 728 | |
| 715 | - case 'textarea': |
|
| 716 | - case 'html': |
|
| 717 | - case 'url': |
|
| 718 | - case 'file': |
|
| 729 | + case 'fieldset': |
|
| 730 | + // Nothig happend for fieldset |
|
| 731 | + break; |
|
| 719 | 732 | |
| 720 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 721 | - if($alter_result===false){
|
|
| 722 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 723 | - } |
|
| 724 | - if (isset($request_field['advanced_editor'])) |
|
| 725 | - $extra_fields = $request_field['advanced_editor']; |
|
| 726 | - |
|
| 727 | - break; |
|
| 733 | + default: |
|
| 734 | + if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 735 | + if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 736 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 737 | + } else {
|
|
| 738 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 739 | + } |
|
| 728 | 740 | |
| 729 | - case 'fieldset': |
|
| 730 | - // Nothig happend for fieldset |
|
| 731 | - break; |
|
| 741 | + if (is_numeric($default_value) && $default_value != '') {
|
|
| 742 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 743 | + } |
|
| 744 | + } else {
|
|
| 745 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 746 | + if ($default_value != '') {
|
|
| 747 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 748 | + } |
|
| 749 | + } |
|
| 732 | 750 | |
| 733 | - default: |
|
| 734 | - if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 735 | - if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 736 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 737 | - } else {
|
|
| 738 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 739 | - } |
|
| 740 | - |
|
| 741 | - if (is_numeric($default_value) && $default_value != '') {
|
|
| 742 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 743 | - } |
|
| 744 | - } else {
|
|
| 745 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 746 | - if ($default_value != '') {
|
|
| 747 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 748 | - } |
|
| 749 | - } |
|
| 750 | - |
|
| 751 | - $alter_result = $wpdb->query($default_value_add); |
|
| 752 | - if($alter_result===false){
|
|
| 753 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 754 | - } |
|
| 755 | - break; |
|
| 756 | - endswitch; |
|
| 757 | - |
|
| 758 | - $extra_field_query = ''; |
|
| 759 | - if (!empty($extra_fields)) {
|
|
| 760 | - $extra_field_query = serialize($extra_fields); |
|
| 761 | - } |
|
| 762 | - |
|
| 763 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 764 | - |
|
| 765 | - $wpdb->query( |
|
| 766 | - |
|
| 767 | - $wpdb->prepare( |
|
| 768 | - |
|
| 769 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 751 | + $alter_result = $wpdb->query($default_value_add); |
|
| 752 | + if($alter_result===false){
|
|
| 753 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 754 | + } |
|
| 755 | + break; |
|
| 756 | + endswitch; |
|
| 757 | + |
|
| 758 | + $extra_field_query = ''; |
|
| 759 | + if (!empty($extra_fields)) {
|
|
| 760 | + $extra_field_query = serialize($extra_fields); |
|
| 761 | + } |
|
| 762 | + |
|
| 763 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 764 | + |
|
| 765 | + $wpdb->query( |
|
| 766 | + |
|
| 767 | + $wpdb->prepare( |
|
| 768 | + |
|
| 769 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 770 | 770 | post_type = %s, |
| 771 | 771 | admin_title = %s, |
| 772 | 772 | site_title = %s, |
@@ -798,308 +798,308 @@ discard block |
||
| 798 | 798 | for_admin_use = %s |
| 799 | 799 | where id = %d", |
| 800 | 800 | |
| 801 | - array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 802 | - ) |
|
| 801 | + array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 802 | + ) |
|
| 803 | 803 | |
| 804 | - ); |
|
| 804 | + ); |
|
| 805 | 805 | |
| 806 | - $lastid = trim($cf); |
|
| 806 | + $lastid = trim($cf); |
|
| 807 | 807 | |
| 808 | 808 | |
| 809 | - $wpdb->query( |
|
| 810 | - $wpdb->prepare( |
|
| 811 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 809 | + $wpdb->query( |
|
| 810 | + $wpdb->prepare( |
|
| 811 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 812 | 812 | site_title=%s |
| 813 | 813 | where post_type = %s and htmlvar_name = %s", |
| 814 | - array($site_title, $post_type, $htmlvar_name) |
|
| 815 | - ) |
|
| 816 | - ); |
|
| 817 | - |
|
| 818 | - |
|
| 819 | - if ($cat_sort == '') |
|
| 820 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 821 | - |
|
| 822 | - |
|
| 823 | - /** |
|
| 824 | - * Called after all custom fields are saved for a post. |
|
| 825 | - * |
|
| 826 | - * @since 1.0.0 |
|
| 827 | - * @param int $lastid The post ID. |
|
| 828 | - */ |
|
| 829 | - do_action('geodir_after_custom_fields_updated', $lastid);
|
|
| 830 | - |
|
| 831 | - } else {
|
|
| 832 | - |
|
| 833 | - switch ($field_type): |
|
| 834 | - |
|
| 835 | - case 'address': |
|
| 836 | - |
|
| 837 | - $data_type = ''; |
|
| 838 | - |
|
| 839 | - if ($htmlvar_name != '') {
|
|
| 840 | - $prefix = $htmlvar_name . '_'; |
|
| 841 | - } |
|
| 842 | - $old_prefix = $old_html_variable; |
|
| 843 | - |
|
| 844 | - //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 845 | - |
|
| 846 | - $meta_field_add = "VARCHAR( 254 ) NULL"; |
|
| 847 | - if ($default_value != '') {
|
|
| 848 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 849 | - } |
|
| 850 | - |
|
| 851 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 852 | - //$wpdb->query($meta_field_add); |
|
| 853 | - |
|
| 854 | - |
|
| 855 | - if (!empty($extra_fields)) {
|
|
| 814 | + array($site_title, $post_type, $htmlvar_name) |
|
| 815 | + ) |
|
| 816 | + ); |
|
| 817 | + |
|
| 818 | + |
|
| 819 | + if ($cat_sort == '') |
|
| 820 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 821 | + |
|
| 822 | + |
|
| 823 | + /** |
|
| 824 | + * Called after all custom fields are saved for a post. |
|
| 825 | + * |
|
| 826 | + * @since 1.0.0 |
|
| 827 | + * @param int $lastid The post ID. |
|
| 828 | + */ |
|
| 829 | + do_action('geodir_after_custom_fields_updated', $lastid);
|
|
| 830 | + |
|
| 831 | + } else {
|
|
| 832 | + |
|
| 833 | + switch ($field_type): |
|
| 834 | + |
|
| 835 | + case 'address': |
|
| 836 | + |
|
| 837 | + $data_type = ''; |
|
| 838 | + |
|
| 839 | + if ($htmlvar_name != '') {
|
|
| 840 | + $prefix = $htmlvar_name . '_'; |
|
| 841 | + } |
|
| 842 | + $old_prefix = $old_html_variable; |
|
| 843 | + |
|
| 844 | + //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 845 | + |
|
| 846 | + $meta_field_add = "VARCHAR( 254 ) NULL"; |
|
| 847 | + if ($default_value != '') {
|
|
| 848 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 849 | + } |
|
| 850 | + |
|
| 851 | + geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 852 | + //$wpdb->query($meta_field_add); |
|
| 853 | + |
|
| 854 | + |
|
| 855 | + if (!empty($extra_fields)) {
|
|
| 856 | + |
|
| 857 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 858 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 859 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 860 | + if ($default_value != '') {
|
|
| 861 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 862 | + } |
|
| 863 | + |
|
| 864 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 865 | + //$wpdb->query($meta_field_add); |
|
| 866 | + } |
|
| 867 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 868 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 869 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 870 | + if ($default_value != '') {
|
|
| 871 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 872 | + } |
|
| 873 | + |
|
| 874 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 875 | + //$wpdb->query($meta_field_add); |
|
| 876 | + } |
|
| 877 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 878 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 879 | + |
|
| 880 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 881 | + if ($default_value != '') {
|
|
| 882 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 883 | + } |
|
| 884 | + |
|
| 885 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 886 | + //$wpdb->query($meta_field_add); |
|
| 887 | + } |
|
| 888 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 889 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 890 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 891 | + if ($default_value != '') {
|
|
| 892 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 893 | + } |
|
| 894 | + |
|
| 895 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 896 | + //$wpdb->query($meta_field_add); |
|
| 897 | + } |
|
| 898 | + if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 899 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 900 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 901 | + if ($default_value != '') {
|
|
| 902 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 903 | + } |
|
| 904 | + |
|
| 905 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 906 | + //$wpdb->query($meta_field_add); |
|
| 907 | + |
|
| 908 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 909 | + |
|
| 910 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 911 | + if ($default_value != '') {
|
|
| 912 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 913 | + } |
|
| 914 | + |
|
| 915 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 916 | + |
|
| 917 | + //$wpdb->query($meta_field_add); |
|
| 918 | + } |
|
| 919 | + if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 920 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 856 | 921 | |
| 857 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 858 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 859 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 860 | - if ($default_value != '') {
|
|
| 861 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 862 | - } |
|
| 863 | - |
|
| 864 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 865 | - //$wpdb->query($meta_field_add); |
|
| 866 | - } |
|
| 867 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 868 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 869 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 870 | - if ($default_value != '') {
|
|
| 871 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 872 | - } |
|
| 873 | - |
|
| 874 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 875 | - //$wpdb->query($meta_field_add); |
|
| 876 | - } |
|
| 877 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 878 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 879 | - |
|
| 880 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 881 | - if ($default_value != '') {
|
|
| 882 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 883 | - } |
|
| 884 | - |
|
| 885 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 886 | - //$wpdb->query($meta_field_add); |
|
| 887 | - } |
|
| 888 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 889 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 890 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 891 | - if ($default_value != '') {
|
|
| 892 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 893 | - } |
|
| 894 | - |
|
| 895 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 896 | - //$wpdb->query($meta_field_add); |
|
| 897 | - } |
|
| 898 | - if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 899 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 900 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 901 | - if ($default_value != '') {
|
|
| 902 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 903 | - } |
|
| 904 | - |
|
| 905 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 906 | - //$wpdb->query($meta_field_add); |
|
| 907 | - |
|
| 908 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 909 | - |
|
| 910 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 911 | - if ($default_value != '') {
|
|
| 912 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 913 | - } |
|
| 914 | - |
|
| 915 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 916 | - |
|
| 917 | - //$wpdb->query($meta_field_add); |
|
| 918 | - } |
|
| 919 | - if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 920 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 921 | - |
|
| 922 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 923 | - if ($default_value != '') {
|
|
| 924 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 925 | - } |
|
| 926 | - |
|
| 927 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 928 | - |
|
| 929 | - //$wpdb->query($meta_field_add); |
|
| 930 | - } |
|
| 931 | - if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 932 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 933 | - |
|
| 934 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 935 | - if ($default_value != '') {
|
|
| 936 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 937 | - } |
|
| 938 | - |
|
| 939 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 940 | - |
|
| 941 | - //$wpdb->query($meta_field_add); |
|
| 942 | - } |
|
| 943 | - // show lat lng |
|
| 944 | - if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 945 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 946 | - |
|
| 947 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 948 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 949 | - |
|
| 950 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 951 | - //$wpdb->query($meta_field_add); |
|
| 952 | - } |
|
| 953 | - } |
|
| 954 | - |
|
| 955 | - break; |
|
| 956 | - |
|
| 957 | - case 'checkbox': |
|
| 958 | - $data_type = 'TINYINT'; |
|
| 959 | - |
|
| 960 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 961 | - if ((int)$default_value === 1) {
|
|
| 962 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 963 | - } |
|
| 964 | - |
|
| 965 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 966 | - if ($add_result === false) {
|
|
| 967 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 968 | - } |
|
| 969 | - break; |
|
| 970 | - case 'multiselect': |
|
| 971 | - case 'select': |
|
| 972 | - $data_type = 'VARCHAR'; |
|
| 973 | - $op_size = '500'; |
|
| 974 | - |
|
| 975 | - // only make the field as big as it needs to be. |
|
| 976 | - if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 977 | - $option_values_arr = explode(',', $option_values);
|
|
| 978 | - |
|
| 979 | - if (is_array($option_values_arr)) {
|
|
| 980 | - $op_max = 0; |
|
| 981 | - |
|
| 982 | - foreach ($option_values_arr as $op_val) {
|
|
| 983 | - if (strlen($op_val) && strlen($op_val) > $op_max) {
|
|
| 984 | - $op_max = strlen($op_val); |
|
| 985 | - } |
|
| 986 | - } |
|
| 987 | - |
|
| 988 | - if ($op_max) {
|
|
| 989 | - $op_size = $op_max; |
|
| 990 | - } |
|
| 991 | - } |
|
| 992 | - } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 993 | - if (strlen($option_values)) {
|
|
| 994 | - $op_size = strlen($option_values); |
|
| 995 | - } |
|
| 996 | - |
|
| 997 | - if (isset($request_field['multi_display_type'])) {
|
|
| 998 | - $extra_fields = $request_field['multi_display_type']; |
|
| 999 | - } |
|
| 1000 | - } |
|
| 1001 | - |
|
| 1002 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1003 | - if ($default_value != '') {
|
|
| 1004 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1005 | - } |
|
| 1006 | - |
|
| 1007 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1008 | - if ($add_result === false) {
|
|
| 1009 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1010 | - } |
|
| 1011 | - break; |
|
| 1012 | - case 'textarea': |
|
| 1013 | - case 'html': |
|
| 1014 | - case 'url': |
|
| 1015 | - case 'file': |
|
| 1016 | - |
|
| 1017 | - $data_type = 'TEXT'; |
|
| 1018 | - |
|
| 1019 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1020 | - |
|
| 1021 | - $meta_field_add = $data_type . " NULL "; |
|
| 1022 | - /*if($default_value != '') |
|
| 922 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 923 | + if ($default_value != '') {
|
|
| 924 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 925 | + } |
|
| 926 | + |
|
| 927 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 928 | + |
|
| 929 | + //$wpdb->query($meta_field_add); |
|
| 930 | + } |
|
| 931 | + if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 932 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 933 | + |
|
| 934 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 935 | + if ($default_value != '') {
|
|
| 936 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 937 | + } |
|
| 938 | + |
|
| 939 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 940 | + |
|
| 941 | + //$wpdb->query($meta_field_add); |
|
| 942 | + } |
|
| 943 | + // show lat lng |
|
| 944 | + if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 945 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 946 | + |
|
| 947 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 948 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 949 | + |
|
| 950 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 951 | + //$wpdb->query($meta_field_add); |
|
| 952 | + } |
|
| 953 | + } |
|
| 954 | + |
|
| 955 | + break; |
|
| 956 | + |
|
| 957 | + case 'checkbox': |
|
| 958 | + $data_type = 'TINYINT'; |
|
| 959 | + |
|
| 960 | + $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 961 | + if ((int)$default_value === 1) {
|
|
| 962 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 963 | + } |
|
| 964 | + |
|
| 965 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 966 | + if ($add_result === false) {
|
|
| 967 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 968 | + } |
|
| 969 | + break; |
|
| 970 | + case 'multiselect': |
|
| 971 | + case 'select': |
|
| 972 | + $data_type = 'VARCHAR'; |
|
| 973 | + $op_size = '500'; |
|
| 974 | + |
|
| 975 | + // only make the field as big as it needs to be. |
|
| 976 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 977 | + $option_values_arr = explode(',', $option_values);
|
|
| 978 | + |
|
| 979 | + if (is_array($option_values_arr)) {
|
|
| 980 | + $op_max = 0; |
|
| 981 | + |
|
| 982 | + foreach ($option_values_arr as $op_val) {
|
|
| 983 | + if (strlen($op_val) && strlen($op_val) > $op_max) {
|
|
| 984 | + $op_max = strlen($op_val); |
|
| 985 | + } |
|
| 986 | + } |
|
| 987 | + |
|
| 988 | + if ($op_max) {
|
|
| 989 | + $op_size = $op_max; |
|
| 990 | + } |
|
| 991 | + } |
|
| 992 | + } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 993 | + if (strlen($option_values)) {
|
|
| 994 | + $op_size = strlen($option_values); |
|
| 995 | + } |
|
| 996 | + |
|
| 997 | + if (isset($request_field['multi_display_type'])) {
|
|
| 998 | + $extra_fields = $request_field['multi_display_type']; |
|
| 999 | + } |
|
| 1000 | + } |
|
| 1001 | + |
|
| 1002 | + $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1003 | + if ($default_value != '') {
|
|
| 1004 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1005 | + } |
|
| 1006 | + |
|
| 1007 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1008 | + if ($add_result === false) {
|
|
| 1009 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1010 | + } |
|
| 1011 | + break; |
|
| 1012 | + case 'textarea': |
|
| 1013 | + case 'html': |
|
| 1014 | + case 'url': |
|
| 1015 | + case 'file': |
|
| 1016 | + |
|
| 1017 | + $data_type = 'TEXT'; |
|
| 1018 | + |
|
| 1019 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1020 | + |
|
| 1021 | + $meta_field_add = $data_type . " NULL "; |
|
| 1022 | + /*if($default_value != '') |
|
| 1023 | 1023 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1024 | 1024 | |
| 1025 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1026 | - if ($add_result === false) {
|
|
| 1027 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1028 | - } |
|
| 1025 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1026 | + if ($add_result === false) {
|
|
| 1027 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1028 | + } |
|
| 1029 | 1029 | |
| 1030 | - break; |
|
| 1030 | + break; |
|
| 1031 | 1031 | |
| 1032 | - case 'datepicker': |
|
| 1032 | + case 'datepicker': |
|
| 1033 | 1033 | |
| 1034 | - $data_type = 'DATE'; |
|
| 1034 | + $data_type = 'DATE'; |
|
| 1035 | 1035 | |
| 1036 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1036 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1037 | 1037 | |
| 1038 | - $meta_field_add = $data_type . " NULL "; |
|
| 1038 | + $meta_field_add = $data_type . " NULL "; |
|
| 1039 | 1039 | |
| 1040 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1041 | - if ($add_result === false) {
|
|
| 1042 | - return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
|
|
| 1043 | - } |
|
| 1040 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1041 | + if ($add_result === false) {
|
|
| 1042 | + return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
|
|
| 1043 | + } |
|
| 1044 | 1044 | |
| 1045 | - break; |
|
| 1045 | + break; |
|
| 1046 | 1046 | |
| 1047 | - case 'time': |
|
| 1047 | + case 'time': |
|
| 1048 | 1048 | |
| 1049 | - $data_type = 'TIME'; |
|
| 1049 | + $data_type = 'TIME'; |
|
| 1050 | 1050 | |
| 1051 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1051 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1052 | 1052 | |
| 1053 | - $meta_field_add = $data_type . " NULL "; |
|
| 1053 | + $meta_field_add = $data_type . " NULL "; |
|
| 1054 | 1054 | |
| 1055 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1056 | - if ($add_result === false) {
|
|
| 1057 | - return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
|
|
| 1058 | - } |
|
| 1055 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1056 | + if ($add_result === false) {
|
|
| 1057 | + return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
|
|
| 1058 | + } |
|
| 1059 | 1059 | |
| 1060 | - break; |
|
| 1060 | + break; |
|
| 1061 | 1061 | |
| 1062 | - default: |
|
| 1062 | + default: |
|
| 1063 | 1063 | |
| 1064 | - if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 1065 | - $meta_field_add = $data_type . " NULL "; |
|
| 1064 | + if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 1065 | + $meta_field_add = $data_type . " NULL "; |
|
| 1066 | 1066 | |
| 1067 | - if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 1068 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1069 | - } |
|
| 1067 | + if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 1068 | + $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1069 | + } |
|
| 1070 | 1070 | |
| 1071 | - if (is_numeric($default_value) && $default_value != '') {
|
|
| 1072 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1073 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1074 | - } |
|
| 1075 | - } else {
|
|
| 1076 | - $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
| 1071 | + if (is_numeric($default_value) && $default_value != '') {
|
|
| 1072 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1073 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1074 | + } |
|
| 1075 | + } else {
|
|
| 1076 | + $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
| 1077 | 1077 | |
| 1078 | - if ($default_value != '') {
|
|
| 1079 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1081 | - } |
|
| 1082 | - } |
|
| 1078 | + if ($default_value != '') {
|
|
| 1079 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1081 | + } |
|
| 1082 | + } |
|
| 1083 | 1083 | |
| 1084 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1085 | - if ($add_result === false) {
|
|
| 1086 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1087 | - } |
|
| 1088 | - break; |
|
| 1089 | - endswitch; |
|
| 1084 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1085 | + if ($add_result === false) {
|
|
| 1086 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1087 | + } |
|
| 1088 | + break; |
|
| 1089 | + endswitch; |
|
| 1090 | 1090 | |
| 1091 | - $extra_field_query = ''; |
|
| 1092 | - if (!empty($extra_fields)) {
|
|
| 1093 | - $extra_field_query = serialize($extra_fields); |
|
| 1094 | - } |
|
| 1091 | + $extra_field_query = ''; |
|
| 1092 | + if (!empty($extra_fields)) {
|
|
| 1093 | + $extra_field_query = serialize($extra_fields); |
|
| 1094 | + } |
|
| 1095 | 1095 | |
| 1096 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 1096 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 1097 | 1097 | |
| 1098 | - $wpdb->query( |
|
| 1098 | + $wpdb->query( |
|
| 1099 | 1099 | |
| 1100 | - $wpdb->prepare( |
|
| 1100 | + $wpdb->prepare( |
|
| 1101 | 1101 | |
| 1102 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1102 | + "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1103 | 1103 | post_type = %s, |
| 1104 | 1104 | admin_title = %s, |
| 1105 | 1105 | site_title = %s, |
@@ -1130,26 +1130,26 @@ discard block |
||
| 1130 | 1130 | validation_msg = %s, |
| 1131 | 1131 | for_admin_use = %s ", |
| 1132 | 1132 | |
| 1133 | - array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1133 | + array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1134 | 1134 | |
| 1135 | - ) |
|
| 1135 | + ) |
|
| 1136 | 1136 | |
| 1137 | - ); |
|
| 1137 | + ); |
|
| 1138 | 1138 | |
| 1139 | - $lastid = $wpdb->insert_id; |
|
| 1139 | + $lastid = $wpdb->insert_id; |
|
| 1140 | 1140 | |
| 1141 | - $lastid = trim($lastid); |
|
| 1141 | + $lastid = trim($lastid); |
|
| 1142 | 1142 | |
| 1143 | - } |
|
| 1143 | + } |
|
| 1144 | 1144 | |
| 1145 | - return (int)$lastid; |
|
| 1145 | + return (int)$lastid; |
|
| 1146 | 1146 | |
| 1147 | 1147 | |
| 1148 | - } else {
|
|
| 1149 | - return 'HTML Variable Name should be a unique name'; |
|
| 1150 | - } |
|
| 1148 | + } else {
|
|
| 1149 | + return 'HTML Variable Name should be a unique name'; |
|
| 1150 | + } |
|
| 1151 | 1151 | |
| 1152 | - } |
|
| 1152 | + } |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | /** |
@@ -1164,30 +1164,30 @@ discard block |
||
| 1164 | 1164 | function godir_set_field_order($field_ids = array()) |
| 1165 | 1165 | {
|
| 1166 | 1166 | |
| 1167 | - global $wpdb; |
|
| 1167 | + global $wpdb; |
|
| 1168 | 1168 | |
| 1169 | - $count = 0; |
|
| 1170 | - if (!empty($field_ids)): |
|
| 1171 | - $post_meta_info = false; |
|
| 1172 | - foreach ($field_ids as $id) {
|
|
| 1169 | + $count = 0; |
|
| 1170 | + if (!empty($field_ids)): |
|
| 1171 | + $post_meta_info = false; |
|
| 1172 | + foreach ($field_ids as $id) {
|
|
| 1173 | 1173 | |
| 1174 | - $cf = trim($id, '_'); |
|
| 1174 | + $cf = trim($id, '_'); |
|
| 1175 | 1175 | |
| 1176 | - $post_meta_info = $wpdb->query( |
|
| 1177 | - $wpdb->prepare( |
|
| 1178 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1176 | + $post_meta_info = $wpdb->query( |
|
| 1177 | + $wpdb->prepare( |
|
| 1178 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1179 | 1179 | sort_order=%d |
| 1180 | 1180 | where id= %d", |
| 1181 | - array($count, $cf) |
|
| 1182 | - ) |
|
| 1183 | - ); |
|
| 1184 | - $count++; |
|
| 1185 | - } |
|
| 1186 | - |
|
| 1187 | - return $post_meta_info; |
|
| 1188 | - else: |
|
| 1189 | - return false; |
|
| 1190 | - endif; |
|
| 1181 | + array($count, $cf) |
|
| 1182 | + ) |
|
| 1183 | + ); |
|
| 1184 | + $count++; |
|
| 1185 | + } |
|
| 1186 | + |
|
| 1187 | + return $post_meta_info; |
|
| 1188 | + else: |
|
| 1189 | + return false; |
|
| 1190 | + endif; |
|
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | 1193 | |
@@ -1207,140 +1207,140 @@ discard block |
||
| 1207 | 1207 | * @param string $post_type Optional. The wordpress post type. |
| 1208 | 1208 | */ |
| 1209 | 1209 | function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
|
| 1210 | - global $is_default, $mapzoom, $gd_session; |
|
| 1211 | - |
|
| 1212 | - $show_editors = array(); |
|
| 1213 | - $listing_type = $post_type; |
|
| 1214 | - |
|
| 1215 | - $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
|
| 1216 | - |
|
| 1217 | - $fieldset_id = ''; |
|
| 1218 | - $fieldset_field_class = 'gd-fieldset-details'; |
|
| 1219 | - foreach ($custom_fields as $key => $val) {
|
|
| 1220 | - $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1221 | - $name = $val['name']; |
|
| 1222 | - $site_title = $val['site_title']; |
|
| 1223 | - $type = $val['type']; |
|
| 1224 | - $admin_desc = $val['desc']; |
|
| 1225 | - $option_values = $val['option_values']; |
|
| 1226 | - $is_required = $val['is_required']; |
|
| 1227 | - $is_default = $val['is_default']; |
|
| 1228 | - $is_admin = $val['is_admin']; |
|
| 1229 | - $required_msg = $val['required_msg']; |
|
| 1230 | - $extra_fields = unserialize($val['extra_fields']); |
|
| 1231 | - $value = ''; |
|
| 1232 | - |
|
| 1233 | - /* field available to site admin only for edit */ |
|
| 1234 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1235 | - if ($for_admin_use && !is_super_admin()) {
|
|
| 1236 | - continue; |
|
| 1237 | - } |
|
| 1238 | - |
|
| 1239 | - if (is_admin()) {
|
|
| 1240 | - global $post; |
|
| 1241 | - |
|
| 1242 | - if (isset($_REQUEST['post'])) |
|
| 1243 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1244 | - } |
|
| 1245 | - |
|
| 1246 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1247 | - $post = $gd_ses_listing; |
|
| 1248 | - $value = isset($post[$name]) ? $post[$name] : ''; |
|
| 1249 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 1250 | - $value = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1251 | - } else {
|
|
| 1252 | - if ($value == '') {
|
|
| 1253 | - $value = $val['default']; |
|
| 1254 | - } |
|
| 1255 | - } |
|
| 1256 | - |
|
| 1257 | - /** |
|
| 1258 | - * Called before the custom fields info is output for submitting a post. |
|
| 1259 | - * |
|
| 1260 | - * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1261 | - * |
|
| 1262 | - * @since 1.0.0 |
|
| 1263 | - * @param string $listing_type The post post type. |
|
| 1264 | - * @param int $package_id The price package ID for the post. |
|
| 1265 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1266 | - * @see 'geodir_after_custom_form_field_$name' |
|
| 1267 | - */ |
|
| 1268 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1269 | - |
|
| 1270 | - if ($type == 'fieldset') {
|
|
| 1271 | - $fieldset_id = (int)$val['id']; |
|
| 1272 | - $fieldset_field_class = 'gd-fieldset-' . $fieldset_id; |
|
| 1273 | - ?> |
|
| 1210 | + global $is_default, $mapzoom, $gd_session; |
|
| 1211 | + |
|
| 1212 | + $show_editors = array(); |
|
| 1213 | + $listing_type = $post_type; |
|
| 1214 | + |
|
| 1215 | + $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
|
| 1216 | + |
|
| 1217 | + $fieldset_id = ''; |
|
| 1218 | + $fieldset_field_class = 'gd-fieldset-details'; |
|
| 1219 | + foreach ($custom_fields as $key => $val) {
|
|
| 1220 | + $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1221 | + $name = $val['name']; |
|
| 1222 | + $site_title = $val['site_title']; |
|
| 1223 | + $type = $val['type']; |
|
| 1224 | + $admin_desc = $val['desc']; |
|
| 1225 | + $option_values = $val['option_values']; |
|
| 1226 | + $is_required = $val['is_required']; |
|
| 1227 | + $is_default = $val['is_default']; |
|
| 1228 | + $is_admin = $val['is_admin']; |
|
| 1229 | + $required_msg = $val['required_msg']; |
|
| 1230 | + $extra_fields = unserialize($val['extra_fields']); |
|
| 1231 | + $value = ''; |
|
| 1232 | + |
|
| 1233 | + /* field available to site admin only for edit */ |
|
| 1234 | + $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1235 | + if ($for_admin_use && !is_super_admin()) {
|
|
| 1236 | + continue; |
|
| 1237 | + } |
|
| 1238 | + |
|
| 1239 | + if (is_admin()) {
|
|
| 1240 | + global $post; |
|
| 1241 | + |
|
| 1242 | + if (isset($_REQUEST['post'])) |
|
| 1243 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1244 | + } |
|
| 1245 | + |
|
| 1246 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1247 | + $post = $gd_ses_listing; |
|
| 1248 | + $value = isset($post[$name]) ? $post[$name] : ''; |
|
| 1249 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 1250 | + $value = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1251 | + } else {
|
|
| 1252 | + if ($value == '') {
|
|
| 1253 | + $value = $val['default']; |
|
| 1254 | + } |
|
| 1255 | + } |
|
| 1256 | + |
|
| 1257 | + /** |
|
| 1258 | + * Called before the custom fields info is output for submitting a post. |
|
| 1259 | + * |
|
| 1260 | + * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1261 | + * |
|
| 1262 | + * @since 1.0.0 |
|
| 1263 | + * @param string $listing_type The post post type. |
|
| 1264 | + * @param int $package_id The price package ID for the post. |
|
| 1265 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1266 | + * @see 'geodir_after_custom_form_field_$name' |
|
| 1267 | + */ |
|
| 1268 | + do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1269 | + |
|
| 1270 | + if ($type == 'fieldset') {
|
|
| 1271 | + $fieldset_id = (int)$val['id']; |
|
| 1272 | + $fieldset_field_class = 'gd-fieldset-' . $fieldset_id; |
|
| 1273 | + ?> |
|
| 1274 | 1274 | <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?> |
| 1275 | 1275 | <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5> |
| 1276 | 1276 | <?php |
| 1277 | - } else if ($type == 'address') {
|
|
| 1278 | - $prefix = $name . '_'; |
|
| 1279 | - |
|
| 1280 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 1281 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 1282 | - ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
|
|
| 1283 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 1284 | - |
|
| 1285 | - $address = ''; |
|
| 1286 | - $zip = ''; |
|
| 1287 | - $mapview = ''; |
|
| 1288 | - $mapzoom = ''; |
|
| 1289 | - $lat = ''; |
|
| 1290 | - $lng = ''; |
|
| 1291 | - |
|
| 1292 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1293 | - $post = $gd_ses_listing; |
|
| 1294 | - $address = $post[$prefix . 'address']; |
|
| 1295 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1296 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1297 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1298 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1299 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1300 | - } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
|
|
| 1301 | - $post_info = (array)$post_info; |
|
| 1302 | - |
|
| 1303 | - $address = $post_info[$prefix . 'address']; |
|
| 1304 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1305 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1306 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1307 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1308 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1309 | - } |
|
| 1310 | - |
|
| 1311 | - $location = geodir_get_default_location(); |
|
| 1312 | - if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1313 | - if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1314 | - if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1315 | - |
|
| 1316 | - $lat_lng_blank = false; |
|
| 1317 | - if (empty($lat) && empty($lng)) {
|
|
| 1318 | - $lat_lng_blank = true; |
|
| 1319 | - } |
|
| 1320 | - |
|
| 1321 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1322 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1323 | - |
|
| 1324 | - /** |
|
| 1325 | - * Filter the default latitude. |
|
| 1326 | - * |
|
| 1327 | - * @since 1.0.0 |
|
| 1328 | - * |
|
| 1329 | - * @param float $lat Default latitude. |
|
| 1330 | - * @param bool $is_admin For admin use only?. |
|
| 1331 | - */ |
|
| 1332 | - $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
|
|
| 1333 | - /** |
|
| 1334 | - * Filter the default longitude. |
|
| 1335 | - * |
|
| 1336 | - * @since 1.0.0 |
|
| 1337 | - * |
|
| 1338 | - * @param float $lat Default longitude. |
|
| 1339 | - * @param bool $is_admin For admin use only?. |
|
| 1340 | - */ |
|
| 1341 | - $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
|
|
| 1342 | - |
|
| 1343 | - ?> |
|
| 1277 | + } else if ($type == 'address') {
|
|
| 1278 | + $prefix = $name . '_'; |
|
| 1279 | + |
|
| 1280 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 1281 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 1282 | + ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
|
|
| 1283 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 1284 | + |
|
| 1285 | + $address = ''; |
|
| 1286 | + $zip = ''; |
|
| 1287 | + $mapview = ''; |
|
| 1288 | + $mapzoom = ''; |
|
| 1289 | + $lat = ''; |
|
| 1290 | + $lng = ''; |
|
| 1291 | + |
|
| 1292 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1293 | + $post = $gd_ses_listing; |
|
| 1294 | + $address = $post[$prefix . 'address']; |
|
| 1295 | + $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1296 | + $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1297 | + $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1298 | + $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1299 | + $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1300 | + } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
|
|
| 1301 | + $post_info = (array)$post_info; |
|
| 1302 | + |
|
| 1303 | + $address = $post_info[$prefix . 'address']; |
|
| 1304 | + $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1305 | + $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1306 | + $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1307 | + $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1308 | + $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1309 | + } |
|
| 1310 | + |
|
| 1311 | + $location = geodir_get_default_location(); |
|
| 1312 | + if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1313 | + if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1314 | + if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1315 | + |
|
| 1316 | + $lat_lng_blank = false; |
|
| 1317 | + if (empty($lat) && empty($lng)) {
|
|
| 1318 | + $lat_lng_blank = true; |
|
| 1319 | + } |
|
| 1320 | + |
|
| 1321 | + if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1322 | + if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1323 | + |
|
| 1324 | + /** |
|
| 1325 | + * Filter the default latitude. |
|
| 1326 | + * |
|
| 1327 | + * @since 1.0.0 |
|
| 1328 | + * |
|
| 1329 | + * @param float $lat Default latitude. |
|
| 1330 | + * @param bool $is_admin For admin use only?. |
|
| 1331 | + */ |
|
| 1332 | + $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
|
|
| 1333 | + /** |
|
| 1334 | + * Filter the default longitude. |
|
| 1335 | + * |
|
| 1336 | + * @since 1.0.0 |
|
| 1337 | + * |
|
| 1338 | + * @param float $lat Default longitude. |
|
| 1339 | + * @param bool $is_admin For admin use only?. |
|
| 1340 | + */ |
|
| 1341 | + $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
|
|
| 1342 | + |
|
| 1343 | + ?> |
|
| 1344 | 1344 | |
| 1345 | 1345 | <div id="geodir_<?php echo $prefix . 'address';?>_row" |
| 1346 | 1346 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
@@ -1359,17 +1359,17 @@ discard block |
||
| 1359 | 1359 | |
| 1360 | 1360 | |
| 1361 | 1361 | <?php |
| 1362 | - /** |
|
| 1363 | - * Called after the address input on the add listings. |
|
| 1364 | - * |
|
| 1365 | - * This is used by the location manage to add further locations info etc. |
|
| 1366 | - * |
|
| 1367 | - * @since 1.0.0 |
|
| 1368 | - * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}.
|
|
| 1369 | - */ |
|
| 1370 | - do_action('geodir_address_extra_listing_fields', $val);
|
|
| 1371 | - |
|
| 1372 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
|
|
| 1362 | + /** |
|
| 1363 | + * Called after the address input on the add listings. |
|
| 1364 | + * |
|
| 1365 | + * This is used by the location manage to add further locations info etc. |
|
| 1366 | + * |
|
| 1367 | + * @since 1.0.0 |
|
| 1368 | + * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}.
|
|
| 1369 | + */ |
|
| 1370 | + do_action('geodir_address_extra_listing_fields', $val);
|
|
| 1371 | + |
|
| 1372 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
|
|
| 1373 | 1373 | |
| 1374 | 1374 | <div id="geodir_<?php echo $prefix . 'zip'; ?>_row" |
| 1375 | 1375 | class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
@@ -1390,22 +1390,22 @@ discard block |
||
| 1390 | 1390 | |
| 1391 | 1391 | <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1392 | 1392 | <?php |
| 1393 | - /** |
|
| 1394 | - * Contains add listing page map functions. |
|
| 1395 | - * |
|
| 1396 | - * @since 1.0.0 |
|
| 1397 | - */ |
|
| 1398 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1399 | - if ($lat_lng_blank) {
|
|
| 1400 | - $lat = ''; |
|
| 1401 | - $lng = ''; |
|
| 1402 | - } |
|
| 1403 | - ?> |
|
| 1393 | + /** |
|
| 1394 | + * Contains add listing page map functions. |
|
| 1395 | + * |
|
| 1396 | + * @since 1.0.0 |
|
| 1397 | + */ |
|
| 1398 | + include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1399 | + if ($lat_lng_blank) {
|
|
| 1400 | + $lat = ''; |
|
| 1401 | + $lng = ''; |
|
| 1402 | + } |
|
| 1403 | + ?> |
|
| 1404 | 1404 | <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span> |
| 1405 | 1405 | </div> |
| 1406 | 1406 | <?php |
| 1407 | - /* show lat lng */ |
|
| 1408 | - $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
| 1407 | + /* show lat lng */ |
|
| 1408 | + $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
| 1409 | 1409 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
| 1410 | 1410 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
| 1411 | 1411 | <label> |
@@ -1446,27 +1446,27 @@ discard block |
||
| 1446 | 1446 | class="gd-checkbox" |
| 1447 | 1447 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1448 | 1448 | id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
|
| 1449 | - echo 'checked="checked"'; |
|
| 1450 | - } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
|
|
| 1449 | + echo 'checked="checked"'; |
|
| 1450 | + } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
|
|
| 1451 | 1451 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio" |
| 1452 | 1452 | class="gd-checkbox" |
| 1453 | 1453 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1454 | 1454 | id="map_view1" <?php if ($mapview == 'SATELLITE') {
|
| 1455 | - echo 'checked="checked"'; |
|
| 1456 | - } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
|
|
| 1455 | + echo 'checked="checked"'; |
|
| 1456 | + } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
|
|
| 1457 | 1457 | |
| 1458 | 1458 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1459 | 1459 | class="gd-checkbox" |
| 1460 | 1460 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1461 | 1461 | id="map_view2" <?php if ($mapview == 'HYBRID') {
|
| 1462 | - echo 'checked="checked"'; |
|
| 1463 | - } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
|
|
| 1462 | + echo 'checked="checked"'; |
|
| 1463 | + } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
|
|
| 1464 | 1464 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1465 | 1465 | class="gd-checkbox" |
| 1466 | 1466 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1467 | 1467 | id="map_view3" <?php if ($mapview == 'TERRAIN') {
|
| 1468 | - echo 'checked="checked"'; |
|
| 1469 | - } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
|
|
| 1468 | + echo 'checked="checked"'; |
|
| 1469 | + } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
|
|
| 1470 | 1470 | |
| 1471 | 1471 | |
| 1472 | 1472 | </div> |
@@ -1474,31 +1474,31 @@ discard block |
||
| 1474 | 1474 | |
| 1475 | 1475 | <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
|
| 1476 | 1476 | <input type="hidden" value="<?php if (isset($mapzoom)) {
|
| 1477 | - echo esc_attr($mapzoom); |
|
| 1478 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1477 | + echo esc_attr($mapzoom); |
|
| 1478 | + } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1479 | 1479 | <?php }?> |
| 1480 | 1480 | <?php } elseif ($type == 'text') {
|
| 1481 | 1481 | |
| 1482 | - //number and float validation $validation_pattern |
|
| 1483 | - if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
|
|
| 1484 | - elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
|
|
| 1485 | - //print_r($val); |
|
| 1486 | - //validation |
|
| 1487 | - if(isset($val['validation_pattern']) && $val['validation_pattern']){
|
|
| 1488 | - $validation = 'pattern="'.$val['validation_pattern'].'"'; |
|
| 1489 | - }else{$validation='';}
|
|
| 1490 | - |
|
| 1491 | - // validation message |
|
| 1492 | - if(isset($val['validation_msg']) && $val['validation_msg']){
|
|
| 1493 | - $validation_msg = 'title="'.$val['validation_msg'].'"'; |
|
| 1494 | - }else{$validation_msg='';}
|
|
| 1495 | - ?> |
|
| 1482 | + //number and float validation $validation_pattern |
|
| 1483 | + if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
|
|
| 1484 | + elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
|
|
| 1485 | + //print_r($val); |
|
| 1486 | + //validation |
|
| 1487 | + if(isset($val['validation_pattern']) && $val['validation_pattern']){
|
|
| 1488 | + $validation = 'pattern="'.$val['validation_pattern'].'"'; |
|
| 1489 | + }else{$validation='';}
|
|
| 1490 | + |
|
| 1491 | + // validation message |
|
| 1492 | + if(isset($val['validation_msg']) && $val['validation_msg']){
|
|
| 1493 | + $validation_msg = 'title="'.$val['validation_msg'].'"'; |
|
| 1494 | + }else{$validation_msg='';}
|
|
| 1495 | + ?> |
|
| 1496 | 1496 | |
| 1497 | 1497 | <div id="<?php echo $name;?>_row" |
| 1498 | 1498 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1499 | 1499 | <label> |
| 1500 | 1500 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1501 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1501 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1502 | 1502 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1503 | 1503 | </label> |
| 1504 | 1504 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
@@ -1510,15 +1510,15 @@ discard block |
||
| 1510 | 1510 | </div> |
| 1511 | 1511 | |
| 1512 | 1512 | <?php } elseif ($type == 'email') {
|
| 1513 | - if ($value == $val['default']) {
|
|
| 1514 | - $value = ''; |
|
| 1515 | - }?> |
|
| 1513 | + if ($value == $val['default']) {
|
|
| 1514 | + $value = ''; |
|
| 1515 | + }?> |
|
| 1516 | 1516 | |
| 1517 | 1517 | <div id="<?php echo $name;?>_row" |
| 1518 | 1518 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1519 | 1519 | <label> |
| 1520 | 1520 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1521 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1521 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1522 | 1522 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1523 | 1523 | </label> |
| 1524 | 1524 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
@@ -1530,15 +1530,15 @@ discard block |
||
| 1530 | 1530 | </div> |
| 1531 | 1531 | |
| 1532 | 1532 | <?php } elseif ($type == 'phone') {
|
| 1533 | - if ($value == $val['default']) {
|
|
| 1534 | - $value = ''; |
|
| 1535 | - } ?> |
|
| 1533 | + if ($value == $val['default']) {
|
|
| 1534 | + $value = ''; |
|
| 1535 | + } ?> |
|
| 1536 | 1536 | |
| 1537 | 1537 | <div id="<?php echo $name;?>_row" |
| 1538 | 1538 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1539 | 1539 | <label> |
| 1540 | 1540 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1541 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1541 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1542 | 1542 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1543 | 1543 | </label> |
| 1544 | 1544 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
@@ -1550,15 +1550,15 @@ discard block |
||
| 1550 | 1550 | </div> |
| 1551 | 1551 | |
| 1552 | 1552 | <?php } elseif ($type == 'url') {
|
| 1553 | - if ($value == $val['default']) {
|
|
| 1554 | - $value = ''; |
|
| 1555 | - }?> |
|
| 1553 | + if ($value == $val['default']) {
|
|
| 1554 | + $value = ''; |
|
| 1555 | + }?> |
|
| 1556 | 1556 | |
| 1557 | 1557 | <div id="<?php echo $name;?>_row" |
| 1558 | 1558 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1559 | 1559 | <label> |
| 1560 | 1560 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1561 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1561 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1562 | 1562 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1563 | 1563 | </label> |
| 1564 | 1564 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
@@ -1577,23 +1577,23 @@ discard block |
||
| 1577 | 1577 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1578 | 1578 | <label> |
| 1579 | 1579 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1580 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1580 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1581 | 1581 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1582 | 1582 | </label> |
| 1583 | 1583 | <?php if ($option_values) {
|
| 1584 | - $option_values = geodir_string_values_to_options($option_values, true); |
|
| 1584 | + $option_values = geodir_string_values_to_options($option_values, true); |
|
| 1585 | 1585 | |
| 1586 | - if (!empty($option_values)) {
|
|
| 1587 | - foreach ($option_values as $option_value) {
|
|
| 1588 | - if (empty($option_value['optgroup'])) {
|
|
| 1589 | - ?> |
|
| 1586 | + if (!empty($option_values)) {
|
|
| 1587 | + foreach ($option_values as $option_value) {
|
|
| 1588 | + if (empty($option_value['optgroup'])) {
|
|
| 1589 | + ?> |
|
| 1590 | 1590 | <input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?> |
| 1591 | 1591 | <?php |
| 1592 | - } |
|
| 1593 | - } |
|
| 1594 | - } |
|
| 1595 | - } |
|
| 1596 | - ?> |
|
| 1592 | + } |
|
| 1593 | + } |
|
| 1594 | + } |
|
| 1595 | + } |
|
| 1596 | + ?> |
|
| 1597 | 1597 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
| 1598 | 1598 | <?php if ($is_required) { ?>
|
| 1599 | 1599 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
@@ -1606,16 +1606,16 @@ discard block |
||
| 1606 | 1606 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1607 | 1607 | <label> |
| 1608 | 1608 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1609 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1609 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1610 | 1610 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1611 | 1611 | </label> |
| 1612 | 1612 | <?php if ($value != '1') {
|
| 1613 | - $value = '0'; |
|
| 1614 | - }?> |
|
| 1613 | + $value = '0'; |
|
| 1614 | + }?> |
|
| 1615 | 1615 | <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/> |
| 1616 | 1616 | <input <?php if ($value == '1') {
|
| 1617 | - echo 'checked="checked"'; |
|
| 1618 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox" |
|
| 1617 | + echo 'checked="checked"'; |
|
| 1618 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox" |
|
| 1619 | 1619 | onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
|
| 1620 | 1620 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
| 1621 | 1621 | <?php if ($is_required) { ?>
|
@@ -1624,31 +1624,31 @@ discard block |
||
| 1624 | 1624 | </div> |
| 1625 | 1625 | |
| 1626 | 1626 | <?php } elseif ($type == 'textarea') {
|
| 1627 | - ?> |
|
| 1627 | + ?> |
|
| 1628 | 1628 | |
| 1629 | 1629 | <div id="<?php echo $name;?>_row" |
| 1630 | 1630 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1631 | 1631 | <label> |
| 1632 | 1632 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1633 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1633 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1634 | 1634 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1635 | 1635 | </label><?php |
| 1636 | 1636 | |
| 1637 | 1637 | |
| 1638 | - if (is_array($extra_fields) && in_array('1', $extra_fields)) {
|
|
| 1638 | + if (is_array($extra_fields) && in_array('1', $extra_fields)) {
|
|
| 1639 | 1639 | |
| 1640 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
|
|
| 1640 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
|
|
| 1641 | 1641 | |
| 1642 | 1642 | <div class="editor" field_id="<?php echo $name;?>" field_type="editor"> |
| 1643 | 1643 | <?php wp_editor(stripslashes($value), $name, $editor_settings); ?> |
| 1644 | 1644 | </div><?php |
| 1645 | 1645 | |
| 1646 | - } else {
|
|
| 1646 | + } else {
|
|
| 1647 | 1647 | |
| 1648 | - ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>" |
|
| 1648 | + ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>" |
|
| 1649 | 1649 | id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php |
| 1650 | 1650 | |
| 1651 | - }?> |
|
| 1651 | + }?> |
|
| 1652 | 1652 | |
| 1653 | 1653 | |
| 1654 | 1654 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
@@ -1662,28 +1662,28 @@ discard block |
||
| 1662 | 1662 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>"> |
| 1663 | 1663 | <label> |
| 1664 | 1664 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1665 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1665 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1666 | 1666 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1667 | 1667 | </label> |
| 1668 | 1668 | <?php |
| 1669 | - $option_values_arr = geodir_string_values_to_options($option_values, true); |
|
| 1670 | - $select_options = ''; |
|
| 1671 | - if (!empty($option_values_arr)) {
|
|
| 1672 | - foreach ($option_values_arr as $option_row) {
|
|
| 1673 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
|
|
| 1674 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 1675 | - |
|
| 1676 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 1677 | - } else {
|
|
| 1678 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 1679 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 1680 | - $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 1681 | - |
|
| 1682 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 1683 | - } |
|
| 1684 | - } |
|
| 1685 | - } |
|
| 1686 | - ?> |
|
| 1669 | + $option_values_arr = geodir_string_values_to_options($option_values, true); |
|
| 1670 | + $select_options = ''; |
|
| 1671 | + if (!empty($option_values_arr)) {
|
|
| 1672 | + foreach ($option_values_arr as $option_row) {
|
|
| 1673 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
|
|
| 1674 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 1675 | + |
|
| 1676 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 1677 | + } else {
|
|
| 1678 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 1679 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 1680 | + $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 1681 | + |
|
| 1682 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 1683 | + } |
|
| 1684 | + } |
|
| 1685 | + } |
|
| 1686 | + ?> |
|
| 1687 | 1687 | <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1688 | 1688 | class="geodir_textfield textfield_x chosen_select" |
| 1689 | 1689 | data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>"
|
@@ -1695,17 +1695,17 @@ discard block |
||
| 1695 | 1695 | </div> |
| 1696 | 1696 | |
| 1697 | 1697 | <?php |
| 1698 | - } else if ($type == 'multiselect') {
|
|
| 1699 | - $multi_display = 'select'; |
|
| 1700 | - if (!empty($val['extra_fields'])) {
|
|
| 1701 | - $multi_display = unserialize($val['extra_fields']); |
|
| 1702 | - } |
|
| 1703 | - ?> |
|
| 1698 | + } else if ($type == 'multiselect') {
|
|
| 1699 | + $multi_display = 'select'; |
|
| 1700 | + if (!empty($val['extra_fields'])) {
|
|
| 1701 | + $multi_display = unserialize($val['extra_fields']); |
|
| 1702 | + } |
|
| 1703 | + ?> |
|
| 1704 | 1704 | <div id="<?php echo $name; ?>_row" |
| 1705 | 1705 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1706 | 1706 | <label> |
| 1707 | 1707 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1708 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1708 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1709 | 1709 | <?php if ($is_required) echo '<span>*</span>'; ?> |
| 1710 | 1710 | </label> |
| 1711 | 1711 | <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/> |
@@ -1716,55 +1716,55 @@ discard block |
||
| 1716 | 1716 | data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
|
| 1717 | 1717 | option-ajaxchosen="false"> |
| 1718 | 1718 | <?php |
| 1719 | - } else {
|
|
| 1720 | - echo '<ul class="gd_multi_choice">'; |
|
| 1721 | - } |
|
| 1722 | - |
|
| 1723 | - $option_values_arr = geodir_string_values_to_options($option_values, true); |
|
| 1724 | - $select_options = ''; |
|
| 1725 | - if (!empty($option_values_arr)) {
|
|
| 1726 | - foreach ($option_values_arr as $option_row) {
|
|
| 1727 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
|
|
| 1728 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 1729 | - |
|
| 1730 | - if ($multi_display == 'select') {
|
|
| 1731 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 1732 | - } else {
|
|
| 1733 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 1734 | - } |
|
| 1735 | - } else {
|
|
| 1736 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 1737 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 1738 | - $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 1739 | - $selected = ''; |
|
| 1740 | - $checked = ''; |
|
| 1741 | - |
|
| 1742 | - if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
|
|
| 1743 | - if (!is_array($value)) {
|
|
| 1744 | - $value_array = explode(',', $value);
|
|
| 1745 | - } else {
|
|
| 1746 | - $value_array = $value; |
|
| 1747 | - } |
|
| 1748 | - |
|
| 1749 | - if (is_array($value_array)) {
|
|
| 1750 | - if (in_array($option_value, $value_array)) {
|
|
| 1751 | - $selected = 'selected="selected"'; |
|
| 1752 | - $checked = 'checked="checked"'; |
|
| 1753 | - } |
|
| 1754 | - } |
|
| 1755 | - } |
|
| 1756 | - |
|
| 1757 | - if ($multi_display == 'select') {
|
|
| 1758 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 1759 | - } else {
|
|
| 1760 | - $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 1761 | - } |
|
| 1762 | - } |
|
| 1763 | - } |
|
| 1764 | - } |
|
| 1765 | - echo $select_options; |
|
| 1766 | - |
|
| 1767 | - if ($multi_display == 'select') { ?></select></div>
|
|
| 1719 | + } else {
|
|
| 1720 | + echo '<ul class="gd_multi_choice">'; |
|
| 1721 | + } |
|
| 1722 | + |
|
| 1723 | + $option_values_arr = geodir_string_values_to_options($option_values, true); |
|
| 1724 | + $select_options = ''; |
|
| 1725 | + if (!empty($option_values_arr)) {
|
|
| 1726 | + foreach ($option_values_arr as $option_row) {
|
|
| 1727 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
|
|
| 1728 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 1729 | + |
|
| 1730 | + if ($multi_display == 'select') {
|
|
| 1731 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 1732 | + } else {
|
|
| 1733 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 1734 | + } |
|
| 1735 | + } else {
|
|
| 1736 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 1737 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 1738 | + $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 1739 | + $selected = ''; |
|
| 1740 | + $checked = ''; |
|
| 1741 | + |
|
| 1742 | + if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
|
|
| 1743 | + if (!is_array($value)) {
|
|
| 1744 | + $value_array = explode(',', $value);
|
|
| 1745 | + } else {
|
|
| 1746 | + $value_array = $value; |
|
| 1747 | + } |
|
| 1748 | + |
|
| 1749 | + if (is_array($value_array)) {
|
|
| 1750 | + if (in_array($option_value, $value_array)) {
|
|
| 1751 | + $selected = 'selected="selected"'; |
|
| 1752 | + $checked = 'checked="checked"'; |
|
| 1753 | + } |
|
| 1754 | + } |
|
| 1755 | + } |
|
| 1756 | + |
|
| 1757 | + if ($multi_display == 'select') {
|
|
| 1758 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 1759 | + } else {
|
|
| 1760 | + $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 1761 | + } |
|
| 1762 | + } |
|
| 1763 | + } |
|
| 1764 | + } |
|
| 1765 | + echo $select_options; |
|
| 1766 | + |
|
| 1767 | + if ($multi_display == 'select') { ?></select></div>
|
|
| 1768 | 1768 | <?php } else { ?></ul><?php } ?>
|
| 1769 | 1769 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
| 1770 | 1770 | <?php if ($is_required) { ?>
|
@@ -1772,14 +1772,14 @@ discard block |
||
| 1772 | 1772 | <?php } ?> |
| 1773 | 1773 | </div> |
| 1774 | 1774 | <?php |
| 1775 | - } else if ($type == 'html') {
|
|
| 1776 | - ?> |
|
| 1775 | + } else if ($type == 'html') {
|
|
| 1776 | + ?> |
|
| 1777 | 1777 | |
| 1778 | 1778 | <div id="<?php echo $name; ?>_row" |
| 1779 | 1779 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1780 | 1780 | <label> |
| 1781 | 1781 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1782 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1782 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1783 | 1783 | <?php if ($is_required) echo '<span>*</span>'; ?> |
| 1784 | 1784 | </label> |
| 1785 | 1785 | |
@@ -1797,34 +1797,34 @@ discard block |
||
| 1797 | 1797 | </div> |
| 1798 | 1798 | <?php } elseif ($type == 'datepicker') {
|
| 1799 | 1799 | |
| 1800 | - if ($extra_fields['date_format'] == '') |
|
| 1801 | - $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 1800 | + if ($extra_fields['date_format'] == '') |
|
| 1801 | + $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 1802 | 1802 | |
| 1803 | 1803 | |
| 1804 | - $search = array('dd', 'mm', 'yy');
|
|
| 1805 | - $replace = array('d', 'm', 'Y');
|
|
| 1804 | + $search = array('dd', 'mm', 'yy');
|
|
| 1805 | + $replace = array('d', 'm', 'Y');
|
|
| 1806 | 1806 | |
| 1807 | - $date_format = str_replace($search, $replace, $extra_fields['date_format']); |
|
| 1807 | + $date_format = str_replace($search, $replace, $extra_fields['date_format']); |
|
| 1808 | 1808 | |
| 1809 | - if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
|
|
| 1810 | - if($value && !isset($_REQUEST['backandedit'])) {
|
|
| 1811 | - $time = strtotime($value); |
|
| 1812 | - $value = date($date_format, $time); |
|
| 1813 | - } |
|
| 1809 | + if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
|
|
| 1810 | + if($value && !isset($_REQUEST['backandedit'])) {
|
|
| 1811 | + $time = strtotime($value); |
|
| 1812 | + $value = date($date_format, $time); |
|
| 1813 | + } |
|
| 1814 | 1814 | |
| 1815 | - ?> |
|
| 1815 | + ?> |
|
| 1816 | 1816 | <script type="text/javascript"> |
| 1817 | 1817 | |
| 1818 | 1818 | jQuery(function () {
|
| 1819 | 1819 | |
| 1820 | 1820 | jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
|
| 1821 | - /** |
|
| 1822 | - * Used to add extra option to datepicker per custom field. |
|
| 1823 | - * |
|
| 1824 | - * @since 1.5.7 |
|
| 1825 | - * @param string $name The custom field name. |
|
| 1826 | - */ |
|
| 1827 | - echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
|
|
| 1821 | + /** |
|
| 1822 | + * Used to add extra option to datepicker per custom field. |
|
| 1823 | + * |
|
| 1824 | + * @since 1.5.7 |
|
| 1825 | + * @param string $name The custom field name. |
|
| 1826 | + */ |
|
| 1827 | + echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
|
|
| 1828 | 1828 | |
| 1829 | 1829 | jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format'];?>');
|
| 1830 | 1830 | |
@@ -1840,7 +1840,7 @@ discard block |
||
| 1840 | 1840 | <label> |
| 1841 | 1841 | |
| 1842 | 1842 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1843 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1843 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1844 | 1844 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1845 | 1845 | </label> |
| 1846 | 1846 | |
@@ -1855,9 +1855,9 @@ discard block |
||
| 1855 | 1855 | |
| 1856 | 1856 | <?php } elseif ($type == 'time') {
|
| 1857 | 1857 | |
| 1858 | - if ($value != '') |
|
| 1859 | - $value = date('H:i', strtotime($value));
|
|
| 1860 | - ?> |
|
| 1858 | + if ($value != '') |
|
| 1859 | + $value = date('H:i', strtotime($value));
|
|
| 1860 | + ?> |
|
| 1861 | 1861 | <script type="text/javascript"> |
| 1862 | 1862 | jQuery(document).ready(function () {
|
| 1863 | 1863 | |
@@ -1873,7 +1873,7 @@ discard block |
||
| 1873 | 1873 | <label> |
| 1874 | 1874 | |
| 1875 | 1875 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1876 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1876 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1877 | 1877 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1878 | 1878 | </label> |
| 1879 | 1879 | <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>" |
@@ -1886,110 +1886,110 @@ discard block |
||
| 1886 | 1886 | </div> |
| 1887 | 1887 | |
| 1888 | 1888 | <?php } elseif ($type == 'taxonomy') {
|
| 1889 | - if ($value == $val['default']) {
|
|
| 1890 | - $value = ''; |
|
| 1891 | - } ?> |
|
| 1889 | + if ($value == $val['default']) {
|
|
| 1890 | + $value = ''; |
|
| 1891 | + } ?> |
|
| 1892 | 1892 | <div id="<?php echo $name;?>_row" |
| 1893 | 1893 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
| 1894 | 1894 | <label> |
| 1895 | 1895 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1896 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1896 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1897 | 1897 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1898 | 1898 | </label> |
| 1899 | 1899 | |
| 1900 | 1900 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
| 1901 | 1901 | <?php |
| 1902 | - global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
| 1902 | + global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
| 1903 | 1903 | |
| 1904 | - $exclude_cats = array(); |
|
| 1904 | + $exclude_cats = array(); |
|
| 1905 | 1905 | |
| 1906 | - if ($is_admin == '1') {
|
|
| 1906 | + if ($is_admin == '1') {
|
|
| 1907 | 1907 | |
| 1908 | - $post_type = get_post_type(); |
|
| 1908 | + $post_type = get_post_type(); |
|
| 1909 | 1909 | |
| 1910 | - $package_info = array(); |
|
| 1910 | + $package_info = array(); |
|
| 1911 | 1911 | |
| 1912 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1912 | + $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1913 | 1913 | |
| 1914 | - if (!empty($package_info)) {
|
|
| 1914 | + if (!empty($package_info)) {
|
|
| 1915 | 1915 | |
| 1916 | - if (isset($package_info['cat']) && $package_info['cat'] != '') {
|
|
| 1916 | + if (isset($package_info['cat']) && $package_info['cat'] != '') {
|
|
| 1917 | 1917 | |
| 1918 | - $exclude_cats = explode(',', $package_info['cat']);
|
|
| 1918 | + $exclude_cats = explode(',', $package_info['cat']);
|
|
| 1919 | 1919 | |
| 1920 | - } |
|
| 1921 | - } |
|
| 1922 | - } |
|
| 1920 | + } |
|
| 1921 | + } |
|
| 1922 | + } |
|
| 1923 | 1923 | |
| 1924 | - $cat_display = unserialize($val['extra_fields']); |
|
| 1924 | + $cat_display = unserialize($val['extra_fields']); |
|
| 1925 | 1925 | |
| 1926 | - if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
|
|
| 1926 | + if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
|
|
| 1927 | 1927 | |
| 1928 | - $post_cat = implode(",", $post_cat[$name]);
|
|
| 1928 | + $post_cat = implode(",", $post_cat[$name]);
|
|
| 1929 | 1929 | |
| 1930 | - } else {
|
|
| 1931 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1932 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1933 | - } |
|
| 1930 | + } else {
|
|
| 1931 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1932 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1933 | + } |
|
| 1934 | 1934 | |
| 1935 | 1935 | |
| 1936 | - global $geodir_addon_list; |
|
| 1937 | - if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
|
|
| 1936 | + global $geodir_addon_list; |
|
| 1937 | + if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
|
|
| 1938 | 1938 | |
| 1939 | - $catadd_limit = $wpdb->get_var( |
|
| 1940 | - $wpdb->prepare( |
|
| 1941 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1942 | - array($package_id) |
|
| 1943 | - ) |
|
| 1944 | - ); |
|
| 1939 | + $catadd_limit = $wpdb->get_var( |
|
| 1940 | + $wpdb->prepare( |
|
| 1941 | + "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1942 | + array($package_id) |
|
| 1943 | + ) |
|
| 1944 | + ); |
|
| 1945 | 1945 | |
| 1946 | 1946 | |
| 1947 | - } else {
|
|
| 1948 | - $catadd_limit = 0; |
|
| 1949 | - } |
|
| 1947 | + } else {
|
|
| 1948 | + $catadd_limit = 0; |
|
| 1949 | + } |
|
| 1950 | 1950 | |
| 1951 | 1951 | |
| 1952 | - if ($cat_display != '' && $cat_display != 'ajax_chained') {
|
|
| 1952 | + if ($cat_display != '' && $cat_display != 'ajax_chained') {
|
|
| 1953 | 1953 | |
| 1954 | - $required_limit_msg = ''; |
|
| 1955 | - if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
|
|
| 1954 | + $required_limit_msg = ''; |
|
| 1955 | + if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
|
|
| 1956 | 1956 | |
| 1957 | - $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
|
|
| 1957 | + $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
|
|
| 1958 | 1958 | |
| 1959 | - } else {
|
|
| 1960 | - $required_limit_msg = $required_msg; |
|
| 1961 | - } |
|
| 1959 | + } else {
|
|
| 1960 | + $required_limit_msg = $required_msg; |
|
| 1961 | + } |
|
| 1962 | 1962 | |
| 1963 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1963 | + echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1964 | 1964 | |
| 1965 | 1965 | |
| 1966 | - if ($cat_display == 'select' || $cat_display == 'multiselect') {
|
|
| 1966 | + if ($cat_display == 'select' || $cat_display == 'multiselect') {
|
|
| 1967 | 1967 | |
| 1968 | - $cat_display == ''; |
|
| 1969 | - $multiple = ''; |
|
| 1970 | - if ($cat_display == 'multiselect') |
|
| 1971 | - $multiple = 'multiple="multiple"'; |
|
| 1968 | + $cat_display == ''; |
|
| 1969 | + $multiple = ''; |
|
| 1970 | + if ($cat_display == 'multiselect') |
|
| 1971 | + $multiple = 'multiple="multiple"'; |
|
| 1972 | 1972 | |
| 1973 | - echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
|
|
| 1973 | + echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
|
|
| 1974 | 1974 | |
| 1975 | 1975 | |
| 1976 | - if ($cat_display == 'select') |
|
| 1977 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1976 | + if ($cat_display == 'select') |
|
| 1977 | + echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1978 | 1978 | |
| 1979 | - } |
|
| 1979 | + } |
|
| 1980 | 1980 | |
| 1981 | - echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
| 1981 | + echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
| 1982 | 1982 | |
| 1983 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1984 | - echo '</select>'; |
|
| 1983 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1984 | + echo '</select>'; |
|
| 1985 | 1985 | |
| 1986 | - } else {
|
|
| 1986 | + } else {
|
|
| 1987 | 1987 | |
| 1988 | - echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
| 1988 | + echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
| 1989 | 1989 | |
| 1990 | - } |
|
| 1990 | + } |
|
| 1991 | 1991 | |
| 1992 | - ?> |
|
| 1992 | + ?> |
|
| 1993 | 1993 | </div> |
| 1994 | 1994 | |
| 1995 | 1995 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
@@ -2004,46 +2004,46 @@ discard block |
||
| 2004 | 2004 | |
| 2005 | 2005 | |
| 2006 | 2006 | |
| 2007 | - // adjust values here |
|
| 2008 | - $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 2007 | + // adjust values here |
|
| 2008 | + $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 2009 | 2009 | |
| 2010 | - if ($value != '') {
|
|
| 2010 | + if ($value != '') {
|
|
| 2011 | 2011 | |
| 2012 | - $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
| 2012 | + $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
| 2013 | 2013 | |
| 2014 | - } else |
|
| 2015 | - $file_value = ''; |
|
| 2014 | + } else |
|
| 2015 | + $file_value = ''; |
|
| 2016 | 2016 | |
| 2017 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 2018 | - $file_multiple = true; // allow multiple files upload |
|
| 2019 | - else |
|
| 2020 | - $file_multiple = false; |
|
| 2017 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 2018 | + $file_multiple = true; // allow multiple files upload |
|
| 2019 | + else |
|
| 2020 | + $file_multiple = false; |
|
| 2021 | 2021 | |
| 2022 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 2023 | - $file_image_limit = $extra_fields['image_limit']; |
|
| 2024 | - else |
|
| 2025 | - $file_image_limit = 1; |
|
| 2022 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 2023 | + $file_image_limit = $extra_fields['image_limit']; |
|
| 2024 | + else |
|
| 2025 | + $file_image_limit = 1; |
|
| 2026 | 2026 | |
| 2027 | - $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 2027 | + $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 2028 | 2028 | |
| 2029 | - $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 2029 | + $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 2030 | 2030 | |
| 2031 | - if (!empty($file_value)) {
|
|
| 2032 | - $curImages = explode(',', $file_value);
|
|
| 2033 | - if (!empty($curImages)) |
|
| 2034 | - $file_totImg = count($curImages); |
|
| 2035 | - } |
|
| 2031 | + if (!empty($file_value)) {
|
|
| 2032 | + $curImages = explode(',', $file_value);
|
|
| 2033 | + if (!empty($curImages)) |
|
| 2034 | + $file_totImg = count($curImages); |
|
| 2035 | + } |
|
| 2036 | 2036 | |
| 2037 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
|
|
| 2038 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
|
|
| 2037 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
|
|
| 2038 | + $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
|
|
| 2039 | 2039 | |
| 2040 | - ?> |
|
| 2040 | + ?> |
|
| 2041 | 2041 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
| 2042 | 2042 | <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
|
| 2043 | 2043 | <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
|
| 2044 | 2044 | <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
|
| 2045 | 2045 | </h5> <?php */ |
| 2046 | - ?> |
|
| 2046 | + ?> |
|
| 2047 | 2047 | |
| 2048 | 2048 | <div id="<?php echo $name;?>_row" |
| 2049 | 2049 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
@@ -2051,7 +2051,7 @@ discard block |
||
| 2051 | 2051 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 2052 | 2052 | <label |
| 2053 | 2053 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 2054 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 2054 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 2055 | 2055 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 2056 | 2056 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 2057 | 2057 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -2063,17 +2063,17 @@ discard block |
||
| 2063 | 2063 | <?php } ?> |
| 2064 | 2064 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
| 2065 | 2065 | value="<?php if (isset($file_totImg)) {
|
| 2066 | - echo esc_attr($file_totImg); |
|
| 2067 | - } else {
|
|
| 2068 | - echo '0'; |
|
| 2069 | - } ?>"/> |
|
| 2066 | + echo esc_attr($file_totImg); |
|
| 2067 | + } else {
|
|
| 2068 | + echo '0'; |
|
| 2069 | + } ?>"/> |
|
| 2070 | 2070 | |
| 2071 | 2071 | <div style="float:left; width:55%;"> |
| 2072 | 2072 | <div |
| 2073 | 2073 | class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 2074 | 2074 | id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;"> |
| 2075 | 2075 | <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
|
| 2076 | - ?> |
|
| 2076 | + ?> |
|
| 2077 | 2077 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button" |
| 2078 | 2078 | value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
|
| 2079 | 2079 | class="geodir_button" style="margin-top:10px;"/> |
@@ -2092,7 +2092,7 @@ discard block |
||
| 2092 | 2092 | style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;"> |
| 2093 | 2093 | </div> |
| 2094 | 2094 | <?php /*?><span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span><?php */
|
| 2095 | - ?> |
|
| 2095 | + ?> |
|
| 2096 | 2096 | |
| 2097 | 2097 | <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span> |
| 2098 | 2098 | |
@@ -2106,176 +2106,176 @@ discard block |
||
| 2106 | 2106 | |
| 2107 | 2107 | |
| 2108 | 2108 | <?php } |
| 2109 | - /** |
|
| 2110 | - * Called after the custom fields info is output for submitting a post. |
|
| 2111 | - * |
|
| 2112 | - * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 2113 | - * |
|
| 2114 | - * @since 1.0.0 |
|
| 2115 | - * @param string $listing_type The post post type. |
|
| 2116 | - * @param int $package_id The price package ID for the post. |
|
| 2117 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 2118 | - * @see 'geodir_before_custom_form_field_$name' |
|
| 2119 | - */ |
|
| 2120 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 2121 | - |
|
| 2122 | - } |
|
| 2109 | + /** |
|
| 2110 | + * Called after the custom fields info is output for submitting a post. |
|
| 2111 | + * |
|
| 2112 | + * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 2113 | + * |
|
| 2114 | + * @since 1.0.0 |
|
| 2115 | + * @param string $listing_type The post post type. |
|
| 2116 | + * @param int $package_id The price package ID for the post. |
|
| 2117 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 2118 | + * @see 'geodir_before_custom_form_field_$name' |
|
| 2119 | + */ |
|
| 2120 | + do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 2121 | + |
|
| 2122 | + } |
|
| 2123 | 2123 | |
| 2124 | 2124 | } |
| 2125 | 2125 | |
| 2126 | 2126 | |
| 2127 | 2127 | if (!function_exists('geodir_get_field_infoby')) {
|
| 2128 | - /** |
|
| 2129 | - * Get custom field using key and value. |
|
| 2130 | - * |
|
| 2131 | - * @since 1.0.0 |
|
| 2132 | - * @package GeoDirectory |
|
| 2133 | - * @global object $wpdb WordPress Database object. |
|
| 2134 | - * @param string $key The key you want to look for. |
|
| 2135 | - * @param string $value The value of the key you want to look for. |
|
| 2136 | - * @param string $geodir_post_type The post type. |
|
| 2137 | - * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 2138 | - */ |
|
| 2139 | - function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 2140 | - {
|
|
| 2141 | - |
|
| 2142 | - global $wpdb; |
|
| 2143 | - |
|
| 2144 | - $filter = $wpdb->get_row( |
|
| 2145 | - $wpdb->prepare( |
|
| 2146 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 2147 | - array($geodir_post_type) |
|
| 2148 | - ) |
|
| 2149 | - ); |
|
| 2150 | - |
|
| 2151 | - if ($filter) {
|
|
| 2152 | - return $filter; |
|
| 2153 | - } else {
|
|
| 2154 | - return false; |
|
| 2155 | - } |
|
| 2156 | - |
|
| 2157 | - } |
|
| 2128 | + /** |
|
| 2129 | + * Get custom field using key and value. |
|
| 2130 | + * |
|
| 2131 | + * @since 1.0.0 |
|
| 2132 | + * @package GeoDirectory |
|
| 2133 | + * @global object $wpdb WordPress Database object. |
|
| 2134 | + * @param string $key The key you want to look for. |
|
| 2135 | + * @param string $value The value of the key you want to look for. |
|
| 2136 | + * @param string $geodir_post_type The post type. |
|
| 2137 | + * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 2138 | + */ |
|
| 2139 | + function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 2140 | + {
|
|
| 2141 | + |
|
| 2142 | + global $wpdb; |
|
| 2143 | + |
|
| 2144 | + $filter = $wpdb->get_row( |
|
| 2145 | + $wpdb->prepare( |
|
| 2146 | + "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 2147 | + array($geodir_post_type) |
|
| 2148 | + ) |
|
| 2149 | + ); |
|
| 2150 | + |
|
| 2151 | + if ($filter) {
|
|
| 2152 | + return $filter; |
|
| 2153 | + } else {
|
|
| 2154 | + return false; |
|
| 2155 | + } |
|
| 2156 | + |
|
| 2157 | + } |
|
| 2158 | 2158 | } |
| 2159 | 2159 | |
| 2160 | 2160 | |
| 2161 | 2161 | if (!function_exists('geodir_show_listing_info')) {
|
| 2162 | - /** |
|
| 2163 | - * Show listing info depending on field location. |
|
| 2164 | - * |
|
| 2165 | - * @since 1.0.0 |
|
| 2166 | - * @since 1.5.7 Custom fields option values added to db translation. |
|
| 2167 | - * Changes to display url fields title. |
|
| 2168 | - * @package GeoDirectory |
|
| 2169 | - * @global object $wpdb WordPress Database object. |
|
| 2170 | - * @global object $post The current post object. |
|
| 2171 | - * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 2172 | - * |
|
| 2173 | - * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 2174 | - * @return string Returns listing info html. |
|
| 2175 | - */ |
|
| 2176 | - function geodir_show_listing_info($fields_location = '') {
|
|
| 2177 | - global $post, $preview, $wpdb, $send_to_friend; |
|
| 2178 | - |
|
| 2179 | - $payment_info = array(); |
|
| 2180 | - $package_info = array(); |
|
| 2181 | - |
|
| 2182 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 2183 | - $post_package_id = $package_info->pid; |
|
| 2184 | - $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type; |
|
| 2185 | - $send_to_friend = false; |
|
| 2186 | - |
|
| 2187 | - ob_start(); |
|
| 2188 | - $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location); |
|
| 2189 | - |
|
| 2190 | - if (!empty($fields_info)) {
|
|
| 2191 | - //echo '<div class="geodir-company_info field-group">'; |
|
| 2192 | - $field_set_start = 0; |
|
| 2193 | - |
|
| 2194 | - |
|
| 2195 | - if ($fields_location == 'detail') |
|
| 2196 | - |
|
| 2197 | - $i = 1; |
|
| 2198 | - foreach ($fields_info as $type) {
|
|
| 2199 | - $type = stripslashes_deep($type); // strip slashes |
|
| 2200 | - $html = ''; |
|
| 2201 | - $html_var = ''; |
|
| 2202 | - $field_icon = ''; |
|
| 2203 | - |
|
| 2204 | - $variables_array = array(); |
|
| 2205 | - |
|
| 2206 | - if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 2207 | - continue; |
|
| 2208 | - } |
|
| 2209 | - |
|
| 2210 | - if ($type['type'] != 'fieldset'): |
|
| 2211 | - $variables_array['post_id'] = $post->ID; |
|
| 2212 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 2213 | - $variables_array['value'] = ''; |
|
| 2214 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 2215 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 2216 | - endif; |
|
| 2217 | - |
|
| 2218 | - //if($type['field_icon']) |
|
| 2219 | - |
|
| 2220 | - if (strpos($type['field_icon'], 'http') !== false) {
|
|
| 2221 | - $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 2222 | - } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
|
|
| 2223 | - $field_icon = '<i class="' . $type['field_icon'] . '"></i>'; |
|
| 2224 | - } |
|
| 2225 | - //else{$field_icon = $type['field_icon'];}
|
|
| 2226 | - |
|
| 2227 | - |
|
| 2228 | - switch ($type['type']) {
|
|
| 2229 | - |
|
| 2230 | - case 'fieldset': |
|
| 2231 | - |
|
| 2232 | - $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']); |
|
| 2233 | - |
|
| 2234 | - if ($field_set_start == 1) {
|
|
| 2235 | - echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>'; |
|
| 2236 | - } else {
|
|
| 2237 | - echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>'; |
|
| 2238 | - $field_set_start = 1; |
|
| 2239 | - } |
|
| 2240 | - |
|
| 2241 | - break; |
|
| 2242 | - |
|
| 2243 | - case 'address': |
|
| 2244 | - |
|
| 2245 | - $html_var = $type['htmlvar_name'] . '_address'; |
|
| 2246 | - |
|
| 2247 | - if ($type['extra_fields']) {
|
|
| 2248 | - |
|
| 2249 | - $extra_fields = unserialize($type['extra_fields']); |
|
| 2250 | - |
|
| 2251 | - $addition_fields = ''; |
|
| 2252 | - |
|
| 2253 | - if (!empty($extra_fields)) {
|
|
| 2254 | - /** |
|
| 2255 | - * Filter "show city in address" value. |
|
| 2256 | - * |
|
| 2257 | - * @since 1.0.0 |
|
| 2258 | - */ |
|
| 2259 | - $show_city_in_address = apply_filters('geodir_show_city_in_address', false);
|
|
| 2260 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city'] && $show_city_in_address) {
|
|
| 2261 | - $field = $type['htmlvar_name'] . '_city'; |
|
| 2262 | - if ($post->{$field}) {
|
|
| 2263 | - $addition_fields .= ', ' . $post->{$field};
|
|
| 2264 | - } |
|
| 2265 | - } |
|
| 2162 | + /** |
|
| 2163 | + * Show listing info depending on field location. |
|
| 2164 | + * |
|
| 2165 | + * @since 1.0.0 |
|
| 2166 | + * @since 1.5.7 Custom fields option values added to db translation. |
|
| 2167 | + * Changes to display url fields title. |
|
| 2168 | + * @package GeoDirectory |
|
| 2169 | + * @global object $wpdb WordPress Database object. |
|
| 2170 | + * @global object $post The current post object. |
|
| 2171 | + * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 2172 | + * |
|
| 2173 | + * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 2174 | + * @return string Returns listing info html. |
|
| 2175 | + */ |
|
| 2176 | + function geodir_show_listing_info($fields_location = '') {
|
|
| 2177 | + global $post, $preview, $wpdb, $send_to_friend; |
|
| 2178 | + |
|
| 2179 | + $payment_info = array(); |
|
| 2180 | + $package_info = array(); |
|
| 2181 | + |
|
| 2182 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 2183 | + $post_package_id = $package_info->pid; |
|
| 2184 | + $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type; |
|
| 2185 | + $send_to_friend = false; |
|
| 2186 | + |
|
| 2187 | + ob_start(); |
|
| 2188 | + $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location); |
|
| 2189 | + |
|
| 2190 | + if (!empty($fields_info)) {
|
|
| 2191 | + //echo '<div class="geodir-company_info field-group">'; |
|
| 2192 | + $field_set_start = 0; |
|
| 2193 | + |
|
| 2266 | 2194 | |
| 2195 | + if ($fields_location == 'detail') |
|
| 2267 | 2196 | |
| 2268 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 2269 | - $field = $type['htmlvar_name'] . '_zip'; |
|
| 2270 | - if ($post->{$field}) {
|
|
| 2271 | - $addition_fields .= ', ' . $post->{$field};
|
|
| 2272 | - } |
|
| 2273 | - } |
|
| 2197 | + $i = 1; |
|
| 2198 | + foreach ($fields_info as $type) {
|
|
| 2199 | + $type = stripslashes_deep($type); // strip slashes |
|
| 2200 | + $html = ''; |
|
| 2201 | + $html_var = ''; |
|
| 2202 | + $field_icon = ''; |
|
| 2274 | 2203 | |
| 2275 | - } |
|
| 2204 | + $variables_array = array(); |
|
| 2276 | 2205 | |
| 2277 | - } |
|
| 2278 | - /*if($type['extra_fields']) |
|
| 2206 | + if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 2207 | + continue; |
|
| 2208 | + } |
|
| 2209 | + |
|
| 2210 | + if ($type['type'] != 'fieldset'): |
|
| 2211 | + $variables_array['post_id'] = $post->ID; |
|
| 2212 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 2213 | + $variables_array['value'] = ''; |
|
| 2214 | + if (isset($post->{$type['htmlvar_name']}))
|
|
| 2215 | + $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 2216 | + endif; |
|
| 2217 | + |
|
| 2218 | + //if($type['field_icon']) |
|
| 2219 | + |
|
| 2220 | + if (strpos($type['field_icon'], 'http') !== false) {
|
|
| 2221 | + $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 2222 | + } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
|
|
| 2223 | + $field_icon = '<i class="' . $type['field_icon'] . '"></i>'; |
|
| 2224 | + } |
|
| 2225 | + //else{$field_icon = $type['field_icon'];}
|
|
| 2226 | + |
|
| 2227 | + |
|
| 2228 | + switch ($type['type']) {
|
|
| 2229 | + |
|
| 2230 | + case 'fieldset': |
|
| 2231 | + |
|
| 2232 | + $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']); |
|
| 2233 | + |
|
| 2234 | + if ($field_set_start == 1) {
|
|
| 2235 | + echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>'; |
|
| 2236 | + } else {
|
|
| 2237 | + echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>'; |
|
| 2238 | + $field_set_start = 1; |
|
| 2239 | + } |
|
| 2240 | + |
|
| 2241 | + break; |
|
| 2242 | + |
|
| 2243 | + case 'address': |
|
| 2244 | + |
|
| 2245 | + $html_var = $type['htmlvar_name'] . '_address'; |
|
| 2246 | + |
|
| 2247 | + if ($type['extra_fields']) {
|
|
| 2248 | + |
|
| 2249 | + $extra_fields = unserialize($type['extra_fields']); |
|
| 2250 | + |
|
| 2251 | + $addition_fields = ''; |
|
| 2252 | + |
|
| 2253 | + if (!empty($extra_fields)) {
|
|
| 2254 | + /** |
|
| 2255 | + * Filter "show city in address" value. |
|
| 2256 | + * |
|
| 2257 | + * @since 1.0.0 |
|
| 2258 | + */ |
|
| 2259 | + $show_city_in_address = apply_filters('geodir_show_city_in_address', false);
|
|
| 2260 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city'] && $show_city_in_address) {
|
|
| 2261 | + $field = $type['htmlvar_name'] . '_city'; |
|
| 2262 | + if ($post->{$field}) {
|
|
| 2263 | + $addition_fields .= ', ' . $post->{$field};
|
|
| 2264 | + } |
|
| 2265 | + } |
|
| 2266 | + |
|
| 2267 | + |
|
| 2268 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 2269 | + $field = $type['htmlvar_name'] . '_zip'; |
|
| 2270 | + if ($post->{$field}) {
|
|
| 2271 | + $addition_fields .= ', ' . $post->{$field};
|
|
| 2272 | + } |
|
| 2273 | + } |
|
| 2274 | + |
|
| 2275 | + } |
|
| 2276 | + |
|
| 2277 | + } |
|
| 2278 | + /*if($type['extra_fields']) |
|
| 2279 | 2279 | {
|
| 2280 | 2280 | |
| 2281 | 2281 | $extra_fields = unserialize($type['extra_fields']); |
@@ -2324,1029 +2324,1029 @@ discard block |
||
| 2324 | 2324 | |
| 2325 | 2325 | }*/ |
| 2326 | 2326 | |
| 2327 | - if ($post->{$html_var}):
|
|
| 2327 | + if ($post->{$html_var}):
|
|
| 2328 | + |
|
| 2329 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2330 | + $field_icon_af = ''; |
|
| 2331 | + } elseif ($field_icon == '') {
|
|
| 2332 | + $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 2333 | + } else {
|
|
| 2334 | + $field_icon_af = $field_icon; |
|
| 2335 | + $field_icon = ''; |
|
| 2336 | + } |
|
| 2337 | + |
|
| 2338 | + $geodir_odd_even = ''; |
|
| 2339 | + if ($fields_location == 'detail') {
|
|
| 2340 | + |
|
| 2341 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2342 | + if ($i % 2 == 0) |
|
| 2343 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2344 | + |
|
| 2345 | + $i++; |
|
| 2346 | + } |
|
| 2347 | + |
|
| 2348 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;" itemscope itemtype="http://schema.org/PostalAddress">'; |
|
| 2349 | + $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2350 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2351 | + $html .= '</span>'; |
|
| 2352 | + |
|
| 2353 | + if ($preview) {
|
|
| 2354 | + $html .= stripslashes($post->{$html_var}) . $addition_fields . '</p></div>';
|
|
| 2355 | + } else {
|
|
| 2356 | + if ($post->post_address) {
|
|
| 2357 | + $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 2358 | + } |
|
| 2359 | + if ($post->post_city) {
|
|
| 2360 | + $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 2361 | + } |
|
| 2362 | + if ($post->post_region) {
|
|
| 2363 | + $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 2364 | + } |
|
| 2365 | + if ($post->post_zip) {
|
|
| 2366 | + $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 2367 | + } |
|
| 2368 | + if ($post->post_country) {
|
|
| 2369 | + $html .= '<span itemprop="addressCountry">' . __($post->post_country, 'geodirectory') . '</span><br>'; |
|
| 2370 | + } |
|
| 2371 | + $html .= '</div>'; |
|
| 2372 | + } |
|
| 2373 | + |
|
| 2328 | 2374 | |
| 2329 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2330 | - $field_icon_af = ''; |
|
| 2331 | - } elseif ($field_icon == '') {
|
|
| 2332 | - $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 2333 | - } else {
|
|
| 2334 | - $field_icon_af = $field_icon; |
|
| 2335 | - $field_icon = ''; |
|
| 2336 | - } |
|
| 2337 | - |
|
| 2338 | - $geodir_odd_even = ''; |
|
| 2339 | - if ($fields_location == 'detail') {
|
|
| 2375 | + endif; |
|
| 2340 | 2376 | |
| 2341 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2342 | - if ($i % 2 == 0) |
|
| 2343 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2377 | + $variables_array['value'] = $post->{$html_var};
|
|
| 2344 | 2378 | |
| 2345 | - $i++; |
|
| 2346 | - } |
|
| 2379 | + break; |
|
| 2347 | 2380 | |
| 2348 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;" itemscope itemtype="http://schema.org/PostalAddress">'; |
|
| 2349 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2350 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2351 | - $html .= '</span>'; |
|
| 2381 | + case 'url': |
|
| 2352 | 2382 | |
| 2353 | - if ($preview) {
|
|
| 2354 | - $html .= stripslashes($post->{$html_var}) . $addition_fields . '</p></div>';
|
|
| 2355 | - } else {
|
|
| 2356 | - if ($post->post_address) {
|
|
| 2357 | - $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 2358 | - } |
|
| 2359 | - if ($post->post_city) {
|
|
| 2360 | - $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 2361 | - } |
|
| 2362 | - if ($post->post_region) {
|
|
| 2363 | - $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 2364 | - } |
|
| 2365 | - if ($post->post_zip) {
|
|
| 2366 | - $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 2367 | - } |
|
| 2368 | - if ($post->post_country) {
|
|
| 2369 | - $html .= '<span itemprop="addressCountry">' . __($post->post_country, 'geodirectory') . '</span><br>'; |
|
| 2370 | - } |
|
| 2371 | - $html .= '</div>'; |
|
| 2372 | - } |
|
| 2383 | + $html_var = $type['htmlvar_name']; |
|
| 2373 | 2384 | |
| 2385 | + if ($post->{$type['htmlvar_name']}):
|
|
| 2374 | 2386 | |
| 2375 | - endif; |
|
| 2387 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2388 | + $field_icon_af = ''; |
|
| 2389 | + } elseif ($field_icon == '') {
|
|
| 2376 | 2390 | |
| 2377 | - $variables_array['value'] = $post->{$html_var};
|
|
| 2391 | + if ($type['name'] == 'geodir_facebook') {
|
|
| 2392 | + $field_icon_af = '<i class="fa fa-facebook-square"></i>'; |
|
| 2393 | + } elseif ($type['name'] == 'geodir_twitter') {
|
|
| 2394 | + $field_icon_af = '<i class="fa fa-twitter-square"></i>'; |
|
| 2395 | + } else {
|
|
| 2396 | + $field_icon_af = '<i class="fa fa-link"></i>'; |
|
| 2397 | + } |
|
| 2398 | + |
|
| 2399 | + } else {
|
|
| 2400 | + $field_icon_af = $field_icon; |
|
| 2401 | + $field_icon = ''; |
|
| 2402 | + } |
|
| 2403 | + |
|
| 2404 | + $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
|
|
| 2405 | + |
|
| 2406 | + |
|
| 2407 | + $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
|
| 2408 | + $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title']; |
|
| 2409 | + if(!empty($type['default_value'])){$title = $type['default_value'];}
|
|
| 2410 | + $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
|
| 2411 | + |
|
| 2412 | + |
|
| 2413 | + $geodir_odd_even = ''; |
|
| 2414 | + if ($fields_location == 'detail') {
|
|
| 2415 | + |
|
| 2416 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2417 | + if ($i % 2 == 0) |
|
| 2418 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2419 | + |
|
| 2420 | + $i++; |
|
| 2421 | + } |
|
| 2422 | + |
|
| 2423 | + |
|
| 2424 | + // all search engines that use the nofollow value exclude links that use it from their ranking calculation |
|
| 2425 | + $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"'; |
|
| 2426 | + /** |
|
| 2427 | + * Filter custom field website name. |
|
| 2428 | + * |
|
| 2429 | + * @since 1.0.0 |
|
| 2430 | + * |
|
| 2431 | + * @param string $title Website Title. |
|
| 2432 | + * @param string $website Website URL. |
|
| 2433 | + * @param int $post->ID Post ID. |
|
| 2434 | + */ |
|
| 2435 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
|
|
| 2436 | + |
|
| 2437 | + endif; |
|
| 2438 | + |
|
| 2439 | + break; |
|
| 2440 | + |
|
| 2441 | + case 'phone': |
|
| 2442 | + |
|
| 2443 | + $html_var = $type['htmlvar_name']; |
|
| 2444 | + |
|
| 2445 | + if ($post->{$type['htmlvar_name']}):
|
|
| 2446 | + |
|
| 2447 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2448 | + $field_icon_af = ''; |
|
| 2449 | + } elseif ($field_icon == '') {
|
|
| 2450 | + $field_icon_af = '<i class="fa fa-phone"></i>'; |
|
| 2451 | + } else {
|
|
| 2452 | + $field_icon_af = $field_icon; |
|
| 2453 | + $field_icon = ''; |
|
| 2454 | + } |
|
| 2455 | + |
|
| 2456 | + $geodir_odd_even = ''; |
|
| 2457 | + if ($fields_location == 'detail') {
|
|
| 2458 | + |
|
| 2459 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2460 | + if ($i % 2 == 0) |
|
| 2461 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2462 | + |
|
| 2463 | + $i++; |
|
| 2464 | + } |
|
| 2465 | + |
|
| 2466 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 2467 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2468 | + $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}) . '">' . stripslashes($post->{$type['htmlvar_name']}) . '</a></div>';
|
|
| 2469 | + |
|
| 2470 | + endif; |
|
| 2471 | + |
|
| 2472 | + break; |
|
| 2473 | + |
|
| 2474 | + case 'time': |
|
| 2475 | + |
|
| 2476 | + $html_var = $type['htmlvar_name']; |
|
| 2477 | + |
|
| 2478 | + if ($post->{$type['htmlvar_name']}):
|
|
| 2479 | + |
|
| 2480 | + $value = ''; |
|
| 2481 | + if ($post->{$type['htmlvar_name']} != '')
|
|
| 2482 | + //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
|
|
| 2483 | + $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
|
|
| 2484 | + |
|
| 2485 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2486 | + $field_icon_af = ''; |
|
| 2487 | + } elseif ($field_icon == '') {
|
|
| 2488 | + $field_icon_af = '<i class="fa fa-clock-o"></i>'; |
|
| 2489 | + } else {
|
|
| 2490 | + $field_icon_af = $field_icon; |
|
| 2491 | + $field_icon = ''; |
|
| 2492 | + } |
|
| 2493 | + |
|
| 2494 | + $geodir_odd_even = ''; |
|
| 2495 | + if ($fields_location == 'detail') {
|
|
| 2496 | + |
|
| 2497 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2498 | + if ($i % 2 == 0) |
|
| 2499 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2500 | + |
|
| 2501 | + $i++; |
|
| 2502 | + } |
|
| 2503 | + |
|
| 2504 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2505 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2506 | + $html .= '</span>' . stripslashes($value) . '</div>'; |
|
| 2507 | + |
|
| 2508 | + endif; |
|
| 2509 | + |
|
| 2510 | + break; |
|
| 2511 | + |
|
| 2512 | + case 'datepicker': |
|
| 2513 | + |
|
| 2514 | + if ($post->{$type['htmlvar_name']}):
|
|
| 2515 | + |
|
| 2516 | + $date_format = geodir_default_date_format(); |
|
| 2517 | + if ($type['extra_fields'] != '') {
|
|
| 2518 | + $date_format = unserialize($type['extra_fields']); |
|
| 2519 | + $date_format = $date_format['date_format']; |
|
| 2520 | + } |
|
| 2521 | + |
|
| 2522 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
|
|
| 2523 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
|
| 2524 | + |
|
| 2525 | + $date_format = str_replace($search, $replace, $date_format); |
|
| 2526 | + |
|
| 2527 | + $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
|
|
| 2528 | + |
|
| 2529 | + $value = ''; |
|
| 2530 | + if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
|
|
| 2531 | + $value = date($date_format, strtotime($post_htmlvar_value)); |
|
| 2532 | + }else{
|
|
| 2533 | + continue; |
|
| 2534 | + } |
|
| 2535 | + |
|
| 2536 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2537 | + $field_icon_af = ''; |
|
| 2538 | + } elseif ($field_icon == '') {
|
|
| 2539 | + $field_icon_af = '<i class="fa fa-calendar"></i>'; |
|
| 2540 | + } else {
|
|
| 2541 | + $field_icon_af = $field_icon; |
|
| 2542 | + $field_icon = ''; |
|
| 2543 | + } |
|
| 2544 | + |
|
| 2545 | + $geodir_odd_even = ''; |
|
| 2546 | + if ($fields_location == 'detail') {
|
|
| 2547 | + |
|
| 2548 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2549 | + if ($i % 2 == 0) |
|
| 2550 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2551 | + |
|
| 2552 | + $i++; |
|
| 2553 | + } |
|
| 2554 | + |
|
| 2555 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2556 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2557 | + $html .= '</span>' . $value . '</div>'; |
|
| 2558 | + |
|
| 2559 | + endif; |
|
| 2560 | + |
|
| 2561 | + break; |
|
| 2562 | + |
|
| 2563 | + case 'text': |
|
| 2564 | + |
|
| 2565 | + $html_var = $type['htmlvar_name']; |
|
| 2566 | + |
|
| 2567 | + if (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']} != '' && $type['htmlvar_name'] == 'geodir_timing'):
|
|
| 2568 | + |
|
| 2569 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2570 | + $field_icon_af = ''; |
|
| 2571 | + } elseif ($field_icon == '') {
|
|
| 2572 | + $field_icon_af = '<i class="fa fa-clock-o"></i>'; |
|
| 2573 | + } else {
|
|
| 2574 | + $field_icon_af = $field_icon; |
|
| 2575 | + $field_icon = ''; |
|
| 2576 | + } |
|
| 2577 | + |
|
| 2578 | + $geodir_odd_even = ''; |
|
| 2579 | + if ($fields_location == 'detail') {
|
|
| 2580 | + |
|
| 2581 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2582 | + if ($i % 2 == 0) |
|
| 2583 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2584 | + |
|
| 2585 | + $i++; |
|
| 2586 | + } |
|
| 2587 | + |
|
| 2588 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2589 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2590 | + $html .= '</span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
|
|
| 2591 | + |
|
| 2592 | + elseif (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']}):
|
|
| 2593 | + |
|
| 2594 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2595 | + $field_icon_af = ''; |
|
| 2596 | + } elseif ($field_icon == '') {
|
|
| 2597 | + $field_icon_af = ''; |
|
| 2598 | + } else {
|
|
| 2599 | + $field_icon_af = $field_icon; |
|
| 2600 | + $field_icon = ''; |
|
| 2601 | + } |
|
| 2602 | + |
|
| 2603 | + $geodir_odd_even = ''; |
|
| 2604 | + if ($fields_location == 'detail') {
|
|
| 2605 | + |
|
| 2606 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2607 | + if ($i % 2 == 0) |
|
| 2608 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2609 | + |
|
| 2610 | + $i++; |
|
| 2611 | + } |
|
| 2612 | + |
|
| 2613 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2614 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2615 | + $html .= '</span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
|
|
| 2616 | + |
|
| 2617 | + endif; |
|
| 2618 | + |
|
| 2619 | + break; |
|
| 2620 | + |
|
| 2621 | + case 'radio': |
|
| 2622 | + |
|
| 2623 | + $html_var = $type['htmlvar_name']; |
|
| 2624 | + if(!isset($post->{$type['htmlvar_name']})){continue;}
|
|
| 2625 | + $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
|
|
| 2626 | + if ($post->{$type['htmlvar_name']} != ''):
|
|
| 2627 | + |
|
| 2628 | + if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
|
|
| 2629 | + $html_val = __('No', 'geodirectory');
|
|
| 2630 | + } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
|
|
| 2631 | + $html_val = __('Yes', 'geodirectory');
|
|
| 2632 | + } else {
|
|
| 2633 | + if (!empty($type['option_values'])) {
|
|
| 2634 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
| 2635 | + |
|
| 2636 | + if (!empty($cf_option_values)) {
|
|
| 2637 | + foreach ($cf_option_values as $cf_option_value) {
|
|
| 2638 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
|
|
| 2639 | + $html_val = $cf_option_value['label']; |
|
| 2640 | + } |
|
| 2641 | + } |
|
| 2642 | + } |
|
| 2643 | + } |
|
| 2644 | + } |
|
| 2645 | + |
|
| 2646 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2647 | + $field_icon_af = ''; |
|
| 2648 | + } elseif ($field_icon == '') {
|
|
| 2649 | + $field_icon_af = ''; |
|
| 2650 | + } else {
|
|
| 2651 | + $field_icon_af = $field_icon; |
|
| 2652 | + $field_icon = ''; |
|
| 2653 | + } |
|
| 2654 | + |
|
| 2655 | + $geodir_odd_even = ''; |
|
| 2656 | + if ($fields_location == 'detail') {
|
|
| 2378 | 2657 | |
| 2379 | - break; |
|
| 2658 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2659 | + if ($i % 2 == 0) |
|
| 2660 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2380 | 2661 | |
| 2381 | - case 'url': |
|
| 2662 | + $i++; |
|
| 2663 | + } |
|
| 2382 | 2664 | |
| 2383 | - $html_var = $type['htmlvar_name']; |
|
| 2665 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2666 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2667 | + $html .= '</span>' . $html_val . '</div>'; |
|
| 2668 | + endif; |
|
| 2384 | 2669 | |
| 2385 | - if ($post->{$type['htmlvar_name']}):
|
|
| 2670 | + break; |
|
| 2386 | 2671 | |
| 2387 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2388 | - $field_icon_af = ''; |
|
| 2389 | - } elseif ($field_icon == '') {
|
|
| 2672 | + case 'checkbox': |
|
| 2390 | 2673 | |
| 2391 | - if ($type['name'] == 'geodir_facebook') {
|
|
| 2392 | - $field_icon_af = '<i class="fa fa-facebook-square"></i>'; |
|
| 2393 | - } elseif ($type['name'] == 'geodir_twitter') {
|
|
| 2394 | - $field_icon_af = '<i class="fa fa-twitter-square"></i>'; |
|
| 2395 | - } else {
|
|
| 2396 | - $field_icon_af = '<i class="fa fa-link"></i>'; |
|
| 2397 | - } |
|
| 2674 | + $html_var = $type['htmlvar_name']; |
|
| 2398 | 2675 | |
| 2399 | - } else {
|
|
| 2400 | - $field_icon_af = $field_icon; |
|
| 2401 | - $field_icon = ''; |
|
| 2402 | - } |
|
| 2676 | + if ((int)$post->{$html_var} == 1):
|
|
| 2403 | 2677 | |
| 2404 | - $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
|
|
| 2678 | + if ($post->{$type['htmlvar_name']} == '1'):
|
|
| 2679 | + $html_val = __('Yes', 'geodirectory');
|
|
| 2680 | + else: |
|
| 2681 | + $html_val = __('No', 'geodirectory');
|
|
| 2682 | + endif; |
|
| 2405 | 2683 | |
| 2684 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2685 | + $field_icon_af = ''; |
|
| 2686 | + } elseif ($field_icon == '') {
|
|
| 2687 | + $field_icon_af = ''; |
|
| 2688 | + } else {
|
|
| 2689 | + $field_icon_af = $field_icon; |
|
| 2690 | + $field_icon = ''; |
|
| 2691 | + } |
|
| 2692 | + |
|
| 2693 | + $geodir_odd_even = ''; |
|
| 2694 | + if ($fields_location == 'detail') {
|
|
| 2695 | + |
|
| 2696 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2697 | + if ($i % 2 == 0) |
|
| 2698 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2699 | + |
|
| 2700 | + $i++; |
|
| 2701 | + } |
|
| 2406 | 2702 | |
| 2407 | - $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
|
| 2408 | - $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title']; |
|
| 2409 | - if(!empty($type['default_value'])){$title = $type['default_value'];}
|
|
| 2410 | - $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
|
| 2703 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2704 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2705 | + $html .= '</span>' . $html_val . '</div>'; |
|
| 2706 | + endif; |
|
| 2707 | + |
|
| 2708 | + break; |
|
| 2709 | + |
|
| 2710 | + case 'select': |
|
| 2711 | + |
|
| 2712 | + $html_var = $type['htmlvar_name']; |
|
| 2713 | + if(!isset($post->{$type['htmlvar_name']})){continue;}
|
|
| 2714 | + if ($post->{$type['htmlvar_name']}):
|
|
| 2715 | + $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
|
|
| 2716 | + |
|
| 2717 | + if (!empty($type['option_values'])) {
|
|
| 2718 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
| 2719 | + |
|
| 2720 | + if (!empty($cf_option_values)) {
|
|
| 2721 | + foreach ($cf_option_values as $cf_option_value) {
|
|
| 2722 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
|
|
| 2723 | + //$field_value = $cf_option_value['label']; // no longer needed here. |
|
| 2724 | + } |
|
| 2725 | + } |
|
| 2726 | + } |
|
| 2727 | + } |
|
| 2728 | + |
|
| 2729 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2730 | + $field_icon_af = ''; |
|
| 2731 | + } elseif ($field_icon == '') {
|
|
| 2732 | + $field_icon_af = ''; |
|
| 2733 | + } else {
|
|
| 2734 | + $field_icon_af = $field_icon; |
|
| 2735 | + $field_icon = ''; |
|
| 2736 | + } |
|
| 2411 | 2737 | |
| 2738 | + $geodir_odd_even = ''; |
|
| 2739 | + if ($fields_location == 'detail') {
|
|
| 2412 | 2740 | |
| 2413 | - $geodir_odd_even = ''; |
|
| 2414 | - if ($fields_location == 'detail') {
|
|
| 2741 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2742 | + if ($i % 2 == 0) |
|
| 2743 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2415 | 2744 | |
| 2416 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2417 | - if ($i % 2 == 0) |
|
| 2418 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2745 | + $i++; |
|
| 2746 | + } |
|
| 2419 | 2747 | |
| 2420 | - $i++; |
|
| 2421 | - } |
|
| 2748 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2749 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2750 | + $html .= '</span>' . $field_value . '</div>'; |
|
| 2751 | + endif; |
|
| 2422 | 2752 | |
| 2753 | + break; |
|
| 2423 | 2754 | |
| 2424 | - // all search engines that use the nofollow value exclude links that use it from their ranking calculation |
|
| 2425 | - $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"'; |
|
| 2426 | - /** |
|
| 2427 | - * Filter custom field website name. |
|
| 2428 | - * |
|
| 2429 | - * @since 1.0.0 |
|
| 2430 | - * |
|
| 2431 | - * @param string $title Website Title. |
|
| 2432 | - * @param string $website Website URL. |
|
| 2433 | - * @param int $post->ID Post ID. |
|
| 2434 | - */ |
|
| 2435 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
|
|
| 2436 | 2755 | |
| 2437 | - endif; |
|
| 2756 | + case 'multiselect': |
|
| 2438 | 2757 | |
| 2439 | - break; |
|
| 2758 | + $html_var = $type['htmlvar_name']; |
|
| 2440 | 2759 | |
| 2441 | - case 'phone': |
|
| 2760 | + if (!empty($post->{$type['htmlvar_name']})):
|
|
| 2442 | 2761 | |
| 2443 | - $html_var = $type['htmlvar_name']; |
|
| 2762 | + if (is_array($post->{$type['htmlvar_name']})) {
|
|
| 2763 | + $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
|
|
| 2764 | + } |
|
| 2444 | 2765 | |
| 2445 | - if ($post->{$type['htmlvar_name']}):
|
|
| 2766 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2767 | + $field_icon_af = ''; |
|
| 2768 | + } elseif ($field_icon == '') {
|
|
| 2769 | + $field_icon_af = ''; |
|
| 2770 | + } else {
|
|
| 2771 | + $field_icon_af = $field_icon; |
|
| 2772 | + $field_icon = ''; |
|
| 2773 | + } |
|
| 2446 | 2774 | |
| 2447 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2448 | - $field_icon_af = ''; |
|
| 2449 | - } elseif ($field_icon == '') {
|
|
| 2450 | - $field_icon_af = '<i class="fa fa-phone"></i>'; |
|
| 2451 | - } else {
|
|
| 2452 | - $field_icon_af = $field_icon; |
|
| 2453 | - $field_icon = ''; |
|
| 2454 | - } |
|
| 2775 | + $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
|
|
| 2455 | 2776 | |
| 2456 | - $geodir_odd_even = ''; |
|
| 2457 | - if ($fields_location == 'detail') {
|
|
| 2777 | + $option_values = array(); |
|
| 2778 | + if (!empty($type['option_values'])) {
|
|
| 2779 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
| 2458 | 2780 | |
| 2459 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2460 | - if ($i % 2 == 0) |
|
| 2461 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2781 | + if (!empty($cf_option_values)) {
|
|
| 2782 | + foreach ($cf_option_values as $cf_option_value) {
|
|
| 2783 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
|
|
| 2784 | + $option_values[] = $cf_option_value['label']; |
|
| 2785 | + } |
|
| 2786 | + } |
|
| 2787 | + } |
|
| 2788 | + } |
|
| 2462 | 2789 | |
| 2463 | - $i++; |
|
| 2464 | - } |
|
| 2790 | + $geodir_odd_even = ''; |
|
| 2791 | + if ($fields_location == 'detail') {
|
|
| 2465 | 2792 | |
| 2466 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 2467 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2468 | - $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}) . '">' . stripslashes($post->{$type['htmlvar_name']}) . '</a></div>';
|
|
| 2793 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2794 | + if ($i % 2 == 0) |
|
| 2795 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2469 | 2796 | |
| 2470 | - endif; |
|
| 2797 | + $i++; |
|
| 2798 | + } |
|
| 2471 | 2799 | |
| 2472 | - break; |
|
| 2800 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2801 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2802 | + $html .= '</span>'; |
|
| 2473 | 2803 | |
| 2474 | - case 'time': |
|
| 2804 | + if (count($option_values) > 1) {
|
|
| 2805 | + $html .= '<ul>'; |
|
| 2475 | 2806 | |
| 2476 | - $html_var = $type['htmlvar_name']; |
|
| 2807 | + foreach ($option_values as $val) {
|
|
| 2808 | + $html .= '<li>' . $val . '</li>'; |
|
| 2809 | + } |
|
| 2477 | 2810 | |
| 2478 | - if ($post->{$type['htmlvar_name']}):
|
|
| 2811 | + $html .= '</ul>'; |
|
| 2812 | + } else {
|
|
| 2813 | + $html .= $post->{$type['htmlvar_name']};
|
|
| 2814 | + } |
|
| 2479 | 2815 | |
| 2480 | - $value = ''; |
|
| 2481 | - if ($post->{$type['htmlvar_name']} != '')
|
|
| 2482 | - //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
|
|
| 2483 | - $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
|
|
| 2816 | + $html .= '</div>'; |
|
| 2817 | + endif; |
|
| 2818 | + break; |
|
| 2819 | + case 'email': |
|
| 2820 | + $html_var = $type['htmlvar_name']; |
|
| 2821 | + if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
|
|
| 2822 | + continue; // Remove Send Enquiry | Send To Friend from listings page |
|
| 2823 | + } |
|
| 2824 | + |
|
| 2825 | + if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
|
|
| 2826 | + $send_to_friend = true; |
|
| 2827 | + $b_send_inquiry = ''; |
|
| 2828 | + $b_sendtofriend = ''; |
|
| 2829 | + |
|
| 2830 | + $html = ''; |
|
| 2831 | + if (!$preview) {
|
|
| 2832 | + $b_send_inquiry = 'b_send_inquiry'; |
|
| 2833 | + $b_sendtofriend = 'b_sendtofriend'; |
|
| 2834 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 2835 | + } |
|
| 2484 | 2836 | |
| 2485 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2486 | - $field_icon_af = ''; |
|
| 2487 | - } elseif ($field_icon == '') {
|
|
| 2488 | - $field_icon_af = '<i class="fa fa-clock-o"></i>'; |
|
| 2489 | - } else {
|
|
| 2490 | - $field_icon_af = $field_icon; |
|
| 2491 | - $field_icon = ''; |
|
| 2492 | - } |
|
| 2837 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2838 | + $field_icon_af = ''; |
|
| 2839 | + } elseif ($field_icon == '') {
|
|
| 2840 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 2841 | + } else {
|
|
| 2842 | + $field_icon_af = $field_icon; |
|
| 2843 | + $field_icon = ''; |
|
| 2844 | + } |
|
| 2493 | 2845 | |
| 2494 | - $geodir_odd_even = ''; |
|
| 2495 | - if ($fields_location == 'detail') {
|
|
| 2846 | + $geodir_odd_even = ''; |
|
| 2847 | + if ($fields_location == 'detail') {
|
|
| 2496 | 2848 | |
| 2497 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2498 | - if ($i % 2 == 0) |
|
| 2499 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2849 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2850 | + if ($i % 2 == 0) |
|
| 2851 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2500 | 2852 | |
| 2501 | - $i++; |
|
| 2502 | - } |
|
| 2853 | + $i++; |
|
| 2854 | + } |
|
| 2503 | 2855 | |
| 2504 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2505 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2506 | - $html .= '</span>' . stripslashes($value) . '</div>'; |
|
| 2856 | + $html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2857 | + $seperator = ''; |
|
| 2858 | + if ($post->{$type['htmlvar_name']}) {
|
|
| 2859 | + $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 2860 | + $seperator = ' | '; |
|
| 2861 | + } |
|
| 2507 | 2862 | |
| 2508 | - endif; |
|
| 2863 | + if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
|
|
| 2864 | + $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 2865 | + } |
|
| 2509 | 2866 | |
| 2510 | - break; |
|
| 2867 | + $html .= '</span></div>'; |
|
| 2511 | 2868 | |
| 2512 | - case 'datepicker': |
|
| 2513 | 2869 | |
| 2514 | - if ($post->{$type['htmlvar_name']}):
|
|
| 2870 | + if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
|
|
| 2871 | + $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 2872 | + } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
|
|
| 2873 | + $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 2874 | + } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
|
|
| 2875 | + $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 2876 | + } |
|
| 2515 | 2877 | |
| 2516 | - $date_format = geodir_default_date_format(); |
|
| 2517 | - if ($type['extra_fields'] != '') {
|
|
| 2518 | - $date_format = unserialize($type['extra_fields']); |
|
| 2519 | - $date_format = $date_format['date_format']; |
|
| 2520 | - } |
|
| 2878 | + /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
|
|
| 2521 | 2879 | |
| 2522 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
|
|
| 2523 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
|
| 2880 | + } else {
|
|
| 2524 | 2881 | |
| 2525 | - $date_format = str_replace($search, $replace, $date_format); |
|
| 2882 | + if ($post->{$type['htmlvar_name']}) {
|
|
| 2883 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2884 | + $field_icon_af = ''; |
|
| 2885 | + } elseif ($field_icon == '') {
|
|
| 2886 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 2887 | + } else {
|
|
| 2888 | + $field_icon_af = $field_icon; |
|
| 2889 | + $field_icon = ''; |
|
| 2890 | + } |
|
| 2526 | 2891 | |
| 2527 | - $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
|
|
| 2892 | + $geodir_odd_even = ''; |
|
| 2893 | + if ($fields_location == 'detail') {
|
|
| 2528 | 2894 | |
| 2529 | - $value = ''; |
|
| 2530 | - if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
|
|
| 2531 | - $value = date($date_format, strtotime($post_htmlvar_value)); |
|
| 2532 | - }else{
|
|
| 2533 | - continue; |
|
| 2534 | - } |
|
| 2895 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2896 | + if ($i % 2 == 0) |
|
| 2897 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2535 | 2898 | |
| 2536 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2537 | - $field_icon_af = ''; |
|
| 2538 | - } elseif ($field_icon == '') {
|
|
| 2539 | - $field_icon_af = '<i class="fa fa-calendar"></i>'; |
|
| 2540 | - } else {
|
|
| 2541 | - $field_icon_af = $field_icon; |
|
| 2542 | - $field_icon = ''; |
|
| 2543 | - } |
|
| 2899 | + $i++; |
|
| 2900 | + } |
|
| 2544 | 2901 | |
| 2545 | - $geodir_odd_even = ''; |
|
| 2546 | - if ($fields_location == 'detail') {
|
|
| 2902 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2903 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2904 | + $html .= '</span><span class="geodir-email-address-output">'; |
|
| 2905 | + $email = stripslashes($post->{$type['htmlvar_name']}) ;
|
|
| 2906 | + if($e_split = explode('@',$email)){
|
|
| 2907 | + /** |
|
| 2908 | + * Filter email custom field name output. |
|
| 2909 | + * |
|
| 2910 | + * @since 1.5.3 |
|
| 2911 | + * |
|
| 2912 | + * @param string $email The email string being output. |
|
| 2913 | + * @param array $type Custom field variables array. |
|
| 2914 | + */ |
|
| 2915 | + $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
|
|
| 2916 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
|
|
| 2917 | + }else{
|
|
| 2918 | + $html .= $email; |
|
| 2919 | + } |
|
| 2920 | + $html .= '</span></div>'; |
|
| 2921 | + } |
|
| 2547 | 2922 | |
| 2548 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2549 | - if ($i % 2 == 0) |
|
| 2550 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2923 | + } |
|
| 2551 | 2924 | |
| 2552 | - $i++; |
|
| 2553 | - } |
|
| 2925 | + break; |
|
| 2554 | 2926 | |
| 2555 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2556 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2557 | - $html .= '</span>' . $value . '</div>'; |
|
| 2558 | 2927 | |
| 2559 | - endif; |
|
| 2928 | + case 'file': |
|
| 2560 | 2929 | |
| 2561 | - break; |
|
| 2930 | + $html_var = $type['htmlvar_name']; |
|
| 2562 | 2931 | |
| 2563 | - case 'text': |
|
| 2932 | + if (!empty($post->{$type['htmlvar_name']})):
|
|
| 2564 | 2933 | |
| 2565 | - $html_var = $type['htmlvar_name']; |
|
| 2934 | + $files = explode(",", $post->{$type['htmlvar_name']});
|
|
| 2935 | + if (!empty($files)): |
|
| 2566 | 2936 | |
| 2567 | - if (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']} != '' && $type['htmlvar_name'] == 'geodir_timing'):
|
|
| 2937 | + $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL; |
|
| 2938 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 2568 | 2939 | |
| 2569 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2570 | - $field_icon_af = ''; |
|
| 2571 | - } elseif ($field_icon == '') {
|
|
| 2572 | - $field_icon_af = '<i class="fa fa-clock-o"></i>'; |
|
| 2573 | - } else {
|
|
| 2574 | - $field_icon_af = $field_icon; |
|
| 2575 | - $field_icon = ''; |
|
| 2576 | - } |
|
| 2940 | + $file_paths = ''; |
|
| 2941 | + foreach ($files as $file) {
|
|
| 2942 | + if (!empty($file)) {
|
|
| 2577 | 2943 | |
| 2578 | - $geodir_odd_even = ''; |
|
| 2579 | - if ($fields_location == 'detail') {
|
|
| 2944 | + // $filetype = wp_check_filetype($file); |
|
| 2580 | 2945 | |
| 2581 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2582 | - if ($i % 2 == 0) |
|
| 2583 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2946 | + $image_name_arr = explode('/', $file);
|
|
| 2947 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 2948 | + $filename = end($image_name_arr); |
|
| 2949 | + $img_name_arr = explode('.', $filename);
|
|
| 2584 | 2950 | |
| 2585 | - $i++; |
|
| 2586 | - } |
|
| 2951 | + $arr_file_type = wp_check_filetype($filename); |
|
| 2952 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 2953 | + continue; |
|
| 2954 | + } |
|
| 2587 | 2955 | |
| 2588 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2589 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2590 | - $html .= '</span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
|
|
| 2956 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 2957 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 2591 | 2958 | |
| 2592 | - elseif (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']}):
|
|
| 2959 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 2960 | + continue; // Invalid file type. |
|
| 2961 | + } |
|
| 2593 | 2962 | |
| 2594 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2595 | - $field_icon_af = ''; |
|
| 2596 | - } elseif ($field_icon == '') {
|
|
| 2597 | - $field_icon_af = ''; |
|
| 2598 | - } else {
|
|
| 2599 | - $field_icon_af = $field_icon; |
|
| 2600 | - $field_icon = ''; |
|
| 2601 | - } |
|
| 2963 | + //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
|
| 2964 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
|
|
| 2602 | 2965 | |
| 2603 | - $geodir_odd_even = ''; |
|
| 2604 | - if ($fields_location == 'detail') {
|
|
| 2966 | + // If the uploaded file is image |
|
| 2967 | + if (in_array($uploaded_file_type, $image_file_types)) {
|
|
| 2968 | + $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 2969 | + $file_paths .= '<a href="'.$file.'">'; |
|
| 2970 | + $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
|
|
| 2971 | + $file_paths .= '</a>'; |
|
| 2972 | + //$file_paths .= '<img src="'.$file.'" />'; |
|
| 2973 | + $file_paths .= '</div>'; |
|
| 2974 | + } else {
|
|
| 2975 | + $ext_path = '_' . $html_var . '_'; |
|
| 2976 | + $filename = explode($ext_path, $filename); |
|
| 2977 | + $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 2978 | + } |
|
| 2979 | + } |
|
| 2980 | + } |
|
| 2605 | 2981 | |
| 2606 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2607 | - if ($i % 2 == 0) |
|
| 2608 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2982 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 2983 | + $field_icon_af = ''; |
|
| 2984 | + } elseif ($field_icon == '') {
|
|
| 2985 | + $field_icon_af = ''; |
|
| 2986 | + } else {
|
|
| 2987 | + $field_icon_af = $field_icon; |
|
| 2988 | + $field_icon = ''; |
|
| 2989 | + } |
|
| 2990 | + |
|
| 2991 | + $geodir_odd_even = ''; |
|
| 2992 | + if ($fields_location == 'detail') {
|
|
| 2993 | + |
|
| 2994 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2995 | + if ($i % 2 == 0) |
|
| 2996 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2997 | + |
|
| 2998 | + $i++; |
|
| 2999 | + } |
|
| 3000 | + |
|
| 3001 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' geodir-custom-file-box ' . $type['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3002 | + $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 3003 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3004 | + $html .= '</span>'; |
|
| 3005 | + $html .= $file_paths . '</div></div>'; |
|
| 3006 | + |
|
| 3007 | + endif; |
|
| 3008 | + endif; |
|
| 3009 | + |
|
| 3010 | + break; |
|
| 3011 | + |
|
| 3012 | + case 'textarea': |
|
| 3013 | + $html_var = $type['htmlvar_name']; |
|
| 3014 | + |
|
| 3015 | + if (!empty($post->{$type['htmlvar_name']})) {
|
|
| 3016 | + |
|
| 3017 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 3018 | + $field_icon_af = ''; |
|
| 3019 | + } elseif ($field_icon == '') {
|
|
| 3020 | + $field_icon_af = ''; |
|
| 3021 | + } else {
|
|
| 3022 | + $field_icon_af = $field_icon; |
|
| 3023 | + $field_icon = ''; |
|
| 3024 | + } |
|
| 3025 | + |
|
| 3026 | + $geodir_odd_even = ''; |
|
| 3027 | + if ($fields_location == 'detail') {
|
|
| 3028 | + |
|
| 3029 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 3030 | + if ($i % 2 == 0) |
|
| 3031 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3032 | + |
|
| 3033 | + $i++; |
|
| 3034 | + } |
|
| 3035 | + |
|
| 3036 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3037 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3038 | + $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
|
|
| 3039 | + |
|
| 3040 | + } |
|
| 3041 | + break; |
|
| 3042 | + |
|
| 3043 | + case 'html': |
|
| 3044 | + if (!empty($post->{$type['htmlvar_name']})) {
|
|
| 3045 | + |
|
| 3046 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 3047 | + $field_icon_af = ''; |
|
| 3048 | + } elseif ($field_icon == '') {
|
|
| 3049 | + $field_icon_af = ''; |
|
| 3050 | + } else {
|
|
| 3051 | + $field_icon_af = $field_icon; |
|
| 3052 | + $field_icon = ''; |
|
| 3053 | + } |
|
| 3054 | + |
|
| 3055 | + $geodir_odd_even = ''; |
|
| 3056 | + if ($fields_location == 'detail') {
|
|
| 3057 | + |
|
| 3058 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 3059 | + if ($i % 2 == 0) |
|
| 3060 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3061 | + |
|
| 3062 | + $i++; |
|
| 3063 | + } |
|
| 3064 | + |
|
| 3065 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3066 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3067 | + $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
|
|
| 3068 | + |
|
| 3069 | + } |
|
| 3070 | + break; |
|
| 3071 | + case 'taxonomy': {
|
|
| 3072 | + $html_var = $type['htmlvar_name']; |
|
| 3073 | + if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
|
|
| 3074 | + $post_taxonomy = $post->post_type . 'category'; |
|
| 3075 | + $field_value = $post->{$html_var};
|
|
| 3076 | + $links = array(); |
|
| 3077 | + $terms = array(); |
|
| 3078 | + $termsOrdered = array(); |
|
| 3079 | + if (!is_array($field_value)) {
|
|
| 3080 | + $field_value = explode(",", trim($field_value, ","));
|
|
| 3081 | + } |
|
| 3082 | + |
|
| 3083 | + $field_value = array_unique($field_value); |
|
| 3084 | + |
|
| 3085 | + if (!empty($field_value)) {
|
|
| 3086 | + foreach ($field_value as $term) {
|
|
| 3087 | + $term = trim($term); |
|
| 3088 | + |
|
| 3089 | + if ($term != '') {
|
|
| 3090 | + $term = get_term_by('id', $term, $html_var);
|
|
| 3091 | + if (is_object($term)) {
|
|
| 3092 | + $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 3093 | + $terms[] = $term; |
|
| 3094 | + } |
|
| 3095 | + } |
|
| 3096 | + } |
|
| 3097 | + if (!empty($links)) {
|
|
| 3098 | + // order alphabetically |
|
| 3099 | + asort($links); |
|
| 3100 | + foreach (array_keys($links) as $key) {
|
|
| 3101 | + $termsOrdered[$key] = $terms[$key]; |
|
| 3102 | + } |
|
| 3103 | + $terms = $termsOrdered; |
|
| 3104 | + } |
|
| 3105 | + } |
|
| 3106 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
|
|
| 3107 | + |
|
| 3108 | + if ($html_value != '') {
|
|
| 3109 | + if (strpos($field_icon, 'http') !== false) {
|
|
| 3110 | + $field_icon_af = ''; |
|
| 3111 | + } else if ($field_icon == '') {
|
|
| 3112 | + $field_icon_af = ''; |
|
| 3113 | + } else {
|
|
| 3114 | + $field_icon_af = $field_icon; |
|
| 3115 | + $field_icon = ''; |
|
| 3116 | + } |
|
| 3117 | + |
|
| 3118 | + $geodir_odd_even = ''; |
|
| 3119 | + if ($fields_location == 'detail') {
|
|
| 3120 | + $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 3121 | + if ($i % 2 == 0) {
|
|
| 3122 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3123 | + } |
|
| 3124 | + $i++; |
|
| 3125 | + } |
|
| 3126 | + |
|
| 3127 | + $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3128 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3129 | + $html .= '</span> ' . $html_value . '</div>'; |
|
| 3130 | + } |
|
| 3131 | + } |
|
| 3132 | + } |
|
| 3133 | + break; |
|
| 2609 | 3134 | |
| 2610 | - $i++; |
|
| 2611 | - } |
|
| 3135 | + } |
|
| 2612 | 3136 | |
| 2613 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2614 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2615 | - $html .= '</span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
|
|
| 3137 | + if ($html): |
|
| 2616 | 3138 | |
| 2617 | - endif; |
|
| 3139 | + /** |
|
| 3140 | + * Called before a custom fields is output on the frontend. |
|
| 3141 | + * |
|
| 3142 | + * @since 1.0.0 |
|
| 3143 | + * @param string $html_var The HTML variable name for the field. |
|
| 3144 | + */ |
|
| 3145 | + do_action("geodir_before_show_{$html_var}");
|
|
| 3146 | + /** |
|
| 3147 | + * Filter custom field output. |
|
| 3148 | + * |
|
| 3149 | + * @since 1.0.0 |
|
| 3150 | + * |
|
| 3151 | + * @param string $html_var The HTML variable name for the field. |
|
| 3152 | + * @param string $html Custom field unfiltered HTML. |
|
| 3153 | + * @param array $variables_array Custom field variables array. |
|
| 3154 | + */ |
|
| 3155 | + if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 2618 | 3156 | |
| 2619 | - break; |
|
| 3157 | + /** |
|
| 3158 | + * Called after a custom fields is output on the frontend. |
|
| 3159 | + * |
|
| 3160 | + * @since 1.0.0 |
|
| 3161 | + * @param string $html_var The HTML variable name for the field. |
|
| 3162 | + */ |
|
| 3163 | + do_action("geodir_after_show_{$html_var}");
|
|
| 2620 | 3164 | |
| 2621 | - case 'radio': |
|
| 3165 | + endif; |
|
| 2622 | 3166 | |
| 2623 | - $html_var = $type['htmlvar_name']; |
|
| 2624 | - if(!isset($post->{$type['htmlvar_name']})){continue;}
|
|
| 2625 | - $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
|
|
| 2626 | - if ($post->{$type['htmlvar_name']} != ''):
|
|
| 2627 | - |
|
| 2628 | - if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
|
|
| 2629 | - $html_val = __('No', 'geodirectory');
|
|
| 2630 | - } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
|
|
| 2631 | - $html_val = __('Yes', 'geodirectory');
|
|
| 2632 | - } else {
|
|
| 2633 | - if (!empty($type['option_values'])) {
|
|
| 2634 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
| 2635 | - |
|
| 2636 | - if (!empty($cf_option_values)) {
|
|
| 2637 | - foreach ($cf_option_values as $cf_option_value) {
|
|
| 2638 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
|
|
| 2639 | - $html_val = $cf_option_value['label']; |
|
| 2640 | - } |
|
| 2641 | - } |
|
| 2642 | - } |
|
| 2643 | - } |
|
| 2644 | - } |
|
| 2645 | - |
|
| 2646 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2647 | - $field_icon_af = ''; |
|
| 2648 | - } elseif ($field_icon == '') {
|
|
| 2649 | - $field_icon_af = ''; |
|
| 2650 | - } else {
|
|
| 2651 | - $field_icon_af = $field_icon; |
|
| 2652 | - $field_icon = ''; |
|
| 2653 | - } |
|
| 3167 | + } |
|
| 2654 | 3168 | |
| 2655 | - $geodir_odd_even = ''; |
|
| 2656 | - if ($fields_location == 'detail') {
|
|
| 3169 | + //echo '</div>'; |
|
| 2657 | 3170 | |
| 2658 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2659 | - if ($i % 2 == 0) |
|
| 2660 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3171 | + } |
|
| 2661 | 3172 | |
| 2662 | - $i++; |
|
| 2663 | - } |
|
| 2664 | 3173 | |
| 2665 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2666 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2667 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 2668 | - endif; |
|
| 2669 | - |
|
| 2670 | - break; |
|
| 2671 | - |
|
| 2672 | - case 'checkbox': |
|
| 2673 | - |
|
| 2674 | - $html_var = $type['htmlvar_name']; |
|
| 2675 | - |
|
| 2676 | - if ((int)$post->{$html_var} == 1):
|
|
| 3174 | + return $html = ob_get_clean(); |
|
| 2677 | 3175 | |
| 2678 | - if ($post->{$type['htmlvar_name']} == '1'):
|
|
| 2679 | - $html_val = __('Yes', 'geodirectory');
|
|
| 2680 | - else: |
|
| 2681 | - $html_val = __('No', 'geodirectory');
|
|
| 2682 | - endif; |
|
| 2683 | - |
|
| 2684 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2685 | - $field_icon_af = ''; |
|
| 2686 | - } elseif ($field_icon == '') {
|
|
| 2687 | - $field_icon_af = ''; |
|
| 2688 | - } else {
|
|
| 2689 | - $field_icon_af = $field_icon; |
|
| 2690 | - $field_icon = ''; |
|
| 2691 | - } |
|
| 2692 | - |
|
| 2693 | - $geodir_odd_even = ''; |
|
| 2694 | - if ($fields_location == 'detail') {
|
|
| 2695 | - |
|
| 2696 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2697 | - if ($i % 2 == 0) |
|
| 2698 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2699 | - |
|
| 2700 | - $i++; |
|
| 2701 | - } |
|
| 2702 | - |
|
| 2703 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2704 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2705 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 2706 | - endif; |
|
| 2707 | - |
|
| 2708 | - break; |
|
| 2709 | - |
|
| 2710 | - case 'select': |
|
| 2711 | - |
|
| 2712 | - $html_var = $type['htmlvar_name']; |
|
| 2713 | - if(!isset($post->{$type['htmlvar_name']})){continue;}
|
|
| 2714 | - if ($post->{$type['htmlvar_name']}):
|
|
| 2715 | - $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
|
|
| 2716 | - |
|
| 2717 | - if (!empty($type['option_values'])) {
|
|
| 2718 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
| 2719 | - |
|
| 2720 | - if (!empty($cf_option_values)) {
|
|
| 2721 | - foreach ($cf_option_values as $cf_option_value) {
|
|
| 2722 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
|
|
| 2723 | - //$field_value = $cf_option_value['label']; // no longer needed here. |
|
| 2724 | - } |
|
| 2725 | - } |
|
| 2726 | - } |
|
| 2727 | - } |
|
| 2728 | - |
|
| 2729 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2730 | - $field_icon_af = ''; |
|
| 2731 | - } elseif ($field_icon == '') {
|
|
| 2732 | - $field_icon_af = ''; |
|
| 2733 | - } else {
|
|
| 2734 | - $field_icon_af = $field_icon; |
|
| 2735 | - $field_icon = ''; |
|
| 2736 | - } |
|
| 2737 | - |
|
| 2738 | - $geodir_odd_even = ''; |
|
| 2739 | - if ($fields_location == 'detail') {
|
|
| 2740 | - |
|
| 2741 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2742 | - if ($i % 2 == 0) |
|
| 2743 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2744 | - |
|
| 2745 | - $i++; |
|
| 2746 | - } |
|
| 2747 | - |
|
| 2748 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2749 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2750 | - $html .= '</span>' . $field_value . '</div>'; |
|
| 2751 | - endif; |
|
| 2752 | - |
|
| 2753 | - break; |
|
| 2754 | - |
|
| 2755 | - |
|
| 2756 | - case 'multiselect': |
|
| 2757 | - |
|
| 2758 | - $html_var = $type['htmlvar_name']; |
|
| 2759 | - |
|
| 2760 | - if (!empty($post->{$type['htmlvar_name']})):
|
|
| 2761 | - |
|
| 2762 | - if (is_array($post->{$type['htmlvar_name']})) {
|
|
| 2763 | - $post->{$type['htmlvar_name']} = implode(', ', $post->{$type['htmlvar_name']});
|
|
| 2764 | - } |
|
| 2765 | - |
|
| 2766 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2767 | - $field_icon_af = ''; |
|
| 2768 | - } elseif ($field_icon == '') {
|
|
| 2769 | - $field_icon_af = ''; |
|
| 2770 | - } else {
|
|
| 2771 | - $field_icon_af = $field_icon; |
|
| 2772 | - $field_icon = ''; |
|
| 2773 | - } |
|
| 2774 | - |
|
| 2775 | - $field_values = explode(',', trim($post->{$type['htmlvar_name']}, ","));
|
|
| 2776 | - |
|
| 2777 | - $option_values = array(); |
|
| 2778 | - if (!empty($type['option_values'])) {
|
|
| 2779 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true); |
|
| 2780 | - |
|
| 2781 | - if (!empty($cf_option_values)) {
|
|
| 2782 | - foreach ($cf_option_values as $cf_option_value) {
|
|
| 2783 | - if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
|
|
| 2784 | - $option_values[] = $cf_option_value['label']; |
|
| 2785 | - } |
|
| 2786 | - } |
|
| 2787 | - } |
|
| 2788 | - } |
|
| 2789 | - |
|
| 2790 | - $geodir_odd_even = ''; |
|
| 2791 | - if ($fields_location == 'detail') {
|
|
| 2792 | - |
|
| 2793 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2794 | - if ($i % 2 == 0) |
|
| 2795 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2796 | - |
|
| 2797 | - $i++; |
|
| 2798 | - } |
|
| 2799 | - |
|
| 2800 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2801 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2802 | - $html .= '</span>'; |
|
| 2803 | - |
|
| 2804 | - if (count($option_values) > 1) {
|
|
| 2805 | - $html .= '<ul>'; |
|
| 2806 | - |
|
| 2807 | - foreach ($option_values as $val) {
|
|
| 2808 | - $html .= '<li>' . $val . '</li>'; |
|
| 2809 | - } |
|
| 2810 | - |
|
| 2811 | - $html .= '</ul>'; |
|
| 2812 | - } else {
|
|
| 2813 | - $html .= $post->{$type['htmlvar_name']};
|
|
| 2814 | - } |
|
| 2815 | - |
|
| 2816 | - $html .= '</div>'; |
|
| 2817 | - endif; |
|
| 2818 | - break; |
|
| 2819 | - case 'email': |
|
| 2820 | - $html_var = $type['htmlvar_name']; |
|
| 2821 | - if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
|
|
| 2822 | - continue; // Remove Send Enquiry | Send To Friend from listings page |
|
| 2823 | - } |
|
| 2824 | - |
|
| 2825 | - if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
|
|
| 2826 | - $send_to_friend = true; |
|
| 2827 | - $b_send_inquiry = ''; |
|
| 2828 | - $b_sendtofriend = ''; |
|
| 2829 | - |
|
| 2830 | - $html = ''; |
|
| 2831 | - if (!$preview) {
|
|
| 2832 | - $b_send_inquiry = 'b_send_inquiry'; |
|
| 2833 | - $b_sendtofriend = 'b_sendtofriend'; |
|
| 2834 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 2835 | - } |
|
| 2836 | - |
|
| 2837 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2838 | - $field_icon_af = ''; |
|
| 2839 | - } elseif ($field_icon == '') {
|
|
| 2840 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 2841 | - } else {
|
|
| 2842 | - $field_icon_af = $field_icon; |
|
| 2843 | - $field_icon = ''; |
|
| 2844 | - } |
|
| 2845 | - |
|
| 2846 | - $geodir_odd_even = ''; |
|
| 2847 | - if ($fields_location == 'detail') {
|
|
| 2848 | - |
|
| 2849 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2850 | - if ($i % 2 == 0) |
|
| 2851 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2852 | - |
|
| 2853 | - $i++; |
|
| 2854 | - } |
|
| 2855 | - |
|
| 2856 | - $html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2857 | - $seperator = ''; |
|
| 2858 | - if ($post->{$type['htmlvar_name']}) {
|
|
| 2859 | - $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 2860 | - $seperator = ' | '; |
|
| 2861 | - } |
|
| 2862 | - |
|
| 2863 | - if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
|
|
| 2864 | - $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 2865 | - } |
|
| 2866 | - |
|
| 2867 | - $html .= '</span></div>'; |
|
| 2868 | - |
|
| 2869 | - |
|
| 2870 | - if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
|
|
| 2871 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 2872 | - } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
|
|
| 2873 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 2874 | - } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
|
|
| 2875 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 2876 | - } |
|
| 2877 | - |
|
| 2878 | - /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
|
|
| 2879 | - |
|
| 2880 | - } else {
|
|
| 2881 | - |
|
| 2882 | - if ($post->{$type['htmlvar_name']}) {
|
|
| 2883 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2884 | - $field_icon_af = ''; |
|
| 2885 | - } elseif ($field_icon == '') {
|
|
| 2886 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 2887 | - } else {
|
|
| 2888 | - $field_icon_af = $field_icon; |
|
| 2889 | - $field_icon = ''; |
|
| 2890 | - } |
|
| 2891 | - |
|
| 2892 | - $geodir_odd_even = ''; |
|
| 2893 | - if ($fields_location == 'detail') {
|
|
| 2894 | - |
|
| 2895 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2896 | - if ($i % 2 == 0) |
|
| 2897 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2898 | - |
|
| 2899 | - $i++; |
|
| 2900 | - } |
|
| 2901 | - |
|
| 2902 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2903 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2904 | - $html .= '</span><span class="geodir-email-address-output">'; |
|
| 2905 | - $email = stripslashes($post->{$type['htmlvar_name']}) ;
|
|
| 2906 | - if($e_split = explode('@',$email)){
|
|
| 2907 | - /** |
|
| 2908 | - * Filter email custom field name output. |
|
| 2909 | - * |
|
| 2910 | - * @since 1.5.3 |
|
| 2911 | - * |
|
| 2912 | - * @param string $email The email string being output. |
|
| 2913 | - * @param array $type Custom field variables array. |
|
| 2914 | - */ |
|
| 2915 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
|
|
| 2916 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
|
|
| 2917 | - }else{
|
|
| 2918 | - $html .= $email; |
|
| 2919 | - } |
|
| 2920 | - $html .= '</span></div>'; |
|
| 2921 | - } |
|
| 2922 | - |
|
| 2923 | - } |
|
| 2924 | - |
|
| 2925 | - break; |
|
| 2926 | - |
|
| 2927 | - |
|
| 2928 | - case 'file': |
|
| 2929 | - |
|
| 2930 | - $html_var = $type['htmlvar_name']; |
|
| 2931 | - |
|
| 2932 | - if (!empty($post->{$type['htmlvar_name']})):
|
|
| 2933 | - |
|
| 2934 | - $files = explode(",", $post->{$type['htmlvar_name']});
|
|
| 2935 | - if (!empty($files)): |
|
| 2936 | - |
|
| 2937 | - $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL; |
|
| 2938 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 2939 | - |
|
| 2940 | - $file_paths = ''; |
|
| 2941 | - foreach ($files as $file) {
|
|
| 2942 | - if (!empty($file)) {
|
|
| 2943 | - |
|
| 2944 | - // $filetype = wp_check_filetype($file); |
|
| 2945 | - |
|
| 2946 | - $image_name_arr = explode('/', $file);
|
|
| 2947 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 2948 | - $filename = end($image_name_arr); |
|
| 2949 | - $img_name_arr = explode('.', $filename);
|
|
| 2950 | - |
|
| 2951 | - $arr_file_type = wp_check_filetype($filename); |
|
| 2952 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 2953 | - continue; |
|
| 2954 | - } |
|
| 2955 | - |
|
| 2956 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 2957 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 2958 | - |
|
| 2959 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 2960 | - continue; // Invalid file type. |
|
| 2961 | - } |
|
| 2962 | - |
|
| 2963 | - //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
|
| 2964 | - $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
|
|
| 2965 | - |
|
| 2966 | - // If the uploaded file is image |
|
| 2967 | - if (in_array($uploaded_file_type, $image_file_types)) {
|
|
| 2968 | - $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 2969 | - $file_paths .= '<a href="'.$file.'">'; |
|
| 2970 | - $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
|
|
| 2971 | - $file_paths .= '</a>'; |
|
| 2972 | - //$file_paths .= '<img src="'.$file.'" />'; |
|
| 2973 | - $file_paths .= '</div>'; |
|
| 2974 | - } else {
|
|
| 2975 | - $ext_path = '_' . $html_var . '_'; |
|
| 2976 | - $filename = explode($ext_path, $filename); |
|
| 2977 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 2978 | - } |
|
| 2979 | - } |
|
| 2980 | - } |
|
| 2981 | - |
|
| 2982 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 2983 | - $field_icon_af = ''; |
|
| 2984 | - } elseif ($field_icon == '') {
|
|
| 2985 | - $field_icon_af = ''; |
|
| 2986 | - } else {
|
|
| 2987 | - $field_icon_af = $field_icon; |
|
| 2988 | - $field_icon = ''; |
|
| 2989 | - } |
|
| 2990 | - |
|
| 2991 | - $geodir_odd_even = ''; |
|
| 2992 | - if ($fields_location == 'detail') {
|
|
| 2993 | - |
|
| 2994 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 2995 | - if ($i % 2 == 0) |
|
| 2996 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2997 | - |
|
| 2998 | - $i++; |
|
| 2999 | - } |
|
| 3000 | - |
|
| 3001 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' geodir-custom-file-box ' . $type['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3002 | - $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 3003 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3004 | - $html .= '</span>'; |
|
| 3005 | - $html .= $file_paths . '</div></div>'; |
|
| 3006 | - |
|
| 3007 | - endif; |
|
| 3008 | - endif; |
|
| 3009 | - |
|
| 3010 | - break; |
|
| 3011 | - |
|
| 3012 | - case 'textarea': |
|
| 3013 | - $html_var = $type['htmlvar_name']; |
|
| 3014 | - |
|
| 3015 | - if (!empty($post->{$type['htmlvar_name']})) {
|
|
| 3016 | - |
|
| 3017 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 3018 | - $field_icon_af = ''; |
|
| 3019 | - } elseif ($field_icon == '') {
|
|
| 3020 | - $field_icon_af = ''; |
|
| 3021 | - } else {
|
|
| 3022 | - $field_icon_af = $field_icon; |
|
| 3023 | - $field_icon = ''; |
|
| 3024 | - } |
|
| 3025 | - |
|
| 3026 | - $geodir_odd_even = ''; |
|
| 3027 | - if ($fields_location == 'detail') {
|
|
| 3028 | - |
|
| 3029 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 3030 | - if ($i % 2 == 0) |
|
| 3031 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3032 | - |
|
| 3033 | - $i++; |
|
| 3034 | - } |
|
| 3035 | - |
|
| 3036 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3037 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3038 | - $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
|
|
| 3039 | - |
|
| 3040 | - } |
|
| 3041 | - break; |
|
| 3042 | - |
|
| 3043 | - case 'html': |
|
| 3044 | - if (!empty($post->{$type['htmlvar_name']})) {
|
|
| 3045 | - |
|
| 3046 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 3047 | - $field_icon_af = ''; |
|
| 3048 | - } elseif ($field_icon == '') {
|
|
| 3049 | - $field_icon_af = ''; |
|
| 3050 | - } else {
|
|
| 3051 | - $field_icon_af = $field_icon; |
|
| 3052 | - $field_icon = ''; |
|
| 3053 | - } |
|
| 3054 | - |
|
| 3055 | - $geodir_odd_even = ''; |
|
| 3056 | - if ($fields_location == 'detail') {
|
|
| 3057 | - |
|
| 3058 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 3059 | - if ($i % 2 == 0) |
|
| 3060 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3061 | - |
|
| 3062 | - $i++; |
|
| 3063 | - } |
|
| 3064 | - |
|
| 3065 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3066 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3067 | - $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
|
|
| 3068 | - |
|
| 3069 | - } |
|
| 3070 | - break; |
|
| 3071 | - case 'taxonomy': {
|
|
| 3072 | - $html_var = $type['htmlvar_name']; |
|
| 3073 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
|
|
| 3074 | - $post_taxonomy = $post->post_type . 'category'; |
|
| 3075 | - $field_value = $post->{$html_var};
|
|
| 3076 | - $links = array(); |
|
| 3077 | - $terms = array(); |
|
| 3078 | - $termsOrdered = array(); |
|
| 3079 | - if (!is_array($field_value)) {
|
|
| 3080 | - $field_value = explode(",", trim($field_value, ","));
|
|
| 3081 | - } |
|
| 3082 | - |
|
| 3083 | - $field_value = array_unique($field_value); |
|
| 3084 | - |
|
| 3085 | - if (!empty($field_value)) {
|
|
| 3086 | - foreach ($field_value as $term) {
|
|
| 3087 | - $term = trim($term); |
|
| 3088 | - |
|
| 3089 | - if ($term != '') {
|
|
| 3090 | - $term = get_term_by('id', $term, $html_var);
|
|
| 3091 | - if (is_object($term)) {
|
|
| 3092 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 3093 | - $terms[] = $term; |
|
| 3094 | - } |
|
| 3095 | - } |
|
| 3096 | - } |
|
| 3097 | - if (!empty($links)) {
|
|
| 3098 | - // order alphabetically |
|
| 3099 | - asort($links); |
|
| 3100 | - foreach (array_keys($links) as $key) {
|
|
| 3101 | - $termsOrdered[$key] = $terms[$key]; |
|
| 3102 | - } |
|
| 3103 | - $terms = $termsOrdered; |
|
| 3104 | - } |
|
| 3105 | - } |
|
| 3106 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
|
|
| 3107 | - |
|
| 3108 | - if ($html_value != '') {
|
|
| 3109 | - if (strpos($field_icon, 'http') !== false) {
|
|
| 3110 | - $field_icon_af = ''; |
|
| 3111 | - } else if ($field_icon == '') {
|
|
| 3112 | - $field_icon_af = ''; |
|
| 3113 | - } else {
|
|
| 3114 | - $field_icon_af = $field_icon; |
|
| 3115 | - $field_icon = ''; |
|
| 3116 | - } |
|
| 3117 | - |
|
| 3118 | - $geodir_odd_even = ''; |
|
| 3119 | - if ($fields_location == 'detail') {
|
|
| 3120 | - $geodir_odd_even = 'geodir_more_info_odd'; |
|
| 3121 | - if ($i % 2 == 0) {
|
|
| 3122 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3123 | - } |
|
| 3124 | - $i++; |
|
| 3125 | - } |
|
| 3126 | - |
|
| 3127 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3128 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3129 | - $html .= '</span> ' . $html_value . '</div>'; |
|
| 3130 | - } |
|
| 3131 | - } |
|
| 3132 | - } |
|
| 3133 | - break; |
|
| 3134 | - |
|
| 3135 | - } |
|
| 3136 | - |
|
| 3137 | - if ($html): |
|
| 3138 | - |
|
| 3139 | - /** |
|
| 3140 | - * Called before a custom fields is output on the frontend. |
|
| 3141 | - * |
|
| 3142 | - * @since 1.0.0 |
|
| 3143 | - * @param string $html_var The HTML variable name for the field. |
|
| 3144 | - */ |
|
| 3145 | - do_action("geodir_before_show_{$html_var}");
|
|
| 3146 | - /** |
|
| 3147 | - * Filter custom field output. |
|
| 3148 | - * |
|
| 3149 | - * @since 1.0.0 |
|
| 3150 | - * |
|
| 3151 | - * @param string $html_var The HTML variable name for the field. |
|
| 3152 | - * @param string $html Custom field unfiltered HTML. |
|
| 3153 | - * @param array $variables_array Custom field variables array. |
|
| 3154 | - */ |
|
| 3155 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 3156 | - |
|
| 3157 | - /** |
|
| 3158 | - * Called after a custom fields is output on the frontend. |
|
| 3159 | - * |
|
| 3160 | - * @since 1.0.0 |
|
| 3161 | - * @param string $html_var The HTML variable name for the field. |
|
| 3162 | - */ |
|
| 3163 | - do_action("geodir_after_show_{$html_var}");
|
|
| 3164 | - |
|
| 3165 | - endif; |
|
| 3166 | - |
|
| 3167 | - } |
|
| 3168 | - |
|
| 3169 | - //echo '</div>'; |
|
| 3170 | - |
|
| 3171 | - } |
|
| 3172 | - |
|
| 3173 | - |
|
| 3174 | - return $html = ob_get_clean(); |
|
| 3175 | - |
|
| 3176 | - } |
|
| 3176 | + } |
|
| 3177 | 3177 | } |
| 3178 | 3178 | |
| 3179 | 3179 | if (!function_exists('geodir_default_date_format')) {
|
| 3180 | - /** |
|
| 3181 | - * Returns default date format. |
|
| 3182 | - * |
|
| 3183 | - * @since 1.0.0 |
|
| 3184 | - * @package GeoDirectory |
|
| 3185 | - * @return mixed|string|void Returns default date format. |
|
| 3186 | - */ |
|
| 3187 | - function geodir_default_date_format() |
|
| 3188 | - {
|
|
| 3189 | - if ($format = get_option('date_format'))
|
|
| 3190 | - return $format; |
|
| 3191 | - else |
|
| 3192 | - return 'dd-mm-yy'; |
|
| 3193 | - } |
|
| 3180 | + /** |
|
| 3181 | + * Returns default date format. |
|
| 3182 | + * |
|
| 3183 | + * @since 1.0.0 |
|
| 3184 | + * @package GeoDirectory |
|
| 3185 | + * @return mixed|string|void Returns default date format. |
|
| 3186 | + */ |
|
| 3187 | + function geodir_default_date_format() |
|
| 3188 | + {
|
|
| 3189 | + if ($format = get_option('date_format'))
|
|
| 3190 | + return $format; |
|
| 3191 | + else |
|
| 3192 | + return 'dd-mm-yy'; |
|
| 3193 | + } |
|
| 3194 | 3194 | } |
| 3195 | 3195 | |
| 3196 | 3196 | if (!function_exists('geodir_get_formated_date')) {
|
| 3197 | - /** |
|
| 3198 | - * Returns formatted date. |
|
| 3199 | - * |
|
| 3200 | - * @since 1.0.0 |
|
| 3201 | - * @package GeoDirectory |
|
| 3202 | - * @param string $date Date string to convert. |
|
| 3203 | - * @return bool|int|string Returns formatted date. |
|
| 3204 | - */ |
|
| 3205 | - function geodir_get_formated_date($date) |
|
| 3206 | - {
|
|
| 3207 | - return mysql2date(get_option('date_format'), $date);
|
|
| 3208 | - } |
|
| 3197 | + /** |
|
| 3198 | + * Returns formatted date. |
|
| 3199 | + * |
|
| 3200 | + * @since 1.0.0 |
|
| 3201 | + * @package GeoDirectory |
|
| 3202 | + * @param string $date Date string to convert. |
|
| 3203 | + * @return bool|int|string Returns formatted date. |
|
| 3204 | + */ |
|
| 3205 | + function geodir_get_formated_date($date) |
|
| 3206 | + {
|
|
| 3207 | + return mysql2date(get_option('date_format'), $date);
|
|
| 3208 | + } |
|
| 3209 | 3209 | } |
| 3210 | 3210 | |
| 3211 | 3211 | if (!function_exists('geodir_get_formated_time')) {
|
| 3212 | - /** |
|
| 3213 | - * Returns formatted time. |
|
| 3214 | - * |
|
| 3215 | - * @since 1.0.0 |
|
| 3216 | - * @package GeoDirectory |
|
| 3217 | - * @param string $time Time string to convert. |
|
| 3218 | - * @return bool|int|string Returns formatted time. |
|
| 3219 | - */ |
|
| 3220 | - function geodir_get_formated_time($time) |
|
| 3221 | - {
|
|
| 3222 | - return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 3223 | - } |
|
| 3212 | + /** |
|
| 3213 | + * Returns formatted time. |
|
| 3214 | + * |
|
| 3215 | + * @since 1.0.0 |
|
| 3216 | + * @package GeoDirectory |
|
| 3217 | + * @param string $time Time string to convert. |
|
| 3218 | + * @return bool|int|string Returns formatted time. |
|
| 3219 | + */ |
|
| 3220 | + function geodir_get_formated_time($time) |
|
| 3221 | + {
|
|
| 3222 | + return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 3223 | + } |
|
| 3224 | 3224 | } |
| 3225 | 3225 | |
| 3226 | 3226 | |
| 3227 | 3227 | if (!function_exists('geodir_save_post_file_fields')) {
|
| 3228 | - /** |
|
| 3229 | - * Save post file fields |
|
| 3230 | - * |
|
| 3231 | - * @since 1.0.0 |
|
| 3232 | - * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 3233 | - * @package GeoDirectory |
|
| 3234 | - * @global object $wpdb WordPress Database object. |
|
| 3235 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 3236 | - * @global object $current_user Current user object. |
|
| 3237 | - * @param int $post_id |
|
| 3238 | - * @param string $field_id |
|
| 3239 | - * @param array $post_image |
|
| 3240 | - * @param array $extra_fields Array of extra fields. |
|
| 3241 | - */ |
|
| 3242 | - function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 3243 | - {
|
|
| 3228 | + /** |
|
| 3229 | + * Save post file fields |
|
| 3230 | + * |
|
| 3231 | + * @since 1.0.0 |
|
| 3232 | + * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 3233 | + * @package GeoDirectory |
|
| 3234 | + * @global object $wpdb WordPress Database object. |
|
| 3235 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 3236 | + * @global object $current_user Current user object. |
|
| 3237 | + * @param int $post_id |
|
| 3238 | + * @param string $field_id |
|
| 3239 | + * @param array $post_image |
|
| 3240 | + * @param array $extra_fields Array of extra fields. |
|
| 3241 | + */ |
|
| 3242 | + function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 3243 | + {
|
|
| 3244 | 3244 | |
| 3245 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 3245 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 3246 | 3246 | |
| 3247 | - $post_type = get_post_type($post_id); |
|
| 3248 | - //echo $field_id; exit; |
|
| 3249 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3247 | + $post_type = get_post_type($post_id); |
|
| 3248 | + //echo $field_id; exit; |
|
| 3249 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3250 | 3250 | |
| 3251 | - $postcurr_images = array(); |
|
| 3252 | - $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 3253 | - $file_urls = ''; |
|
| 3251 | + $postcurr_images = array(); |
|
| 3252 | + $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 3253 | + $file_urls = ''; |
|
| 3254 | 3254 | |
| 3255 | - if (!empty($post_image)) {
|
|
| 3255 | + if (!empty($post_image)) {
|
|
| 3256 | 3256 | |
| 3257 | - $invalid_files = array(); |
|
| 3257 | + $invalid_files = array(); |
|
| 3258 | 3258 | |
| 3259 | - //Get and remove all old images of post from database to set by new order |
|
| 3260 | - $geodir_uploaddir = ''; |
|
| 3261 | - $uploads = wp_upload_dir(); |
|
| 3262 | - $uploads_dir = $uploads['path']; |
|
| 3259 | + //Get and remove all old images of post from database to set by new order |
|
| 3260 | + $geodir_uploaddir = ''; |
|
| 3261 | + $uploads = wp_upload_dir(); |
|
| 3262 | + $uploads_dir = $uploads['path']; |
|
| 3263 | 3263 | |
| 3264 | - $geodir_uploadpath = $uploads['path']; |
|
| 3265 | - $geodir_uploadurl = $uploads['url']; |
|
| 3266 | - $sub_dir = $uploads['subdir']; |
|
| 3264 | + $geodir_uploadpath = $uploads['path']; |
|
| 3265 | + $geodir_uploadurl = $uploads['url']; |
|
| 3266 | + $sub_dir = $uploads['subdir']; |
|
| 3267 | 3267 | |
| 3268 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 3268 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 3269 | 3269 | |
| 3270 | - for ($m = 0; $m < count($post_image); $m++) {
|
|
| 3270 | + for ($m = 0; $m < count($post_image); $m++) {
|
|
| 3271 | 3271 | |
| 3272 | - /* --------- start ------- */ |
|
| 3272 | + /* --------- start ------- */ |
|
| 3273 | 3273 | |
| 3274 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 3274 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 3275 | 3275 | |
| 3276 | 3276 | |
| 3277 | - $curr_img_url = $post_image[$m]; |
|
| 3278 | - $image_name_arr = explode('/', $curr_img_url);
|
|
| 3279 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 3280 | - $filename = end($image_name_arr); |
|
| 3281 | - $img_name_arr = explode('.', $filename);
|
|
| 3277 | + $curr_img_url = $post_image[$m]; |
|
| 3278 | + $image_name_arr = explode('/', $curr_img_url);
|
|
| 3279 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 3280 | + $filename = end($image_name_arr); |
|
| 3281 | + $img_name_arr = explode('.', $filename);
|
|
| 3282 | 3282 | |
| 3283 | - $arr_file_type = wp_check_filetype($filename); |
|
| 3283 | + $arr_file_type = wp_check_filetype($filename); |
|
| 3284 | 3284 | |
| 3285 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 3286 | - continue; |
|
| 3287 | - } |
|
| 3285 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 3286 | + continue; |
|
| 3287 | + } |
|
| 3288 | 3288 | |
| 3289 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 3290 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 3289 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 3290 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 3291 | 3291 | |
| 3292 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 3293 | - continue; // Invalid file type. |
|
| 3294 | - } |
|
| 3292 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 3293 | + continue; // Invalid file type. |
|
| 3294 | + } |
|
| 3295 | 3295 | |
| 3296 | - // Set an array containing a list of acceptable formats |
|
| 3297 | - //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
|
| 3296 | + // Set an array containing a list of acceptable formats |
|
| 3297 | + //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
|
| 3298 | 3298 | |
| 3299 | - if (!function_exists('wp_handle_upload'))
|
|
| 3300 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 3299 | + if (!function_exists('wp_handle_upload'))
|
|
| 3300 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 3301 | 3301 | |
| 3302 | - if (!is_dir($geodir_uploadpath)) |
|
| 3303 | - mkdir($geodir_uploadpath); |
|
| 3302 | + if (!is_dir($geodir_uploadpath)) |
|
| 3303 | + mkdir($geodir_uploadpath); |
|
| 3304 | 3304 | |
| 3305 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 3306 | - $explode_sub_dir = explode("/", $sub_dir);
|
|
| 3307 | - if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 3308 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 3309 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 3310 | - } else {
|
|
| 3311 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 3312 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 3313 | - } |
|
| 3305 | + $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 3306 | + $explode_sub_dir = explode("/", $sub_dir);
|
|
| 3307 | + if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 3308 | + $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 3309 | + $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 3310 | + } else {
|
|
| 3311 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 3312 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 3313 | + } |
|
| 3314 | 3314 | |
| 3315 | - $uploaded_file = ''; |
|
| 3316 | - if (file_exists($img_path)) |
|
| 3317 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 3315 | + $uploaded_file = ''; |
|
| 3316 | + if (file_exists($img_path)) |
|
| 3317 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 3318 | 3318 | |
| 3319 | - if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 3320 | - if (file_exists($img_path)) |
|
| 3321 | - unlink($img_path); |
|
| 3322 | - } |
|
| 3319 | + if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 3320 | + if (file_exists($img_path)) |
|
| 3321 | + unlink($img_path); |
|
| 3322 | + } |
|
| 3323 | 3323 | |
| 3324 | - if (!empty($uploaded_file)) |
|
| 3325 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 3324 | + if (!empty($uploaded_file)) |
|
| 3325 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 3326 | 3326 | |
| 3327 | - } else {
|
|
| 3328 | - $file_urls = $post_image[$m]; |
|
| 3329 | - } |
|
| 3330 | - } |
|
| 3327 | + } else {
|
|
| 3328 | + $file_urls = $post_image[$m]; |
|
| 3329 | + } |
|
| 3330 | + } |
|
| 3331 | 3331 | |
| 3332 | 3332 | |
| 3333 | - } |
|
| 3333 | + } |
|
| 3334 | 3334 | |
| 3335 | - //Remove all old attachments and temp images |
|
| 3336 | - if (!empty($postcurr_images)) {
|
|
| 3335 | + //Remove all old attachments and temp images |
|
| 3336 | + if (!empty($postcurr_images)) {
|
|
| 3337 | 3337 | |
| 3338 | - if ($file_urls != $postcurr_images) {
|
|
| 3339 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 3340 | - $invalid_files = (object)$invalid_files; |
|
| 3341 | - } |
|
| 3342 | - } |
|
| 3338 | + if ($file_urls != $postcurr_images) {
|
|
| 3339 | + $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 3340 | + $invalid_files = (object)$invalid_files; |
|
| 3341 | + } |
|
| 3342 | + } |
|
| 3343 | 3343 | |
| 3344 | - geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 3344 | + geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 3345 | 3345 | |
| 3346 | - if (!empty($invalid_files)) |
|
| 3347 | - geodir_remove_attachments($invalid_files); |
|
| 3346 | + if (!empty($invalid_files)) |
|
| 3347 | + geodir_remove_attachments($invalid_files); |
|
| 3348 | 3348 | |
| 3349 | - } |
|
| 3349 | + } |
|
| 3350 | 3350 | } |
| 3351 | 3351 | |
| 3352 | 3352 | |
@@ -3361,76 +3361,76 @@ discard block |
||
| 3361 | 3361 | */ |
| 3362 | 3362 | function geodir_custom_upload_mimes($existing_mimes = array()) |
| 3363 | 3363 | {
|
| 3364 | - $existing_mimes['wif'] = 'text/plain'; |
|
| 3365 | - $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 3366 | - $existing_mimes['gif'] = 'image/gif'; |
|
| 3367 | - $existing_mimes['png'] = 'image/png'; |
|
| 3368 | - $existing_mimes['pdf'] = 'application/pdf'; |
|
| 3369 | - $existing_mimes['txt'] = 'text/text'; |
|
| 3370 | - $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 3371 | - $existing_mimes['doc'] = 'application/msword'; |
|
| 3372 | - $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 3373 | - $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 3374 | - $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 3375 | - return $existing_mimes; |
|
| 3364 | + $existing_mimes['wif'] = 'text/plain'; |
|
| 3365 | + $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 3366 | + $existing_mimes['gif'] = 'image/gif'; |
|
| 3367 | + $existing_mimes['png'] = 'image/png'; |
|
| 3368 | + $existing_mimes['pdf'] = 'application/pdf'; |
|
| 3369 | + $existing_mimes['txt'] = 'text/text'; |
|
| 3370 | + $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 3371 | + $existing_mimes['doc'] = 'application/msword'; |
|
| 3372 | + $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 3373 | + $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 3374 | + $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 3375 | + return $existing_mimes; |
|
| 3376 | 3376 | } |
| 3377 | 3377 | |
| 3378 | 3378 | if (!function_exists('geodir_plupload_action')) {
|
| 3379 | 3379 | |
| 3380 | - /** |
|
| 3381 | - * Get upload directory path details |
|
| 3382 | - * |
|
| 3383 | - * @since 1.0.0 |
|
| 3384 | - * @package GeoDirectory |
|
| 3385 | - * @global object $current_user Current user object. |
|
| 3386 | - * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 3387 | - * @return mixed Returns upload directory details as an array. |
|
| 3388 | - */ |
|
| 3389 | - function geodir_upload_dir($upload) |
|
| 3390 | - {
|
|
| 3391 | - global $current_user; |
|
| 3392 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 3393 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 3394 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 3395 | - return $upload; |
|
| 3396 | - } |
|
| 3397 | - |
|
| 3398 | - /** |
|
| 3399 | - * Handles place file and image upload. |
|
| 3400 | - * |
|
| 3401 | - * @since 1.0.0 |
|
| 3402 | - * @package GeoDirectory |
|
| 3403 | - */ |
|
| 3404 | - function geodir_plupload_action() |
|
| 3405 | - {
|
|
| 3406 | - // check ajax noonce |
|
| 3407 | - $imgid = $_POST["imgid"]; |
|
| 3408 | - |
|
| 3409 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 3410 | - |
|
| 3411 | - // handle custom file uploaddir |
|
| 3412 | - add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 3413 | - |
|
| 3414 | - // change file orinetation if needed |
|
| 3415 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 3416 | - |
|
| 3417 | - // handle file upload |
|
| 3418 | - $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 3419 | - // remove handle custom file uploaddir |
|
| 3420 | - remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 3421 | - |
|
| 3422 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 3423 | - print_r($status); |
|
| 3424 | - } |
|
| 3425 | - |
|
| 3426 | - // send the uploaded file url in response |
|
| 3427 | - if (isset($status['url'])) {
|
|
| 3428 | - echo $status['url']; |
|
| 3429 | - } else {
|
|
| 3430 | - echo 'x'; |
|
| 3431 | - } |
|
| 3432 | - exit; |
|
| 3433 | - } |
|
| 3380 | + /** |
|
| 3381 | + * Get upload directory path details |
|
| 3382 | + * |
|
| 3383 | + * @since 1.0.0 |
|
| 3384 | + * @package GeoDirectory |
|
| 3385 | + * @global object $current_user Current user object. |
|
| 3386 | + * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 3387 | + * @return mixed Returns upload directory details as an array. |
|
| 3388 | + */ |
|
| 3389 | + function geodir_upload_dir($upload) |
|
| 3390 | + {
|
|
| 3391 | + global $current_user; |
|
| 3392 | + $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 3393 | + $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 3394 | + $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 3395 | + return $upload; |
|
| 3396 | + } |
|
| 3397 | + |
|
| 3398 | + /** |
|
| 3399 | + * Handles place file and image upload. |
|
| 3400 | + * |
|
| 3401 | + * @since 1.0.0 |
|
| 3402 | + * @package GeoDirectory |
|
| 3403 | + */ |
|
| 3404 | + function geodir_plupload_action() |
|
| 3405 | + {
|
|
| 3406 | + // check ajax noonce |
|
| 3407 | + $imgid = $_POST["imgid"]; |
|
| 3408 | + |
|
| 3409 | + check_ajax_referer($imgid . 'pluploadan'); |
|
| 3410 | + |
|
| 3411 | + // handle custom file uploaddir |
|
| 3412 | + add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 3413 | + |
|
| 3414 | + // change file orinetation if needed |
|
| 3415 | + $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 3416 | + |
|
| 3417 | + // handle file upload |
|
| 3418 | + $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 3419 | + // remove handle custom file uploaddir |
|
| 3420 | + remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 3421 | + |
|
| 3422 | + if(!isset($status['url']) && isset($status['error'])){
|
|
| 3423 | + print_r($status); |
|
| 3424 | + } |
|
| 3425 | + |
|
| 3426 | + // send the uploaded file url in response |
|
| 3427 | + if (isset($status['url'])) {
|
|
| 3428 | + echo $status['url']; |
|
| 3429 | + } else {
|
|
| 3430 | + echo 'x'; |
|
| 3431 | + } |
|
| 3432 | + exit; |
|
| 3433 | + } |
|
| 3434 | 3434 | } |
| 3435 | 3435 | |
| 3436 | 3436 | /** |
@@ -3445,17 +3445,17 @@ discard block |
||
| 3445 | 3445 | */ |
| 3446 | 3446 | function geodir_get_video($post_id) |
| 3447 | 3447 | {
|
| 3448 | - global $wpdb, $plugin_prefix; |
|
| 3448 | + global $wpdb, $plugin_prefix; |
|
| 3449 | 3449 | |
| 3450 | - $post_type = get_post_type($post_id); |
|
| 3450 | + $post_type = get_post_type($post_id); |
|
| 3451 | 3451 | |
| 3452 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3452 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3453 | 3453 | |
| 3454 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 3454 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 3455 | 3455 | |
| 3456 | - if ($results) {
|
|
| 3457 | - return $results[0]->geodir_video; |
|
| 3458 | - } |
|
| 3456 | + if ($results) {
|
|
| 3457 | + return $results[0]->geodir_video; |
|
| 3458 | + } |
|
| 3459 | 3459 | |
| 3460 | 3460 | } |
| 3461 | 3461 | |
@@ -3471,40 +3471,40 @@ discard block |
||
| 3471 | 3471 | */ |
| 3472 | 3472 | function geodir_get_special_offers($post_id) |
| 3473 | 3473 | {
|
| 3474 | - global $wpdb, $plugin_prefix; |
|
| 3474 | + global $wpdb, $plugin_prefix; |
|
| 3475 | 3475 | |
| 3476 | - $post_type = get_post_type($post_id); |
|
| 3476 | + $post_type = get_post_type($post_id); |
|
| 3477 | 3477 | |
| 3478 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3478 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3479 | 3479 | |
| 3480 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 3480 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 3481 | 3481 | |
| 3482 | - if ($results) {
|
|
| 3483 | - return $results[0]->geodir_special_offers; |
|
| 3484 | - } |
|
| 3482 | + if ($results) {
|
|
| 3483 | + return $results[0]->geodir_special_offers; |
|
| 3484 | + } |
|
| 3485 | 3485 | |
| 3486 | 3486 | } |
| 3487 | 3487 | |
| 3488 | 3488 | if (!function_exists('geodir_max_upload_size')) {
|
| 3489 | - /** |
|
| 3490 | - * Get max upload file size |
|
| 3491 | - * |
|
| 3492 | - * @since 1.0.0 |
|
| 3493 | - * @package GeoDirectory |
|
| 3494 | - * @return mixed|void Returns max upload file size. |
|
| 3495 | - */ |
|
| 3496 | - function geodir_max_upload_size() |
|
| 3497 | - {
|
|
| 3498 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 3499 | - |
|
| 3500 | - if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 3501 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 3502 | - } else {
|
|
| 3503 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 3504 | - } |
|
| 3505 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 3506 | - return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 3507 | - } |
|
| 3489 | + /** |
|
| 3490 | + * Get max upload file size |
|
| 3491 | + * |
|
| 3492 | + * @since 1.0.0 |
|
| 3493 | + * @package GeoDirectory |
|
| 3494 | + * @return mixed|void Returns max upload file size. |
|
| 3495 | + */ |
|
| 3496 | + function geodir_max_upload_size() |
|
| 3497 | + {
|
|
| 3498 | + $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 3499 | + |
|
| 3500 | + if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 3501 | + $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 3502 | + } else {
|
|
| 3503 | + $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 3504 | + } |
|
| 3505 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 3506 | + return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 3507 | + } |
|
| 3508 | 3508 | } |
| 3509 | 3509 | |
| 3510 | 3510 | |
@@ -3522,33 +3522,33 @@ discard block |
||
| 3522 | 3522 | */ |
| 3523 | 3523 | function geodir_add_custom_sort_options($fields, $post_type) |
| 3524 | 3524 | {
|
| 3525 | - global $wpdb; |
|
| 3525 | + global $wpdb; |
|
| 3526 | 3526 | |
| 3527 | - if ($post_type != '') {
|
|
| 3527 | + if ($post_type != '') {
|
|
| 3528 | 3528 | |
| 3529 | - $all_postypes = geodir_get_posttypes(); |
|
| 3529 | + $all_postypes = geodir_get_posttypes(); |
|
| 3530 | 3530 | |
| 3531 | - if (in_array($post_type, $all_postypes)) {
|
|
| 3531 | + if (in_array($post_type, $all_postypes)) {
|
|
| 3532 | 3532 | |
| 3533 | - $custom_fields = $wpdb->get_results( |
|
| 3534 | - $wpdb->prepare( |
|
| 3535 | - "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 3536 | - array($post_type) |
|
| 3537 | - ), 'ARRAY_A' |
|
| 3538 | - ); |
|
| 3533 | + $custom_fields = $wpdb->get_results( |
|
| 3534 | + $wpdb->prepare( |
|
| 3535 | + "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 3536 | + array($post_type) |
|
| 3537 | + ), 'ARRAY_A' |
|
| 3538 | + ); |
|
| 3539 | 3539 | |
| 3540 | - if (!empty($custom_fields)) {
|
|
| 3540 | + if (!empty($custom_fields)) {
|
|
| 3541 | 3541 | |
| 3542 | - foreach ($custom_fields as $val) {
|
|
| 3543 | - $fields[] = $val; |
|
| 3544 | - } |
|
| 3545 | - } |
|
| 3542 | + foreach ($custom_fields as $val) {
|
|
| 3543 | + $fields[] = $val; |
|
| 3544 | + } |
|
| 3545 | + } |
|
| 3546 | 3546 | |
| 3547 | - } |
|
| 3547 | + } |
|
| 3548 | 3548 | |
| 3549 | - } |
|
| 3549 | + } |
|
| 3550 | 3550 | |
| 3551 | - return $fields; |
|
| 3551 | + return $fields; |
|
| 3552 | 3552 | } |
| 3553 | 3553 | |
| 3554 | 3554 | |
@@ -3564,66 +3564,66 @@ discard block |
||
| 3564 | 3564 | function geodir_get_custom_sort_options($post_type = '') |
| 3565 | 3565 | {
|
| 3566 | 3566 | |
| 3567 | - global $wpdb; |
|
| 3568 | - |
|
| 3569 | - if ($post_type != '') {
|
|
| 3570 | - |
|
| 3571 | - $all_postypes = geodir_get_posttypes(); |
|
| 3572 | - |
|
| 3573 | - if (!in_array($post_type, $all_postypes)) |
|
| 3574 | - return false; |
|
| 3575 | - |
|
| 3576 | - $fields = array(); |
|
| 3577 | - |
|
| 3578 | - $fields[] = array( |
|
| 3579 | - 'post_type' => $post_type, |
|
| 3580 | - 'data_type' => '', |
|
| 3581 | - 'field_type' => 'random', |
|
| 3582 | - 'site_title' => 'Random', |
|
| 3583 | - 'htmlvar_name' => 'post_title' |
|
| 3584 | - ); |
|
| 3585 | - |
|
| 3586 | - $fields[] = array( |
|
| 3587 | - 'post_type' => $post_type, |
|
| 3588 | - 'data_type' => '', |
|
| 3589 | - 'field_type' => 'datetime', |
|
| 3590 | - 'site_title' => __('Add date', 'geodirectory'),
|
|
| 3591 | - 'htmlvar_name' => 'post_date' |
|
| 3592 | - ); |
|
| 3593 | - $fields[] = array( |
|
| 3594 | - 'post_type' => $post_type, |
|
| 3595 | - 'data_type' => '', |
|
| 3596 | - 'field_type' => 'bigint', |
|
| 3597 | - 'site_title' => __('Review', 'geodirectory'),
|
|
| 3598 | - 'htmlvar_name' => 'comment_count' |
|
| 3599 | - ); |
|
| 3600 | - $fields[] = array( |
|
| 3601 | - 'post_type' => $post_type, |
|
| 3602 | - 'data_type' => '', |
|
| 3603 | - 'field_type' => 'float', |
|
| 3604 | - 'site_title' => __('Rating', 'geodirectory'),
|
|
| 3605 | - 'htmlvar_name' => 'overall_rating' |
|
| 3606 | - ); |
|
| 3607 | - $fields[] = array( |
|
| 3608 | - 'post_type' => $post_type, |
|
| 3609 | - 'data_type' => '', |
|
| 3610 | - 'field_type' => 'text', |
|
| 3611 | - 'site_title' => __('Title', 'geodirectory'),
|
|
| 3612 | - 'htmlvar_name' => 'post_title' |
|
| 3613 | - ); |
|
| 3614 | - |
|
| 3615 | - /** |
|
| 3616 | - * Hook to add custom sort options. |
|
| 3617 | - * |
|
| 3618 | - * @since 1.0.0 |
|
| 3619 | - * @param array $fields Unmodified sort options array. |
|
| 3620 | - * @param string $post_type Post type. |
|
| 3621 | - */ |
|
| 3622 | - return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 3623 | - |
|
| 3624 | - } |
|
| 3625 | - |
|
| 3626 | - return false; |
|
| 3567 | + global $wpdb; |
|
| 3568 | + |
|
| 3569 | + if ($post_type != '') {
|
|
| 3570 | + |
|
| 3571 | + $all_postypes = geodir_get_posttypes(); |
|
| 3572 | + |
|
| 3573 | + if (!in_array($post_type, $all_postypes)) |
|
| 3574 | + return false; |
|
| 3575 | + |
|
| 3576 | + $fields = array(); |
|
| 3577 | + |
|
| 3578 | + $fields[] = array( |
|
| 3579 | + 'post_type' => $post_type, |
|
| 3580 | + 'data_type' => '', |
|
| 3581 | + 'field_type' => 'random', |
|
| 3582 | + 'site_title' => 'Random', |
|
| 3583 | + 'htmlvar_name' => 'post_title' |
|
| 3584 | + ); |
|
| 3585 | + |
|
| 3586 | + $fields[] = array( |
|
| 3587 | + 'post_type' => $post_type, |
|
| 3588 | + 'data_type' => '', |
|
| 3589 | + 'field_type' => 'datetime', |
|
| 3590 | + 'site_title' => __('Add date', 'geodirectory'),
|
|
| 3591 | + 'htmlvar_name' => 'post_date' |
|
| 3592 | + ); |
|
| 3593 | + $fields[] = array( |
|
| 3594 | + 'post_type' => $post_type, |
|
| 3595 | + 'data_type' => '', |
|
| 3596 | + 'field_type' => 'bigint', |
|
| 3597 | + 'site_title' => __('Review', 'geodirectory'),
|
|
| 3598 | + 'htmlvar_name' => 'comment_count' |
|
| 3599 | + ); |
|
| 3600 | + $fields[] = array( |
|
| 3601 | + 'post_type' => $post_type, |
|
| 3602 | + 'data_type' => '', |
|
| 3603 | + 'field_type' => 'float', |
|
| 3604 | + 'site_title' => __('Rating', 'geodirectory'),
|
|
| 3605 | + 'htmlvar_name' => 'overall_rating' |
|
| 3606 | + ); |
|
| 3607 | + $fields[] = array( |
|
| 3608 | + 'post_type' => $post_type, |
|
| 3609 | + 'data_type' => '', |
|
| 3610 | + 'field_type' => 'text', |
|
| 3611 | + 'site_title' => __('Title', 'geodirectory'),
|
|
| 3612 | + 'htmlvar_name' => 'post_title' |
|
| 3613 | + ); |
|
| 3614 | + |
|
| 3615 | + /** |
|
| 3616 | + * Hook to add custom sort options. |
|
| 3617 | + * |
|
| 3618 | + * @since 1.0.0 |
|
| 3619 | + * @param array $fields Unmodified sort options array. |
|
| 3620 | + * @param string $post_type Post type. |
|
| 3621 | + */ |
|
| 3622 | + return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 3623 | + |
|
| 3624 | + } |
|
| 3625 | + |
|
| 3626 | + return false; |
|
| 3627 | 3627 | } |
| 3628 | 3628 | |
| 3629 | 3629 | |
@@ -3639,117 +3639,117 @@ discard block |
||
| 3639 | 3639 | function godir_set_sort_field_order($field_ids = array()) |
| 3640 | 3640 | {
|
| 3641 | 3641 | |
| 3642 | - global $wpdb; |
|
| 3642 | + global $wpdb; |
|
| 3643 | 3643 | |
| 3644 | - $count = 0; |
|
| 3645 | - if (!empty($field_ids)): |
|
| 3646 | - foreach ($field_ids as $id) {
|
|
| 3644 | + $count = 0; |
|
| 3645 | + if (!empty($field_ids)): |
|
| 3646 | + foreach ($field_ids as $id) {
|
|
| 3647 | 3647 | |
| 3648 | - $cf = trim($id, '_'); |
|
| 3648 | + $cf = trim($id, '_'); |
|
| 3649 | 3649 | |
| 3650 | - $post_meta_info = $wpdb->query( |
|
| 3651 | - $wpdb->prepare( |
|
| 3652 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3650 | + $post_meta_info = $wpdb->query( |
|
| 3651 | + $wpdb->prepare( |
|
| 3652 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3653 | 3653 | sort_order=%d |
| 3654 | 3654 | where id= %d", |
| 3655 | - array($count, $cf) |
|
| 3656 | - ) |
|
| 3657 | - ); |
|
| 3658 | - $count++; |
|
| 3659 | - } |
|
| 3660 | - |
|
| 3661 | - return $field_ids; |
|
| 3662 | - else: |
|
| 3663 | - return false; |
|
| 3664 | - endif; |
|
| 3655 | + array($count, $cf) |
|
| 3656 | + ) |
|
| 3657 | + ); |
|
| 3658 | + $count++; |
|
| 3659 | + } |
|
| 3660 | + |
|
| 3661 | + return $field_ids; |
|
| 3662 | + else: |
|
| 3663 | + return false; |
|
| 3664 | + endif; |
|
| 3665 | 3665 | } |
| 3666 | 3666 | |
| 3667 | 3667 | |
| 3668 | 3668 | if (!function_exists('geodir_custom_sort_field_save')) {
|
| 3669 | - /** |
|
| 3670 | - * Save or Update custom sort fields into the database. |
|
| 3671 | - * |
|
| 3672 | - * @since 1.0.0 |
|
| 3673 | - * @package GeoDirectory |
|
| 3674 | - * @global object $wpdb WordPress Database object. |
|
| 3675 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 3676 | - * @param array $request_field {
|
|
| 3677 | - * Attributes of the Request field. |
|
| 3678 | - * |
|
| 3679 | - * @type string $action Ajax action name. |
|
| 3680 | - * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 3681 | - * @type string $create_field Do you want to create this field?. |
|
| 3682 | - * @type string $field_ins_upd Field created or updated?. |
|
| 3683 | - * @type string $_wpnonce Nonce value. |
|
| 3684 | - * @type string $listing_type The Post type. |
|
| 3685 | - * @type string $field_type Field Type. |
|
| 3686 | - * @type string $field_id Field ID. |
|
| 3687 | - * @type string $data_type Data Type. |
|
| 3688 | - * @type string $htmlvar_name HTML variable name. |
|
| 3689 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 3690 | - * @type string $is_default Is this default sorting?. |
|
| 3691 | - * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 3692 | - * @type string $sort_order Sort Order. |
|
| 3693 | - * |
|
| 3694 | - * } |
|
| 3695 | - * @param bool $default Not yet implemented. |
|
| 3696 | - * @return int Returns the last affected db table row id. |
|
| 3697 | - */ |
|
| 3698 | - function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 3699 | - {
|
|
| 3700 | - |
|
| 3701 | - global $wpdb, $plugin_prefix; |
|
| 3702 | - |
|
| 3703 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 3704 | - |
|
| 3705 | - $cf = trim($result_str, '_'); |
|
| 3706 | - |
|
| 3707 | - /*-------- check dublicate validation --------*/ |
|
| 3708 | - |
|
| 3709 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 3710 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 3711 | - |
|
| 3712 | - $post_type = $request_field['listing_type']; |
|
| 3713 | - $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 3714 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 3715 | - $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 3716 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 3717 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 3718 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 3719 | - $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 3720 | - $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 3721 | - $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 3722 | - $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 3723 | - $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 3724 | - |
|
| 3725 | - $default_order = ''; |
|
| 3726 | - if ($is_default != '') {
|
|
| 3727 | - $default_order = $is_default; |
|
| 3728 | - $is_default = '1'; |
|
| 3729 | - } |
|
| 3730 | - |
|
| 3731 | - |
|
| 3732 | - $check_html_variable = $wpdb->get_var( |
|
| 3733 | - $wpdb->prepare( |
|
| 3734 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 3735 | - array($cehhtmlvar_name, $post_type, $field_type) |
|
| 3736 | - ) |
|
| 3737 | - ); |
|
| 3738 | - |
|
| 3739 | - if ($is_default == 1) {
|
|
| 3740 | - |
|
| 3741 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 3742 | - |
|
| 3743 | - } |
|
| 3744 | - |
|
| 3745 | - |
|
| 3746 | - if (!$check_html_variable) {
|
|
| 3747 | - |
|
| 3748 | - $wpdb->query( |
|
| 3749 | - |
|
| 3750 | - $wpdb->prepare( |
|
| 3751 | - |
|
| 3752 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3669 | + /** |
|
| 3670 | + * Save or Update custom sort fields into the database. |
|
| 3671 | + * |
|
| 3672 | + * @since 1.0.0 |
|
| 3673 | + * @package GeoDirectory |
|
| 3674 | + * @global object $wpdb WordPress Database object. |
|
| 3675 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 3676 | + * @param array $request_field {
|
|
| 3677 | + * Attributes of the Request field. |
|
| 3678 | + * |
|
| 3679 | + * @type string $action Ajax action name. |
|
| 3680 | + * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 3681 | + * @type string $create_field Do you want to create this field?. |
|
| 3682 | + * @type string $field_ins_upd Field created or updated?. |
|
| 3683 | + * @type string $_wpnonce Nonce value. |
|
| 3684 | + * @type string $listing_type The Post type. |
|
| 3685 | + * @type string $field_type Field Type. |
|
| 3686 | + * @type string $field_id Field ID. |
|
| 3687 | + * @type string $data_type Data Type. |
|
| 3688 | + * @type string $htmlvar_name HTML variable name. |
|
| 3689 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 3690 | + * @type string $is_default Is this default sorting?. |
|
| 3691 | + * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 3692 | + * @type string $sort_order Sort Order. |
|
| 3693 | + * |
|
| 3694 | + * } |
|
| 3695 | + * @param bool $default Not yet implemented. |
|
| 3696 | + * @return int Returns the last affected db table row id. |
|
| 3697 | + */ |
|
| 3698 | + function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 3699 | + {
|
|
| 3700 | + |
|
| 3701 | + global $wpdb, $plugin_prefix; |
|
| 3702 | + |
|
| 3703 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 3704 | + |
|
| 3705 | + $cf = trim($result_str, '_'); |
|
| 3706 | + |
|
| 3707 | + /*-------- check dublicate validation --------*/ |
|
| 3708 | + |
|
| 3709 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 3710 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 3711 | + |
|
| 3712 | + $post_type = $request_field['listing_type']; |
|
| 3713 | + $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 3714 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 3715 | + $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 3716 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 3717 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 3718 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 3719 | + $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 3720 | + $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 3721 | + $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 3722 | + $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 3723 | + $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 3724 | + |
|
| 3725 | + $default_order = ''; |
|
| 3726 | + if ($is_default != '') {
|
|
| 3727 | + $default_order = $is_default; |
|
| 3728 | + $is_default = '1'; |
|
| 3729 | + } |
|
| 3730 | + |
|
| 3731 | + |
|
| 3732 | + $check_html_variable = $wpdb->get_var( |
|
| 3733 | + $wpdb->prepare( |
|
| 3734 | + "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 3735 | + array($cehhtmlvar_name, $post_type, $field_type) |
|
| 3736 | + ) |
|
| 3737 | + ); |
|
| 3738 | + |
|
| 3739 | + if ($is_default == 1) {
|
|
| 3740 | + |
|
| 3741 | + $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 3742 | + |
|
| 3743 | + } |
|
| 3744 | + |
|
| 3745 | + |
|
| 3746 | + if (!$check_html_variable) {
|
|
| 3747 | + |
|
| 3748 | + $wpdb->query( |
|
| 3749 | + |
|
| 3750 | + $wpdb->prepare( |
|
| 3751 | + |
|
| 3752 | + "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3753 | 3753 | post_type = %s, |
| 3754 | 3754 | data_type = %s, |
| 3755 | 3755 | field_type = %s, |
@@ -3764,23 +3764,23 @@ discard block |
||
| 3764 | 3764 | asc_title = %s, |
| 3765 | 3765 | desc_title = %s", |
| 3766 | 3766 | |
| 3767 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title) |
|
| 3768 | - ) |
|
| 3767 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title) |
|
| 3768 | + ) |
|
| 3769 | 3769 | |
| 3770 | - ); |
|
| 3770 | + ); |
|
| 3771 | 3771 | |
| 3772 | 3772 | |
| 3773 | - $lastid = $wpdb->insert_id; |
|
| 3773 | + $lastid = $wpdb->insert_id; |
|
| 3774 | 3774 | |
| 3775 | - $lastid = trim($lastid); |
|
| 3775 | + $lastid = trim($lastid); |
|
| 3776 | 3776 | |
| 3777 | - } else {
|
|
| 3777 | + } else {
|
|
| 3778 | 3778 | |
| 3779 | - $wpdb->query( |
|
| 3779 | + $wpdb->query( |
|
| 3780 | 3780 | |
| 3781 | - $wpdb->prepare( |
|
| 3781 | + $wpdb->prepare( |
|
| 3782 | 3782 | |
| 3783 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3783 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3784 | 3784 | post_type = %s, |
| 3785 | 3785 | data_type = %s, |
| 3786 | 3786 | field_type = %s, |
@@ -3796,115 +3796,115 @@ discard block |
||
| 3796 | 3796 | desc_title = %s |
| 3797 | 3797 | where id = %d", |
| 3798 | 3798 | |
| 3799 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf) |
|
| 3800 | - ) |
|
| 3799 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf) |
|
| 3800 | + ) |
|
| 3801 | 3801 | |
| 3802 | - ); |
|
| 3802 | + ); |
|
| 3803 | 3803 | |
| 3804 | - $lastid = trim($cf); |
|
| 3804 | + $lastid = trim($cf); |
|
| 3805 | 3805 | |
| 3806 | - } |
|
| 3806 | + } |
|
| 3807 | 3807 | |
| 3808 | 3808 | |
| 3809 | - return (int)$lastid; |
|
| 3809 | + return (int)$lastid; |
|
| 3810 | 3810 | |
| 3811 | - } |
|
| 3811 | + } |
|
| 3812 | 3812 | } |
| 3813 | 3813 | |
| 3814 | 3814 | |
| 3815 | 3815 | if (!function_exists('geodir_custom_sort_field_delete')) {
|
| 3816 | - /** |
|
| 3817 | - * Delete a custom sort field using field id. |
|
| 3818 | - * @since 1.0.0 |
|
| 3819 | - * @package GeoDirectory |
|
| 3820 | - * @global object $wpdb WordPress Database object. |
|
| 3821 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 3822 | - * @param string $field_id The field ID. |
|
| 3823 | - * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 3824 | - */ |
|
| 3825 | - function geodir_custom_sort_field_delete($field_id = '') |
|
| 3826 | - {
|
|
| 3827 | - |
|
| 3828 | - global $wpdb, $plugin_prefix; |
|
| 3829 | - if ($field_id != '') {
|
|
| 3830 | - $cf = trim($field_id, '_'); |
|
| 3831 | - |
|
| 3832 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 3833 | - |
|
| 3834 | - return $field_id; |
|
| 3835 | - |
|
| 3836 | - } else |
|
| 3837 | - return 0; |
|
| 3838 | - |
|
| 3839 | - } |
|
| 3816 | + /** |
|
| 3817 | + * Delete a custom sort field using field id. |
|
| 3818 | + * @since 1.0.0 |
|
| 3819 | + * @package GeoDirectory |
|
| 3820 | + * @global object $wpdb WordPress Database object. |
|
| 3821 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 3822 | + * @param string $field_id The field ID. |
|
| 3823 | + * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 3824 | + */ |
|
| 3825 | + function geodir_custom_sort_field_delete($field_id = '') |
|
| 3826 | + {
|
|
| 3827 | + |
|
| 3828 | + global $wpdb, $plugin_prefix; |
|
| 3829 | + if ($field_id != '') {
|
|
| 3830 | + $cf = trim($field_id, '_'); |
|
| 3831 | + |
|
| 3832 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 3833 | + |
|
| 3834 | + return $field_id; |
|
| 3835 | + |
|
| 3836 | + } else |
|
| 3837 | + return 0; |
|
| 3838 | + |
|
| 3839 | + } |
|
| 3840 | 3840 | } |
| 3841 | 3841 | |
| 3842 | 3842 | |
| 3843 | 3843 | if (!function_exists('geodir_custom_sort_field_adminhtml')) {
|
| 3844 | - /** |
|
| 3845 | - * Custom sort field admin html. |
|
| 3846 | - * |
|
| 3847 | - * @since 1.0.0 |
|
| 3848 | - * @package GeoDirectory |
|
| 3849 | - * @global object $wpdb WordPress Database object. |
|
| 3850 | - * @param string $field_type The form field type. |
|
| 3851 | - * @param object|int $result_str The custom field results object or row id. |
|
| 3852 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 3853 | - * @param bool $default when set to true field will be for admin use only. |
|
| 3854 | - */ |
|
| 3855 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
| 3856 | - {
|
|
| 3857 | - global $wpdb; |
|
| 3858 | - $cf = $result_str; |
|
| 3859 | - if (!is_object($cf)) {
|
|
| 3860 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 3861 | - } else {
|
|
| 3862 | - $field_info = $cf; |
|
| 3863 | - $result_str = $cf->id; |
|
| 3864 | - } |
|
| 3865 | - |
|
| 3866 | - $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 3867 | - |
|
| 3868 | - if (!isset($field_info->post_type)) {
|
|
| 3869 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 3870 | - } else {
|
|
| 3871 | - $post_type = $field_info->post_type; |
|
| 3872 | - } |
|
| 3873 | - |
|
| 3874 | - $field_types = explode('-_-', $field_type);
|
|
| 3875 | - $field_type = $field_types[0]; |
|
| 3876 | - $htmlvar_name = isset($field_types[1]) ? $field_types[1] : ''; |
|
| 3877 | - |
|
| 3878 | - $site_title = ''; |
|
| 3879 | - if ($site_title == '') |
|
| 3880 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 3881 | - |
|
| 3882 | - if ($site_title == '') {
|
|
| 3883 | - $fields = geodir_get_custom_sort_options($post_type); |
|
| 3884 | - |
|
| 3885 | - foreach ($fields as $val) {
|
|
| 3886 | - $val = stripslashes_deep($val); // strip slashes |
|
| 3887 | - |
|
| 3888 | - if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 3889 | - $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 3890 | - } |
|
| 3891 | - } |
|
| 3892 | - } |
|
| 3893 | - |
|
| 3894 | - if ($htmlvar_name == '') |
|
| 3895 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 3896 | - |
|
| 3897 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 3898 | - |
|
| 3899 | - ?> |
|
| 3844 | + /** |
|
| 3845 | + * Custom sort field admin html. |
|
| 3846 | + * |
|
| 3847 | + * @since 1.0.0 |
|
| 3848 | + * @package GeoDirectory |
|
| 3849 | + * @global object $wpdb WordPress Database object. |
|
| 3850 | + * @param string $field_type The form field type. |
|
| 3851 | + * @param object|int $result_str The custom field results object or row id. |
|
| 3852 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 3853 | + * @param bool $default when set to true field will be for admin use only. |
|
| 3854 | + */ |
|
| 3855 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
| 3856 | + {
|
|
| 3857 | + global $wpdb; |
|
| 3858 | + $cf = $result_str; |
|
| 3859 | + if (!is_object($cf)) {
|
|
| 3860 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 3861 | + } else {
|
|
| 3862 | + $field_info = $cf; |
|
| 3863 | + $result_str = $cf->id; |
|
| 3864 | + } |
|
| 3865 | + |
|
| 3866 | + $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 3867 | + |
|
| 3868 | + if (!isset($field_info->post_type)) {
|
|
| 3869 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 3870 | + } else {
|
|
| 3871 | + $post_type = $field_info->post_type; |
|
| 3872 | + } |
|
| 3873 | + |
|
| 3874 | + $field_types = explode('-_-', $field_type);
|
|
| 3875 | + $field_type = $field_types[0]; |
|
| 3876 | + $htmlvar_name = isset($field_types[1]) ? $field_types[1] : ''; |
|
| 3877 | + |
|
| 3878 | + $site_title = ''; |
|
| 3879 | + if ($site_title == '') |
|
| 3880 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 3881 | + |
|
| 3882 | + if ($site_title == '') {
|
|
| 3883 | + $fields = geodir_get_custom_sort_options($post_type); |
|
| 3884 | + |
|
| 3885 | + foreach ($fields as $val) {
|
|
| 3886 | + $val = stripslashes_deep($val); // strip slashes |
|
| 3887 | + |
|
| 3888 | + if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 3889 | + $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 3890 | + } |
|
| 3891 | + } |
|
| 3892 | + } |
|
| 3893 | + |
|
| 3894 | + if ($htmlvar_name == '') |
|
| 3895 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 3896 | + |
|
| 3897 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 3898 | + |
|
| 3899 | + ?> |
|
| 3900 | 3900 | <li class="text" id="licontainer_<?php echo $result_str;?>"> |
| 3901 | 3901 | <div class="title title<?php echo $result_str;?> gt-fieldset" |
| 3902 | 3902 | title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
| 3903 | 3903 | ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
| 3904 | 3904 | <?php |
| 3905 | 3905 | |
| 3906 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 3907 | - ?> |
|
| 3906 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 3907 | + ?> |
|
| 3908 | 3908 | |
| 3909 | 3909 | <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
| 3910 | 3910 | onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
@@ -3917,17 +3917,17 @@ discard block |
||
| 3917 | 3917 | |
| 3918 | 3918 | <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
| 3919 | 3919 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 3920 | - echo 'block;'; |
|
| 3921 | - } else {
|
|
| 3922 | - echo 'none;'; |
|
| 3923 | - } ?>"> |
|
| 3920 | + echo 'block;'; |
|
| 3921 | + } else {
|
|
| 3922 | + echo 'none;'; |
|
| 3923 | + } ?>"> |
|
| 3924 | 3924 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 3925 | 3925 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
| 3926 | 3926 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
| 3927 | 3927 | <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
| 3928 | 3928 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 3929 | - echo $field_info->data_type; |
|
| 3930 | - }?>"/> |
|
| 3929 | + echo $field_info->data_type; |
|
| 3930 | + }?>"/> |
|
| 3931 | 3931 | <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
| 3932 | 3932 | |
| 3933 | 3933 | |
@@ -3942,19 +3942,19 @@ discard block |
||
| 3942 | 3942 | <td> |
| 3943 | 3943 | <input type="checkbox" name="asc" id="asc" |
| 3944 | 3944 | value="1" <?php if (isset($field_info->sort_asc) && $field_info->sort_asc == '1') {
|
| 3945 | - echo 'checked="checked"'; |
|
| 3946 | - } ?>/> |
|
| 3945 | + echo 'checked="checked"'; |
|
| 3946 | + } ?>/> |
|
| 3947 | 3947 | |
| 3948 | 3948 | <input type="text" name="asc_title" id="asc_title" |
| 3949 | 3949 | placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
|
| 3950 | 3950 | value="<?php if (isset($field_info->asc_title)) {
|
| 3951 | - echo esc_attr($field_info->asc_title); |
|
| 3952 | - } ?>" style="width:45%;"/> |
|
| 3951 | + echo esc_attr($field_info->asc_title); |
|
| 3952 | + } ?>" style="width:45%;"/> |
|
| 3953 | 3953 | |
| 3954 | 3954 | <input type="radio" name="is_default" |
| 3955 | 3955 | value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
| 3956 | - echo 'checked="checked"'; |
|
| 3957 | - } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
|
| 3956 | + echo 'checked="checked"'; |
|
| 3957 | + } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
|
| 3958 | 3958 | |
| 3959 | 3959 | <br/> |
| 3960 | 3960 | <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
|
@@ -3966,18 +3966,18 @@ discard block |
||
| 3966 | 3966 | <td> |
| 3967 | 3967 | <input type="checkbox" name="desc" id="desc" |
| 3968 | 3968 | value="1" <?php if (isset($field_info->sort_desc) && $field_info->sort_desc == '1') {
|
| 3969 | - echo 'checked="checked"'; |
|
| 3970 | - } ?>/> |
|
| 3969 | + echo 'checked="checked"'; |
|
| 3970 | + } ?>/> |
|
| 3971 | 3971 | |
| 3972 | 3972 | <input type="text" name="desc_title" id="desc_title" |
| 3973 | 3973 | placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
|
| 3974 | 3974 | value="<?php if (isset($field_info->desc_title)) {
|
| 3975 | - echo esc_attr($field_info->desc_title); |
|
| 3976 | - } ?>" style="width:45%;"/> |
|
| 3975 | + echo esc_attr($field_info->desc_title); |
|
| 3976 | + } ?>" style="width:45%;"/> |
|
| 3977 | 3977 | <input type="radio" name="is_default" |
| 3978 | 3978 | value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
| 3979 | - echo 'checked="checked"'; |
|
| 3980 | - } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
|
| 3979 | + echo 'checked="checked"'; |
|
| 3980 | + } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
|
| 3981 | 3981 | <br/> |
| 3982 | 3982 | <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
|
| 3983 | 3983 | </td> |
@@ -4000,8 +4000,8 @@ discard block |
||
| 4000 | 4000 | <td align="left"> |
| 4001 | 4001 | <input type="checkbox" name="is_default" |
| 4002 | 4002 | value="<?php echo $field_type; ?>" <?php if (isset($field_info->is_default) && $field_info->is_default == '1') {
|
| 4003 | - echo 'checked="checked"'; |
|
| 4004 | - } ?>/> |
|
| 4003 | + echo 'checked="checked"'; |
|
| 4004 | + } ?>/> |
|
| 4005 | 4005 | <br/> |
| 4006 | 4006 | <span><?php _e('If field is checked then the field will be use as default sort.', 'geodirectory'); ?></span>
|
| 4007 | 4007 | </td> |
@@ -4015,12 +4015,12 @@ discard block |
||
| 4015 | 4015 | <select name="is_active" id="is_active"> |
| 4016 | 4016 | <option |
| 4017 | 4017 | value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
|
| 4018 | - echo 'selected="selected"'; |
|
| 4019 | - }?>><?php _e('Yes', 'geodirectory');?></option>
|
|
| 4018 | + echo 'selected="selected"'; |
|
| 4019 | + }?>><?php _e('Yes', 'geodirectory');?></option>
|
|
| 4020 | 4020 | <option |
| 4021 | 4021 | value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
|
| 4022 | - echo 'selected="selected"'; |
|
| 4023 | - }?>><?php _e('No', 'geodirectory');?></option>
|
|
| 4022 | + echo 'selected="selected"'; |
|
| 4023 | + }?>><?php _e('No', 'geodirectory');?></option>
|
|
| 4024 | 4024 | </select> |
| 4025 | 4025 | <br/> |
| 4026 | 4026 | <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
|
@@ -4031,8 +4031,8 @@ discard block |
||
| 4031 | 4031 | <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
|
| 4032 | 4032 | <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order" |
| 4033 | 4033 | value="<?php if (isset($field_info->sort_order)) {
|
| 4034 | - echo esc_attr($field_info->sort_order); |
|
| 4035 | - }?>" size="50"/> |
|
| 4034 | + echo esc_attr($field_info->sort_order); |
|
| 4035 | + }?>" size="50"/> |
|
| 4036 | 4036 | <br/> |
| 4037 | 4037 | <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
|
| 4038 | 4038 | </td> |
@@ -4055,38 +4055,38 @@ discard block |
||
| 4055 | 4055 | </div> |
| 4056 | 4056 | </li> <?php |
| 4057 | 4057 | |
| 4058 | - } |
|
| 4058 | + } |
|
| 4059 | 4059 | } |
| 4060 | 4060 | |
| 4061 | 4061 | if (!function_exists('check_field_visibility')) {
|
| 4062 | - /** |
|
| 4063 | - * Check field visibility as per price package. |
|
| 4064 | - * |
|
| 4065 | - * @since 1.0.0 |
|
| 4066 | - * @package GeoDirectory |
|
| 4067 | - * @global object $wpdb WordPress Database object. |
|
| 4068 | - * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 4069 | - * @param int|string $package_id The package ID. |
|
| 4070 | - * @param string $field_name The field name. |
|
| 4071 | - * @param string $post_type Optional. The wordpress post type. |
|
| 4072 | - * @return bool Returns true when field visible, otherwise false. |
|
| 4073 | - */ |
|
| 4074 | - function check_field_visibility($package_id, $field_name, $post_type) |
|
| 4075 | - {
|
|
| 4076 | - global $wpdb, $geodir_addon_list; |
|
| 4077 | - if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 4078 | - return true; |
|
| 4079 | - } |
|
| 4080 | - if (!$package_id || !$field_name || !$post_type) {
|
|
| 4081 | - return true; |
|
| 4082 | - } |
|
| 4083 | - $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 4084 | - |
|
| 4085 | - if ($wpdb->get_var($sql)) {
|
|
| 4086 | - return true; |
|
| 4087 | - } |
|
| 4088 | - return false; |
|
| 4089 | - } |
|
| 4062 | + /** |
|
| 4063 | + * Check field visibility as per price package. |
|
| 4064 | + * |
|
| 4065 | + * @since 1.0.0 |
|
| 4066 | + * @package GeoDirectory |
|
| 4067 | + * @global object $wpdb WordPress Database object. |
|
| 4068 | + * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 4069 | + * @param int|string $package_id The package ID. |
|
| 4070 | + * @param string $field_name The field name. |
|
| 4071 | + * @param string $post_type Optional. The wordpress post type. |
|
| 4072 | + * @return bool Returns true when field visible, otherwise false. |
|
| 4073 | + */ |
|
| 4074 | + function check_field_visibility($package_id, $field_name, $post_type) |
|
| 4075 | + {
|
|
| 4076 | + global $wpdb, $geodir_addon_list; |
|
| 4077 | + if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 4078 | + return true; |
|
| 4079 | + } |
|
| 4080 | + if (!$package_id || !$field_name || !$post_type) {
|
|
| 4081 | + return true; |
|
| 4082 | + } |
|
| 4083 | + $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 4084 | + |
|
| 4085 | + if ($wpdb->get_var($sql)) {
|
|
| 4086 | + return true; |
|
| 4087 | + } |
|
| 4088 | + return false; |
|
| 4089 | + } |
|
| 4090 | 4090 | } |
| 4091 | 4091 | |
| 4092 | 4092 | /** |
@@ -4101,43 +4101,43 @@ discard block |
||
| 4101 | 4101 | */ |
| 4102 | 4102 | function geodir_string_to_options($input = '', $translated = false) |
| 4103 | 4103 | {
|
| 4104 | - $return = array(); |
|
| 4105 | - if ($input != '') {
|
|
| 4106 | - $input = trim($input); |
|
| 4107 | - $input = rtrim($input, ","); |
|
| 4108 | - $input = ltrim($input, ","); |
|
| 4109 | - $input = trim($input); |
|
| 4110 | - } |
|
| 4111 | - |
|
| 4112 | - $input_arr = explode(',', $input);
|
|
| 4113 | - |
|
| 4114 | - if (!empty($input_arr)) {
|
|
| 4115 | - foreach ($input_arr as $input_str) {
|
|
| 4116 | - $input_str = trim($input_str); |
|
| 4117 | - |
|
| 4118 | - if (strpos($input_str, "/") !== false) {
|
|
| 4119 | - $input_str = explode("/", $input_str, 2);
|
|
| 4120 | - $label = trim($input_str[0]); |
|
| 4121 | - if ($translated && $label != '') {
|
|
| 4122 | - $label = __($label, 'geodirectory'); |
|
| 4123 | - } |
|
| 4124 | - $label = ucfirst($label); |
|
| 4125 | - $value = trim($input_str[1]); |
|
| 4126 | - } else {
|
|
| 4127 | - if ($translated && $input_str != '') {
|
|
| 4128 | - $input_str = __($input_str, 'geodirectory'); |
|
| 4129 | - } |
|
| 4130 | - $label = ucfirst($input_str); |
|
| 4131 | - $value = $input_str; |
|
| 4132 | - } |
|
| 4133 | - |
|
| 4134 | - if ($label != '') {
|
|
| 4135 | - $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 4136 | - } |
|
| 4137 | - } |
|
| 4138 | - } |
|
| 4139 | - |
|
| 4140 | - return $return; |
|
| 4104 | + $return = array(); |
|
| 4105 | + if ($input != '') {
|
|
| 4106 | + $input = trim($input); |
|
| 4107 | + $input = rtrim($input, ","); |
|
| 4108 | + $input = ltrim($input, ","); |
|
| 4109 | + $input = trim($input); |
|
| 4110 | + } |
|
| 4111 | + |
|
| 4112 | + $input_arr = explode(',', $input);
|
|
| 4113 | + |
|
| 4114 | + if (!empty($input_arr)) {
|
|
| 4115 | + foreach ($input_arr as $input_str) {
|
|
| 4116 | + $input_str = trim($input_str); |
|
| 4117 | + |
|
| 4118 | + if (strpos($input_str, "/") !== false) {
|
|
| 4119 | + $input_str = explode("/", $input_str, 2);
|
|
| 4120 | + $label = trim($input_str[0]); |
|
| 4121 | + if ($translated && $label != '') {
|
|
| 4122 | + $label = __($label, 'geodirectory'); |
|
| 4123 | + } |
|
| 4124 | + $label = ucfirst($label); |
|
| 4125 | + $value = trim($input_str[1]); |
|
| 4126 | + } else {
|
|
| 4127 | + if ($translated && $input_str != '') {
|
|
| 4128 | + $input_str = __($input_str, 'geodirectory'); |
|
| 4129 | + } |
|
| 4130 | + $label = ucfirst($input_str); |
|
| 4131 | + $value = $input_str; |
|
| 4132 | + } |
|
| 4133 | + |
|
| 4134 | + if ($label != '') {
|
|
| 4135 | + $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 4136 | + } |
|
| 4137 | + } |
|
| 4138 | + } |
|
| 4139 | + |
|
| 4140 | + return $return; |
|
| 4141 | 4141 | } |
| 4142 | 4142 | |
| 4143 | 4143 | /** |
@@ -4152,51 +4152,51 @@ discard block |
||
| 4152 | 4152 | */ |
| 4153 | 4153 | function geodir_string_values_to_options($option_values = '', $translated = false) |
| 4154 | 4154 | {
|
| 4155 | - $options = array(); |
|
| 4156 | - if ($option_values == '') {
|
|
| 4157 | - return NULL; |
|
| 4158 | - } |
|
| 4159 | - |
|
| 4160 | - if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 4161 | - $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 4162 | - |
|
| 4163 | - foreach ($option_values_arr as $optgroup) {
|
|
| 4164 | - if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 4165 | - $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 4166 | - |
|
| 4167 | - $count = 0; |
|
| 4168 | - foreach ($optgroup_arr as $optgroup_str) {
|
|
| 4169 | - $count++; |
|
| 4170 | - $optgroup_str = trim($optgroup_str); |
|
| 4171 | - |
|
| 4172 | - $optgroup_label = ''; |
|
| 4173 | - if (strpos($optgroup_str, "|") !== false) {
|
|
| 4174 | - $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 4175 | - $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 4176 | - if ($translated && $optgroup_label != '') {
|
|
| 4177 | - $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 4178 | - } |
|
| 4179 | - $optgroup_label = ucfirst($optgroup_label); |
|
| 4180 | - $optgroup_str = $optgroup_str_arr[1]; |
|
| 4181 | - } |
|
| 4182 | - |
|
| 4183 | - $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 4184 | - |
|
| 4185 | - if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 4186 | - $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 4187 | - $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 4188 | - $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 4189 | - } |
|
| 4190 | - $options = array_merge($options, $optgroup3); |
|
| 4191 | - } |
|
| 4192 | - } else {
|
|
| 4193 | - $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 4194 | - $options = array_merge($options, $optgroup1); |
|
| 4195 | - } |
|
| 4196 | - } |
|
| 4197 | - } else {
|
|
| 4198 | - $options = geodir_string_to_options($option_values, $translated); |
|
| 4199 | - } |
|
| 4200 | - |
|
| 4201 | - return $options; |
|
| 4155 | + $options = array(); |
|
| 4156 | + if ($option_values == '') {
|
|
| 4157 | + return NULL; |
|
| 4158 | + } |
|
| 4159 | + |
|
| 4160 | + if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 4161 | + $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 4162 | + |
|
| 4163 | + foreach ($option_values_arr as $optgroup) {
|
|
| 4164 | + if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 4165 | + $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 4166 | + |
|
| 4167 | + $count = 0; |
|
| 4168 | + foreach ($optgroup_arr as $optgroup_str) {
|
|
| 4169 | + $count++; |
|
| 4170 | + $optgroup_str = trim($optgroup_str); |
|
| 4171 | + |
|
| 4172 | + $optgroup_label = ''; |
|
| 4173 | + if (strpos($optgroup_str, "|") !== false) {
|
|
| 4174 | + $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 4175 | + $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 4176 | + if ($translated && $optgroup_label != '') {
|
|
| 4177 | + $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 4178 | + } |
|
| 4179 | + $optgroup_label = ucfirst($optgroup_label); |
|
| 4180 | + $optgroup_str = $optgroup_str_arr[1]; |
|
| 4181 | + } |
|
| 4182 | + |
|
| 4183 | + $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 4184 | + |
|
| 4185 | + if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 4186 | + $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 4187 | + $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 4188 | + $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 4189 | + } |
|
| 4190 | + $options = array_merge($options, $optgroup3); |
|
| 4191 | + } |
|
| 4192 | + } else {
|
|
| 4193 | + $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 4194 | + $options = array_merge($options, $optgroup1); |
|
| 4195 | + } |
|
| 4196 | + } |
|
| 4197 | + } else {
|
|
| 4198 | + $options = geodir_string_to_options($option_values, $translated); |
|
| 4199 | + } |
|
| 4200 | + |
|
| 4201 | + return $options; |
|
| 4202 | 4202 | } |
| 4203 | 4203 | \ No newline at end of file |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
| 50 | 50 | {
|
| 51 | 51 | global $wpdb; |
| 52 | - $result = 0;// no rows affected |
|
| 52 | + $result = 0; // no rows affected |
|
| 53 | 53 | if (!geodir_column_exist($db, $column)) {
|
| 54 | 54 | if (!empty($db) && !empty($column)) |
| 55 | 55 | $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | {
|
| 75 | 75 | global $wpdb, $geodir_post_custom_fields_cache; |
| 76 | 76 | |
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 77 | + $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location; |
|
| 78 | 78 | |
| 79 | 79 | if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
| 80 | 80 | return $geodir_post_custom_fields_cache[$cache_stored]; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $post_meta_info = $wpdb->get_results( |
| 97 | 97 | $wpdb->prepare( |
| 98 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 98 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | 99 | array($post_type) |
| 100 | 100 | ) |
| 101 | 101 | ); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $cf = $result_str; |
| 170 | 170 | if (!is_object($cf)) {
|
| 171 | 171 | |
| 172 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 172 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
|
|
| 173 | 173 | |
| 174 | 174 | } else {
|
| 175 | 175 | $field_info = $cf; |
@@ -203,14 +203,14 @@ discard block |
||
| 203 | 203 | if ($field_id != '') {
|
| 204 | 204 | $cf = trim($field_id, '_'); |
| 205 | 205 | |
| 206 | - if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 207 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 206 | + if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
|
|
| 207 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 208 | 208 | |
| 209 | 209 | $post_type = $field->post_type; |
| 210 | 210 | $htmlvar_name = $field->htmlvar_name; |
| 211 | 211 | |
| 212 | 212 | if ($post_type != '' && $htmlvar_name != '') {
|
| 213 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 213 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -224,18 +224,18 @@ discard block |
||
| 224 | 224 | do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
| 225 | 225 | |
| 226 | 226 | if ($field->field_type == 'address') {
|
| 227 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 228 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 229 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 230 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 231 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 232 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 233 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 234 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 235 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 227 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
|
|
| 228 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
|
|
| 229 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
|
|
| 230 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
|
|
| 231 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
|
|
| 232 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
|
|
| 233 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
|
|
| 234 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
|
|
| 235 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
|
|
| 236 | 236 | } else {
|
| 237 | 237 | if ($field->field_type != 'fieldset') {
|
| 238 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 238 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
|
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
| 305 | 305 | |
| 306 | 306 | // some servers fail if a POST value is VARCHAR so we change it. |
| 307 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 307 | + if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
|
|
| 308 | 308 | $request_field['data_type'] = 'VARCHAR'; |
| 309 | 309 | } |
| 310 | 310 | |
@@ -317,12 +317,12 @@ discard block |
||
| 317 | 317 | $post_type = $request_field['listing_type']; |
| 318 | 318 | |
| 319 | 319 | if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
| 320 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 320 | + $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name; |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | $check_html_variable = $wpdb->get_var( |
| 324 | 324 | $wpdb->prepare( |
| 325 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 325 | + "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | 326 | array($cf, $cehhtmlvar_name, $post_type) |
| 327 | 327 | ) |
| 328 | 328 | ); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $post_meta_info = $wpdb->get_row( |
| 336 | 336 | $wpdb->prepare( |
| 337 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 337 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d", |
|
| 338 | 338 | array($cf) |
| 339 | 339 | ) |
| 340 | 340 | ); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | if ($post_type == '') $post_type = 'gd_place'; |
| 353 | 353 | |
| 354 | 354 | |
| 355 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 355 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
| 356 | 356 | |
| 357 | 357 | $admin_title = $request_field['admin_title']; |
| 358 | 358 | $site_title = $request_field['site_title']; |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
| 379 | 379 | |
| 380 | 380 | if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
| 381 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 381 | + $htmlvar_name = 'geodir_'.$htmlvar_name; |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | $option_values = ''; |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | if ($sort_order == '') {
|
| 425 | 425 | |
| 426 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 426 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 427 | 427 | |
| 428 | - $sort_order = (int)$last_order + 1; |
|
| 428 | + $sort_order = (int) $last_order + 1; |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | $default_value_add = ''; |
@@ -436,15 +436,15 @@ discard block |
||
| 436 | 436 | case 'address': |
| 437 | 437 | |
| 438 | 438 | if ($htmlvar_name != '') {
|
| 439 | - $prefix = $htmlvar_name . '_'; |
|
| 439 | + $prefix = $htmlvar_name.'_'; |
|
| 440 | 440 | } |
| 441 | - $old_prefix = $old_html_variable . '_'; |
|
| 441 | + $old_prefix = $old_html_variable.'_'; |
|
| 442 | 442 | |
| 443 | 443 | |
| 444 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 444 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 445 | 445 | |
| 446 | 446 | if ($default_value != '') {
|
| 447 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 447 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | $wpdb->query($meta_field_add); |
@@ -453,12 +453,12 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 455 | 455 | |
| 456 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 456 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
|
|
| 457 | 457 | if ($is_column) {
|
| 458 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 458 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL"; |
|
| 459 | 459 | |
| 460 | 460 | if ($default_value != '') {
|
| 461 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 461 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | $wpdb->query($meta_field_add); |
@@ -466,9 +466,9 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 468 | 468 | if ($default_value != '') {
|
| 469 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 469 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 470 | 470 | } |
| 471 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 471 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 472 | 472 | |
| 473 | 473 | } |
| 474 | 474 | |
@@ -478,36 +478,36 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 480 | 480 | |
| 481 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 481 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
|
|
| 482 | 482 | |
| 483 | 483 | if ($is_column) {
|
| 484 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 484 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL"; |
|
| 485 | 485 | |
| 486 | 486 | if ($default_value != '') {
|
| 487 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 487 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | $wpdb->query($meta_field_add); |
| 491 | 491 | } else {
|
| 492 | 492 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 493 | 493 | if ($default_value != '') {
|
| 494 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 494 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 497 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | } |
| 501 | 501 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 502 | 502 | |
| 503 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 503 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
|
|
| 504 | 504 | |
| 505 | 505 | if ($is_column) {
|
| 506 | 506 | |
| 507 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 507 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL"; |
|
| 508 | 508 | |
| 509 | 509 | if ($default_value != '') {
|
| 510 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 510 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | $wpdb->query($meta_field_add); |
@@ -515,24 +515,24 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 517 | 517 | if ($default_value != '') {
|
| 518 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 518 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 521 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 522 | 522 | |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | } |
| 526 | 526 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 527 | 527 | |
| 528 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 528 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
|
|
| 529 | 529 | |
| 530 | 530 | if ($is_column) {
|
| 531 | 531 | |
| 532 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 532 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL"; |
|
| 533 | 533 | |
| 534 | 534 | if ($default_value != '') {
|
| 535 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 535 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | $wpdb->query($meta_field_add); |
@@ -540,128 +540,128 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 542 | 542 | if ($default_value != '') {
|
| 543 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 543 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 546 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 547 | 547 | |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | } |
| 551 | 551 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 552 | 552 | |
| 553 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 553 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
|
|
| 554 | 554 | if ($is_column) {
|
| 555 | 555 | |
| 556 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 556 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 557 | 557 | |
| 558 | 558 | if ($default_value != '') {
|
| 559 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 559 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | $wpdb->query($meta_field_add); |
| 563 | 563 | } else {
|
| 564 | 564 | |
| 565 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 565 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 566 | 566 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 567 | 567 | if ($default_value != '') {
|
| 568 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 568 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 571 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 572 | 572 | |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | |
| 576 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 576 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
|
|
| 577 | 577 | |
| 578 | 578 | if ($is_column) {
|
| 579 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 579 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 580 | 580 | |
| 581 | 581 | if ($default_value != '') {
|
| 582 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 582 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | $wpdb->query($meta_field_add); |
| 586 | 586 | } else {
|
| 587 | 587 | |
| 588 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 588 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 589 | 589 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 590 | 590 | if ($default_value != '') {
|
| 591 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 591 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 594 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | } |
| 598 | 598 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 599 | 599 | |
| 600 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 600 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
|
|
| 601 | 601 | |
| 602 | 602 | if ($is_column) {
|
| 603 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 603 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 604 | 604 | |
| 605 | 605 | if ($default_value != '') {
|
| 606 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 606 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | $wpdb->query($meta_field_add); |
| 610 | 610 | } else {
|
| 611 | 611 | |
| 612 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 612 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 613 | 613 | |
| 614 | 614 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 615 | 615 | if ($default_value != '') {
|
| 616 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 616 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 619 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | |
| 623 | 623 | } |
| 624 | 624 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 625 | 625 | |
| 626 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 626 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
|
|
| 627 | 627 | if ($is_column) {
|
| 628 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 628 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 629 | 629 | |
| 630 | 630 | if ($default_value != '') {
|
| 631 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 631 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | $wpdb->query($meta_field_add); |
| 635 | 635 | |
| 636 | 636 | } else {
|
| 637 | 637 | |
| 638 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 638 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 639 | 639 | |
| 640 | 640 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 641 | 641 | if ($default_value != '') {
|
| 642 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 642 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 645 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | } |
| 649 | 649 | // show lat lng |
| 650 | 650 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 651 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 651 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
|
|
| 652 | 652 | |
| 653 | 653 | if ($is_column) {
|
| 654 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 654 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 655 | 655 | $meta_field_add .= " DEFAULT '1'"; |
| 656 | 656 | |
| 657 | 657 | $wpdb->query($meta_field_add); |
| 658 | 658 | } else {
|
| 659 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 659 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | 660 | |
| 661 | 661 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 662 | 662 | $meta_field_add .= " DEFAULT '1'"; |
| 663 | 663 | |
| 664 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 664 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | } |
@@ -677,30 +677,30 @@ discard block |
||
| 677 | 677 | $op_size = '500'; |
| 678 | 678 | |
| 679 | 679 | // only make the field as big as it needs to be. |
| 680 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 681 | - $option_values_arr = explode(',',$option_values);
|
|
| 682 | - if(is_array($option_values_arr)){
|
|
| 680 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 681 | + $option_values_arr = explode(',', $option_values);
|
|
| 682 | + if (is_array($option_values_arr)) {
|
|
| 683 | 683 | $op_max = 0; |
| 684 | - foreach($option_values_arr as $op_val){
|
|
| 685 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 684 | + foreach ($option_values_arr as $op_val) {
|
|
| 685 | + if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
|
|
| 686 | 686 | } |
| 687 | - if($op_max){$op_size =$op_max; }
|
|
| 687 | + if ($op_max) {$op_size = $op_max; }
|
|
| 688 | 688 | } |
| 689 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 690 | - if(strlen($option_values)){
|
|
| 691 | - $op_size = strlen($option_values); |
|
| 689 | + }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 690 | + if (strlen($option_values)) {
|
|
| 691 | + $op_size = strlen($option_values); |
|
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 695 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL"; |
|
| 696 | 696 | |
| 697 | 697 | if ($default_value != '') {
|
| 698 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 698 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | $alter_result = $wpdb->query($meta_field_add); |
| 702 | - if($alter_result===false){
|
|
| 703 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 702 | + if ($alter_result === false) {
|
|
| 703 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | if (isset($request_field['cat_display_type'])) |
@@ -717,9 +717,9 @@ discard block |
||
| 717 | 717 | case 'url': |
| 718 | 718 | case 'file': |
| 719 | 719 | |
| 720 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 721 | - if($alter_result===false){
|
|
| 722 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 720 | + $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
|
|
| 721 | + if ($alter_result === false) {
|
|
| 722 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 723 | 723 | } |
| 724 | 724 | if (isset($request_field['advanced_editor'])) |
| 725 | 725 | $extra_fields = $request_field['advanced_editor']; |
@@ -733,24 +733,24 @@ discard block |
||
| 733 | 733 | default: |
| 734 | 734 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 735 | 735 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 736 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 736 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL"; |
|
| 737 | 737 | } else {
|
| 738 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 738 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL"; |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | if (is_numeric($default_value) && $default_value != '') {
|
| 742 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 742 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 743 | 743 | } |
| 744 | 744 | } else {
|
| 745 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 745 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL"; |
|
| 746 | 746 | if ($default_value != '') {
|
| 747 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 747 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 748 | 748 | } |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | $alter_result = $wpdb->query($default_value_add); |
| 752 | - if($alter_result===false){
|
|
| 753 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 752 | + if ($alter_result === false) {
|
|
| 753 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 754 | 754 | } |
| 755 | 755 | break; |
| 756 | 756 | endswitch; |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | |
| 767 | 767 | $wpdb->prepare( |
| 768 | 768 | |
| 769 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 769 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 770 | 770 | post_type = %s, |
| 771 | 771 | admin_title = %s, |
| 772 | 772 | site_title = %s, |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | for_admin_use = %s |
| 799 | 799 | where id = %d", |
| 800 | 800 | |
| 801 | - array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 801 | + array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf) |
|
| 802 | 802 | ) |
| 803 | 803 | |
| 804 | 804 | ); |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | |
| 809 | 809 | $wpdb->query( |
| 810 | 810 | $wpdb->prepare( |
| 811 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 811 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 812 | 812 | site_title=%s |
| 813 | 813 | where post_type = %s and htmlvar_name = %s", |
| 814 | 814 | array($site_title, $post_type, $htmlvar_name) |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | |
| 819 | 819 | if ($cat_sort == '') |
| 820 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 820 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 821 | 821 | |
| 822 | 822 | |
| 823 | 823 | /** |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | $data_type = ''; |
| 838 | 838 | |
| 839 | 839 | if ($htmlvar_name != '') {
|
| 840 | - $prefix = $htmlvar_name . '_'; |
|
| 840 | + $prefix = $htmlvar_name.'_'; |
|
| 841 | 841 | } |
| 842 | 842 | $old_prefix = $old_html_variable; |
| 843 | 843 | |
@@ -845,109 +845,109 @@ discard block |
||
| 845 | 845 | |
| 846 | 846 | $meta_field_add = "VARCHAR( 254 ) NULL"; |
| 847 | 847 | if ($default_value != '') {
|
| 848 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 848 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 851 | + geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add); |
|
| 852 | 852 | //$wpdb->query($meta_field_add); |
| 853 | 853 | |
| 854 | 854 | |
| 855 | 855 | if (!empty($extra_fields)) {
|
| 856 | 856 | |
| 857 | 857 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 858 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 858 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL"; |
|
| 859 | 859 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 860 | 860 | if ($default_value != '') {
|
| 861 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 861 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 862 | 862 | } |
| 863 | 863 | |
| 864 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 864 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 865 | 865 | //$wpdb->query($meta_field_add); |
| 866 | 866 | } |
| 867 | 867 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 868 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 868 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL"; |
|
| 869 | 869 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 870 | 870 | if ($default_value != '') {
|
| 871 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 871 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 874 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 875 | 875 | //$wpdb->query($meta_field_add); |
| 876 | 876 | } |
| 877 | 877 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 878 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 878 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL"; |
|
| 879 | 879 | |
| 880 | 880 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 881 | 881 | if ($default_value != '') {
|
| 882 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 882 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 885 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 886 | 886 | //$wpdb->query($meta_field_add); |
| 887 | 887 | } |
| 888 | 888 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 889 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 889 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL"; |
|
| 890 | 890 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 891 | 891 | if ($default_value != '') {
|
| 892 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 892 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 895 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 896 | 896 | //$wpdb->query($meta_field_add); |
| 897 | 897 | } |
| 898 | 898 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 899 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 899 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 900 | 900 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 901 | 901 | if ($default_value != '') {
|
| 902 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 902 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 905 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 906 | 906 | //$wpdb->query($meta_field_add); |
| 907 | 907 | |
| 908 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 908 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 909 | 909 | |
| 910 | 910 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 911 | 911 | if ($default_value != '') {
|
| 912 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 912 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 915 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 916 | 916 | |
| 917 | 917 | //$wpdb->query($meta_field_add); |
| 918 | 918 | } |
| 919 | 919 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 920 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 920 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 921 | 921 | |
| 922 | 922 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 923 | 923 | if ($default_value != '') {
|
| 924 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 924 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 925 | 925 | } |
| 926 | 926 | |
| 927 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 927 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 928 | 928 | |
| 929 | 929 | //$wpdb->query($meta_field_add); |
| 930 | 930 | } |
| 931 | 931 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 932 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 932 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 933 | 933 | |
| 934 | 934 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 935 | 935 | if ($default_value != '') {
|
| 936 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 936 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 939 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 940 | 940 | |
| 941 | 941 | //$wpdb->query($meta_field_add); |
| 942 | 942 | } |
| 943 | 943 | // show lat lng |
| 944 | 944 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 945 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 945 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 946 | 946 | |
| 947 | 947 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 948 | 948 | $meta_field_add .= " DEFAULT '1'"; |
| 949 | 949 | |
| 950 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 950 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 951 | 951 | //$wpdb->query($meta_field_add); |
| 952 | 952 | } |
| 953 | 953 | } |
@@ -957,8 +957,8 @@ discard block |
||
| 957 | 957 | case 'checkbox': |
| 958 | 958 | $data_type = 'TINYINT'; |
| 959 | 959 | |
| 960 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 961 | - if ((int)$default_value === 1) {
|
|
| 960 | + $meta_field_add = $data_type."( 1 ) NOT NULL "; |
|
| 961 | + if ((int) $default_value === 1) {
|
|
| 962 | 962 | $meta_field_add .= " DEFAULT '1'"; |
| 963 | 963 | } |
| 964 | 964 | |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | } |
| 992 | 992 | } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
| 993 | 993 | if (strlen($option_values)) {
|
| 994 | - $op_size = strlen($option_values); |
|
| 994 | + $op_size = strlen($option_values); |
|
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | if (isset($request_field['multi_display_type'])) {
|
@@ -999,9 +999,9 @@ discard block |
||
| 999 | 999 | } |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1002 | + $meta_field_add = $data_type."( $op_size ) NULL "; |
|
| 1003 | 1003 | if ($default_value != '') {
|
| 1004 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1004 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
@@ -1016,9 +1016,9 @@ discard block |
||
| 1016 | 1016 | |
| 1017 | 1017 | $data_type = 'TEXT'; |
| 1018 | 1018 | |
| 1019 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1019 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1020 | 1020 | |
| 1021 | - $meta_field_add = $data_type . " NULL "; |
|
| 1021 | + $meta_field_add = $data_type." NULL "; |
|
| 1022 | 1022 | /*if($default_value != '') |
| 1023 | 1023 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1024 | 1024 | |
@@ -1033,9 +1033,9 @@ discard block |
||
| 1033 | 1033 | |
| 1034 | 1034 | $data_type = 'DATE'; |
| 1035 | 1035 | |
| 1036 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1036 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1037 | 1037 | |
| 1038 | - $meta_field_add = $data_type . " NULL "; |
|
| 1038 | + $meta_field_add = $data_type." NULL "; |
|
| 1039 | 1039 | |
| 1040 | 1040 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1041 | 1041 | if ($add_result === false) {
|
@@ -1048,9 +1048,9 @@ discard block |
||
| 1048 | 1048 | |
| 1049 | 1049 | $data_type = 'TIME'; |
| 1050 | 1050 | |
| 1051 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1051 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1052 | 1052 | |
| 1053 | - $meta_field_add = $data_type . " NULL "; |
|
| 1053 | + $meta_field_add = $data_type." NULL "; |
|
| 1054 | 1054 | |
| 1055 | 1055 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1056 | 1056 | if ($add_result === false) {
|
@@ -1062,22 +1062,22 @@ discard block |
||
| 1062 | 1062 | default: |
| 1063 | 1063 | |
| 1064 | 1064 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 1065 | - $meta_field_add = $data_type . " NULL "; |
|
| 1065 | + $meta_field_add = $data_type." NULL "; |
|
| 1066 | 1066 | |
| 1067 | 1067 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 1068 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1068 | + $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL "; |
|
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | 1071 | if (is_numeric($default_value) && $default_value != '') {
|
| 1072 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1073 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1072 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1073 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1074 | 1074 | } |
| 1075 | 1075 | } else {
|
| 1076 | 1076 | $meta_field_add = " VARCHAR( 254 ) NULL "; |
| 1077 | 1077 | |
| 1078 | 1078 | if ($default_value != '') {
|
| 1079 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1079 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1080 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | } |
| 1083 | 1083 | |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | |
| 1100 | 1100 | $wpdb->prepare( |
| 1101 | 1101 | |
| 1102 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1102 | + "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1103 | 1103 | post_type = %s, |
| 1104 | 1104 | admin_title = %s, |
| 1105 | 1105 | site_title = %s, |
@@ -1130,7 +1130,7 @@ discard block |
||
| 1130 | 1130 | validation_msg = %s, |
| 1131 | 1131 | for_admin_use = %s ", |
| 1132 | 1132 | |
| 1133 | - array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1133 | + array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use) |
|
| 1134 | 1134 | |
| 1135 | 1135 | ) |
| 1136 | 1136 | |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | - return (int)$lastid; |
|
| 1145 | + return (int) $lastid; |
|
| 1146 | 1146 | |
| 1147 | 1147 | |
| 1148 | 1148 | } else {
|
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | |
| 1176 | 1176 | $post_meta_info = $wpdb->query( |
| 1177 | 1177 | $wpdb->prepare( |
| 1178 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1178 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1179 | 1179 | sort_order=%d |
| 1180 | 1180 | where id= %d", |
| 1181 | 1181 | array($count, $cf) |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | $value = ''; |
| 1232 | 1232 | |
| 1233 | 1233 | /* field available to site admin only for edit */ |
| 1234 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1234 | + $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; |
|
| 1235 | 1235 | if ($for_admin_use && !is_super_admin()) {
|
| 1236 | 1236 | continue; |
| 1237 | 1237 | } |
@@ -1265,22 +1265,22 @@ discard block |
||
| 1265 | 1265 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1266 | 1266 | * @see 'geodir_after_custom_form_field_$name' |
| 1267 | 1267 | */ |
| 1268 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1268 | + do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1269 | 1269 | |
| 1270 | 1270 | if ($type == 'fieldset') {
|
| 1271 | - $fieldset_id = (int)$val['id']; |
|
| 1272 | - $fieldset_field_class = 'gd-fieldset-' . $fieldset_id; |
|
| 1271 | + $fieldset_id = (int) $val['id']; |
|
| 1272 | + $fieldset_field_class = 'gd-fieldset-'.$fieldset_id; |
|
| 1273 | 1273 | ?> |
| 1274 | - <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?> |
|
| 1275 | - <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5> |
|
| 1274 | + <h5 id="geodir_fieldset_<?php echo $fieldset_id; ?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id; ?>"><?php echo $site_title; ?> |
|
| 1275 | + <?php if ($admin_desc != '') echo '<small>( '.$admin_desc.' )</small>'; ?></h5> |
|
| 1276 | 1276 | <?php |
| 1277 | 1277 | } else if ($type == 'address') {
|
| 1278 | - $prefix = $name . '_'; |
|
| 1278 | + $prefix = $name.'_'; |
|
| 1279 | 1279 | |
| 1280 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 1281 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 1280 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address'); |
|
| 1281 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code '); |
|
| 1282 | 1282 | ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
|
| 1283 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 1283 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview'); |
|
| 1284 | 1284 | |
| 1285 | 1285 | $address = ''; |
| 1286 | 1286 | $zip = ''; |
@@ -1291,21 +1291,21 @@ discard block |
||
| 1291 | 1291 | |
| 1292 | 1292 | if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
| 1293 | 1293 | $post = $gd_ses_listing; |
| 1294 | - $address = $post[$prefix . 'address']; |
|
| 1295 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1296 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1297 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1298 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1299 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1294 | + $address = $post[$prefix.'address']; |
|
| 1295 | + $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : ''; |
|
| 1296 | + $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : ''; |
|
| 1297 | + $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : ''; |
|
| 1298 | + $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : ''; |
|
| 1299 | + $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : ''; |
|
| 1300 | 1300 | } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
|
| 1301 | - $post_info = (array)$post_info; |
|
| 1302 | - |
|
| 1303 | - $address = $post_info[$prefix . 'address']; |
|
| 1304 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1305 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1306 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1307 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1308 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1301 | + $post_info = (array) $post_info; |
|
| 1302 | + |
|
| 1303 | + $address = $post_info[$prefix.'address']; |
|
| 1304 | + $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : ''; |
|
| 1305 | + $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : ''; |
|
| 1306 | + $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : ''; |
|
| 1307 | + $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : ''; |
|
| 1308 | + $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : ''; |
|
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | 1311 | $location = geodir_get_default_location(); |
@@ -1342,16 +1342,16 @@ discard block |
||
| 1342 | 1342 | |
| 1343 | 1343 | ?> |
| 1344 | 1344 | |
| 1345 | - <div id="geodir_<?php echo $prefix . 'address';?>_row" |
|
| 1346 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1345 | + <div id="geodir_<?php echo $prefix.'address'; ?>_row" |
|
| 1346 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1347 | 1347 | <label> |
| 1348 | 1348 | <?php _e($address_title, 'geodirectory'); ?> |
| 1349 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1349 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1350 | 1350 | </label> |
| 1351 | - <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>" |
|
| 1352 | - id="<?php echo $prefix . 'address';?>" class="geodir_textfield" |
|
| 1351 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>" |
|
| 1352 | + id="<?php echo $prefix.'address'; ?>" class="geodir_textfield" |
|
| 1353 | 1353 | value="<?php echo esc_attr(stripslashes($address)); ?>"/> |
| 1354 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1354 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1355 | 1355 | <?php if ($is_required) { ?>
|
| 1356 | 1356 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1357 | 1357 | <?php } ?> |
@@ -1371,14 +1371,14 @@ discard block |
||
| 1371 | 1371 | |
| 1372 | 1372 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
|
| 1373 | 1373 | |
| 1374 | - <div id="geodir_<?php echo $prefix . 'zip'; ?>_row" |
|
| 1375 | - class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1374 | + <div id="geodir_<?php echo $prefix.'zip'; ?>_row" |
|
| 1375 | + class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1376 | 1376 | <label> |
| 1377 | 1377 | <?php _e($zip_title, 'geodirectory'); ?> |
| 1378 | 1378 | <?php /*if($is_required) echo '<span>*</span>';*/ ?> |
| 1379 | 1379 | </label> |
| 1380 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>" |
|
| 1381 | - id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill" |
|
| 1380 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>" |
|
| 1381 | + id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill" |
|
| 1382 | 1382 | value="<?php echo esc_attr(stripslashes($zip)); ?>"/> |
| 1383 | 1383 | <?php /*if($is_required) {?>
|
| 1384 | 1384 | <span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span> |
@@ -1388,14 +1388,14 @@ discard block |
||
| 1388 | 1388 | |
| 1389 | 1389 | <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
|
| 1390 | 1390 | |
| 1391 | - <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1391 | + <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1392 | 1392 | <?php |
| 1393 | 1393 | /** |
| 1394 | 1394 | * Contains add listing page map functions. |
| 1395 | 1395 | * |
| 1396 | 1396 | * @since 1.0.0 |
| 1397 | 1397 | */ |
| 1398 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1398 | + include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1399 | 1399 | if ($lat_lng_blank) {
|
| 1400 | 1400 | $lat = ''; |
| 1401 | 1401 | $lng = ''; |
@@ -1406,14 +1406,14 @@ discard block |
||
| 1406 | 1406 | <?php |
| 1407 | 1407 | /* show lat lng */ |
| 1408 | 1408 | $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
| 1409 | - <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
|
| 1410 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1409 | + <div id="geodir_<?php echo $prefix.'latitude'; ?>_row" |
|
| 1410 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>> |
|
| 1411 | 1411 | <label> |
| 1412 | 1412 | <?php echo PLACE_ADDRESS_LAT; ?> |
| 1413 | 1413 | <?php if ($is_required) echo '<span>*</span>'; ?> |
| 1414 | 1414 | </label> |
| 1415 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>" |
|
| 1416 | - id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield" |
|
| 1415 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>" |
|
| 1416 | + id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield" |
|
| 1417 | 1417 | value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/> |
| 1418 | 1418 | <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span> |
| 1419 | 1419 | <?php if ($is_required) { ?>
|
@@ -1421,14 +1421,14 @@ discard block |
||
| 1421 | 1421 | <?php } ?> |
| 1422 | 1422 | </div> |
| 1423 | 1423 | |
| 1424 | - <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row" |
|
| 1425 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1424 | + <div id="geodir_<?php echo $prefix.'longitude'; ?>_row" |
|
| 1425 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>> |
|
| 1426 | 1426 | <label> |
| 1427 | 1427 | <?php echo PLACE_ADDRESS_LNG; ?> |
| 1428 | 1428 | <?php if ($is_required) echo '<span>*</span>'; ?> |
| 1429 | 1429 | </label> |
| 1430 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>" |
|
| 1431 | - id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield" |
|
| 1430 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>" |
|
| 1431 | + id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield" |
|
| 1432 | 1432 | value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/> |
| 1433 | 1433 | <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span> |
| 1434 | 1434 | <?php if ($is_required) { ?>
|
@@ -1438,32 +1438,32 @@ discard block |
||
| 1438 | 1438 | <?php } ?> |
| 1439 | 1439 | |
| 1440 | 1440 | <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
|
| 1441 | - <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1441 | + <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1442 | 1442 | <label><?php _e($mapview_title, 'geodirectory'); ?></label> |
| 1443 | 1443 | |
| 1444 | 1444 | |
| 1445 | 1445 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1446 | 1446 | class="gd-checkbox" |
| 1447 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1448 | - id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
|
|
| 1447 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1448 | + id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
|
|
| 1449 | 1449 | echo 'checked="checked"'; |
| 1450 | 1450 | } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
|
| 1451 | 1451 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio" |
| 1452 | 1452 | class="gd-checkbox" |
| 1453 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1453 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1454 | 1454 | id="map_view1" <?php if ($mapview == 'SATELLITE') {
|
| 1455 | 1455 | echo 'checked="checked"'; |
| 1456 | 1456 | } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
|
| 1457 | 1457 | |
| 1458 | 1458 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1459 | 1459 | class="gd-checkbox" |
| 1460 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1460 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1461 | 1461 | id="map_view2" <?php if ($mapview == 'HYBRID') {
|
| 1462 | 1462 | echo 'checked="checked"'; |
| 1463 | 1463 | } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
|
| 1464 | 1464 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1465 | 1465 | class="gd-checkbox" |
| 1466 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1466 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1467 | 1467 | id="map_view3" <?php if ($mapview == 'TERRAIN') {
|
| 1468 | 1468 | echo 'checked="checked"'; |
| 1469 | 1469 | } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
|
@@ -1475,35 +1475,35 @@ discard block |
||
| 1475 | 1475 | <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
|
| 1476 | 1476 | <input type="hidden" value="<?php if (isset($mapzoom)) {
|
| 1477 | 1477 | echo esc_attr($mapzoom); |
| 1478 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1478 | + } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/> |
|
| 1479 | 1479 | <?php }?> |
| 1480 | 1480 | <?php } elseif ($type == 'text') {
|
| 1481 | 1481 | |
| 1482 | 1482 | //number and float validation $validation_pattern |
| 1483 | - if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
|
|
| 1484 | - elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
|
|
| 1483 | + if (isset($val['data_type']) && $val['data_type'] == 'INT') {$type = 'number'; }
|
|
| 1484 | + elseif (isset($val['data_type']) && $val['data_type'] == 'FLOAT') {$type = 'float'; }
|
|
| 1485 | 1485 | //print_r($val); |
| 1486 | 1486 | //validation |
| 1487 | - if(isset($val['validation_pattern']) && $val['validation_pattern']){
|
|
| 1487 | + if (isset($val['validation_pattern']) && $val['validation_pattern']) {
|
|
| 1488 | 1488 | $validation = 'pattern="'.$val['validation_pattern'].'"'; |
| 1489 | - }else{$validation='';}
|
|
| 1489 | + } else {$validation = ''; }
|
|
| 1490 | 1490 | |
| 1491 | 1491 | // validation message |
| 1492 | - if(isset($val['validation_msg']) && $val['validation_msg']){
|
|
| 1492 | + if (isset($val['validation_msg']) && $val['validation_msg']) {
|
|
| 1493 | 1493 | $validation_msg = 'title="'.$val['validation_msg'].'"'; |
| 1494 | - }else{$validation_msg='';}
|
|
| 1494 | + } else {$validation_msg = ''; }
|
|
| 1495 | 1495 | ?> |
| 1496 | 1496 | |
| 1497 | - <div id="<?php echo $name;?>_row" |
|
| 1498 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1497 | + <div id="<?php echo $name; ?>_row" |
|
| 1498 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1499 | 1499 | <label> |
| 1500 | 1500 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1501 | 1501 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1502 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1502 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1503 | 1503 | </label> |
| 1504 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
|
| 1505 | - value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> /> |
|
| 1506 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1504 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" |
|
| 1505 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> /> |
|
| 1506 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1507 | 1507 | <?php if ($is_required) { ?>
|
| 1508 | 1508 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1509 | 1509 | <?php } ?> |
@@ -1514,16 +1514,16 @@ discard block |
||
| 1514 | 1514 | $value = ''; |
| 1515 | 1515 | }?> |
| 1516 | 1516 | |
| 1517 | - <div id="<?php echo $name;?>_row" |
|
| 1518 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1517 | + <div id="<?php echo $name; ?>_row" |
|
| 1518 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1519 | 1519 | <label> |
| 1520 | 1520 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1521 | 1521 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1522 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1522 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1523 | 1523 | </label> |
| 1524 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
|
| 1525 | - value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/> |
|
| 1526 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1524 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" |
|
| 1525 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/> |
|
| 1526 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1527 | 1527 | <?php if ($is_required) { ?>
|
| 1528 | 1528 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1529 | 1529 | <?php } ?> |
@@ -1534,16 +1534,16 @@ discard block |
||
| 1534 | 1534 | $value = ''; |
| 1535 | 1535 | } ?> |
| 1536 | 1536 | |
| 1537 | - <div id="<?php echo $name;?>_row" |
|
| 1538 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1537 | + <div id="<?php echo $name; ?>_row" |
|
| 1538 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1539 | 1539 | <label> |
| 1540 | 1540 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1541 | 1541 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1542 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1542 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1543 | 1543 | </label> |
| 1544 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
|
| 1545 | - value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/> |
|
| 1546 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1544 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" |
|
| 1545 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/> |
|
| 1546 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1547 | 1547 | <?php if ($is_required) { ?>
|
| 1548 | 1548 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1549 | 1549 | <?php } ?> |
@@ -1554,31 +1554,31 @@ discard block |
||
| 1554 | 1554 | $value = ''; |
| 1555 | 1555 | }?> |
| 1556 | 1556 | |
| 1557 | - <div id="<?php echo $name;?>_row" |
|
| 1558 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1557 | + <div id="<?php echo $name; ?>_row" |
|
| 1558 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1559 | 1559 | <label> |
| 1560 | 1560 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1561 | 1561 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1562 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1562 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1563 | 1563 | </label> |
| 1564 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
|
| 1565 | - value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield" |
|
| 1564 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" |
|
| 1565 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield" |
|
| 1566 | 1566 | oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
|
| 1567 | 1567 | onchange="try{setCustomValidity('')}catch(e){}"
|
| 1568 | 1568 | /> |
| 1569 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1569 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1570 | 1570 | <?php if ($is_required) { ?>
|
| 1571 | 1571 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1572 | 1572 | <?php } ?> |
| 1573 | 1573 | </div> |
| 1574 | 1574 | |
| 1575 | 1575 | <?php } elseif ($type == 'radio') { ?>
|
| 1576 | - <div id="<?php echo $name;?>_row" |
|
| 1577 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1576 | + <div id="<?php echo $name; ?>_row" |
|
| 1577 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1578 | 1578 | <label> |
| 1579 | 1579 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1580 | 1580 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1581 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1581 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1582 | 1582 | </label> |
| 1583 | 1583 | <?php if ($option_values) {
|
| 1584 | 1584 | $option_values = geodir_string_values_to_options($option_values, true); |
@@ -1587,14 +1587,14 @@ discard block |
||
| 1587 | 1587 | foreach ($option_values as $option_value) {
|
| 1588 | 1588 | if (empty($option_value['optgroup'])) {
|
| 1589 | 1589 | ?> |
| 1590 | - <input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?> |
|
| 1590 | + <input name="<?php echo $name; ?>" id="<?php echo $name; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type; ?>" type="radio" /><?php echo $option_value['label']; ?> |
|
| 1591 | 1591 | <?php |
| 1592 | 1592 | } |
| 1593 | 1593 | } |
| 1594 | 1594 | } |
| 1595 | 1595 | } |
| 1596 | 1596 | ?> |
| 1597 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1597 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1598 | 1598 | <?php if ($is_required) { ?>
|
| 1599 | 1599 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1600 | 1600 | <?php } ?> |
@@ -1602,22 +1602,22 @@ discard block |
||
| 1602 | 1602 | |
| 1603 | 1603 | <?php } elseif ($type == 'checkbox') { ?>
|
| 1604 | 1604 | |
| 1605 | - <div id="<?php echo $name;?>_row" |
|
| 1606 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1605 | + <div id="<?php echo $name; ?>_row" |
|
| 1606 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1607 | 1607 | <label> |
| 1608 | 1608 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1609 | 1609 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1610 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1610 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1611 | 1611 | </label> |
| 1612 | 1612 | <?php if ($value != '1') {
|
| 1613 | 1613 | $value = '0'; |
| 1614 | 1614 | }?> |
| 1615 | - <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/> |
|
| 1615 | + <input type="hidden" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>"/> |
|
| 1616 | 1616 | <input <?php if ($value == '1') {
|
| 1617 | 1617 | echo 'checked="checked"'; |
| 1618 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox" |
|
| 1619 | - onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
|
|
| 1620 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1618 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $type; ?>" type="checkbox" |
|
| 1619 | + onchange="if(this.checked){jQuery('#<?php echo $name; ?>').val('1');} else{ jQuery('#<?php echo $name; ?>').val('0');}"/>
|
|
| 1620 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1621 | 1621 | <?php if ($is_required) { ?>
|
| 1622 | 1622 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1623 | 1623 | <?php } ?> |
@@ -1626,44 +1626,44 @@ discard block |
||
| 1626 | 1626 | <?php } elseif ($type == 'textarea') {
|
| 1627 | 1627 | ?> |
| 1628 | 1628 | |
| 1629 | - <div id="<?php echo $name;?>_row" |
|
| 1630 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1629 | + <div id="<?php echo $name; ?>_row" |
|
| 1630 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1631 | 1631 | <label> |
| 1632 | 1632 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1633 | 1633 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1634 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1634 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1635 | 1635 | </label><?php |
| 1636 | 1636 | |
| 1637 | 1637 | |
| 1638 | 1638 | if (is_array($extra_fields) && in_array('1', $extra_fields)) {
|
| 1639 | 1639 | |
| 1640 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
|
|
| 1640 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
|
|
| 1641 | 1641 | |
| 1642 | - <div class="editor" field_id="<?php echo $name;?>" field_type="editor"> |
|
| 1642 | + <div class="editor" field_id="<?php echo $name; ?>" field_type="editor"> |
|
| 1643 | 1643 | <?php wp_editor(stripslashes($value), $name, $editor_settings); ?> |
| 1644 | 1644 | </div><?php |
| 1645 | 1645 | |
| 1646 | 1646 | } else {
|
| 1647 | 1647 | |
| 1648 | - ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>" |
|
| 1649 | - id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php |
|
| 1648 | + ?><textarea field_type="<?php echo $type; ?>" class="geodir_textarea" name="<?php echo $name; ?>" |
|
| 1649 | + id="<?php echo $name; ?>"><?php echo stripslashes($value); ?></textarea><?php |
|
| 1650 | 1650 | |
| 1651 | 1651 | }?> |
| 1652 | 1652 | |
| 1653 | 1653 | |
| 1654 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1654 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1655 | 1655 | <?php if ($is_required) { ?>
|
| 1656 | 1656 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1657 | 1657 | <?php } ?> |
| 1658 | 1658 | </div> |
| 1659 | 1659 | |
| 1660 | 1660 | <?php } elseif ($type == 'select') { ?>
|
| 1661 | - <div id="<?php echo $name;?>_row" |
|
| 1662 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1661 | + <div id="<?php echo $name; ?>_row" |
|
| 1662 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1663 | 1663 | <label> |
| 1664 | 1664 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1665 | 1665 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1666 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1666 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1667 | 1667 | </label> |
| 1668 | 1668 | <?php |
| 1669 | 1669 | $option_values_arr = geodir_string_values_to_options($option_values, true); |
@@ -1673,22 +1673,22 @@ discard block |
||
| 1673 | 1673 | if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
|
| 1674 | 1674 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 1675 | 1675 | |
| 1676 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 1676 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>'; |
|
| 1677 | 1677 | } else {
|
| 1678 | 1678 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 1679 | 1679 | $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
| 1680 | 1680 | $selected = $option_value == $value ? 'selected="selected"' : ''; |
| 1681 | 1681 | |
| 1682 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 1682 | + $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>'; |
|
| 1683 | 1683 | } |
| 1684 | 1684 | } |
| 1685 | 1685 | } |
| 1686 | 1686 | ?> |
| 1687 | - <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
|
| 1687 | + <select field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" |
|
| 1688 | 1688 | class="geodir_textfield textfield_x chosen_select" |
| 1689 | - data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>"
|
|
| 1690 | - option-ajaxchosen="false"><?php echo $select_options;?></select> |
|
| 1691 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1689 | + data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'…'; ?>"
|
|
| 1690 | + option-ajaxchosen="false"><?php echo $select_options; ?></select> |
|
| 1691 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1692 | 1692 | <?php if ($is_required) { ?>
|
| 1693 | 1693 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1694 | 1694 | <?php } ?> |
@@ -1702,7 +1702,7 @@ discard block |
||
| 1702 | 1702 | } |
| 1703 | 1703 | ?> |
| 1704 | 1704 | <div id="<?php echo $name; ?>_row" |
| 1705 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1705 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1706 | 1706 | <label> |
| 1707 | 1707 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1708 | 1708 | echo (trim($site_title)) ? $site_title : ' '; ?> |
@@ -1728,9 +1728,9 @@ discard block |
||
| 1728 | 1728 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 1729 | 1729 | |
| 1730 | 1730 | if ($multi_display == 'select') {
|
| 1731 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 1731 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>'; |
|
| 1732 | 1732 | } else {
|
| 1733 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 1733 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : ''; |
|
| 1734 | 1734 | } |
| 1735 | 1735 | } else {
|
| 1736 | 1736 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
@@ -1755,9 +1755,9 @@ discard block |
||
| 1755 | 1755 | } |
| 1756 | 1756 | |
| 1757 | 1757 | if ($multi_display == 'select') {
|
| 1758 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 1758 | + $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>'; |
|
| 1759 | 1759 | } else {
|
| 1760 | - $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 1760 | + $select_options .= '<li><input name="'.$name.'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" /> '.$option_label.' </li>'; |
|
| 1761 | 1761 | } |
| 1762 | 1762 | } |
| 1763 | 1763 | } |
@@ -1776,7 +1776,7 @@ discard block |
||
| 1776 | 1776 | ?> |
| 1777 | 1777 | |
| 1778 | 1778 | <div id="<?php echo $name; ?>_row" |
| 1779 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1779 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1780 | 1780 | <label> |
| 1781 | 1781 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1782 | 1782 | echo (trim($site_title)) ? $site_title : ' '; ?> |
@@ -1806,8 +1806,8 @@ discard block |
||
| 1806 | 1806 | |
| 1807 | 1807 | $date_format = str_replace($search, $replace, $extra_fields['date_format']); |
| 1808 | 1808 | |
| 1809 | - if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
|
|
| 1810 | - if($value && !isset($_REQUEST['backandedit'])) {
|
|
| 1809 | + if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
|
|
| 1810 | + if ($value && !isset($_REQUEST['backandedit'])) {
|
|
| 1811 | 1811 | $time = strtotime($value); |
| 1812 | 1812 | $value = date($date_format, $time); |
| 1813 | 1813 | } |
@@ -1817,37 +1817,37 @@ discard block |
||
| 1817 | 1817 | |
| 1818 | 1818 | jQuery(function () {
|
| 1819 | 1819 | |
| 1820 | - jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
|
|
| 1820 | + jQuery("#<?php echo $name; ?>").datepicker({changeMonth: true, changeYear: true <?php
|
|
| 1821 | 1821 | /** |
| 1822 | 1822 | * Used to add extra option to datepicker per custom field. |
| 1823 | 1823 | * |
| 1824 | 1824 | * @since 1.5.7 |
| 1825 | 1825 | * @param string $name The custom field name. |
| 1826 | 1826 | */ |
| 1827 | - echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
|
|
| 1827 | + echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
|
|
| 1828 | 1828 | |
| 1829 | - jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format'];?>');
|
|
| 1829 | + jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format']; ?>');
|
|
| 1830 | 1830 | |
| 1831 | - <?php if(!empty($value)){?>
|
|
| 1832 | - jQuery("#<?php echo $name;?>").datepicker("setDate", "<?php echo $value;?>");
|
|
| 1831 | + <?php if (!empty($value)) {?>
|
|
| 1832 | + jQuery("#<?php echo $name; ?>").datepicker("setDate", "<?php echo $value; ?>");
|
|
| 1833 | 1833 | <?php } ?> |
| 1834 | 1834 | |
| 1835 | 1835 | }); |
| 1836 | 1836 | |
| 1837 | 1837 | </script> |
| 1838 | - <div id="<?php echo $name;?>_row" |
|
| 1839 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1838 | + <div id="<?php echo $name; ?>_row" |
|
| 1839 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1840 | 1840 | <label> |
| 1841 | 1841 | |
| 1842 | 1842 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1843 | 1843 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1844 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1844 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1845 | 1845 | </label> |
| 1846 | 1846 | |
| 1847 | - <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
|
| 1848 | - value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
|
| 1847 | + <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" |
|
| 1848 | + value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/> |
|
| 1849 | 1849 | |
| 1850 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1850 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1851 | 1851 | <?php if ($is_required) { ?>
|
| 1852 | 1852 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1853 | 1853 | <?php } ?> |
@@ -1861,25 +1861,25 @@ discard block |
||
| 1861 | 1861 | <script type="text/javascript"> |
| 1862 | 1862 | jQuery(document).ready(function () {
|
| 1863 | 1863 | |
| 1864 | - jQuery('#<?php echo $name;?>').timepicker({
|
|
| 1864 | + jQuery('#<?php echo $name; ?>').timepicker({
|
|
| 1865 | 1865 | showPeriod: true, |
| 1866 | 1866 | showLeadingZero: true, |
| 1867 | 1867 | showPeriod: true, |
| 1868 | 1868 | }); |
| 1869 | 1869 | }); |
| 1870 | 1870 | </script> |
| 1871 | - <div id="<?php echo $name;?>_row" |
|
| 1872 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1871 | + <div id="<?php echo $name; ?>_row" |
|
| 1872 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1873 | 1873 | <label> |
| 1874 | 1874 | |
| 1875 | 1875 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1876 | 1876 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1877 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1877 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1878 | 1878 | </label> |
| 1879 | - <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>" |
|
| 1880 | - id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
|
| 1879 | + <input readonly="readonly" field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" |
|
| 1880 | + id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/> |
|
| 1881 | 1881 | |
| 1882 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1882 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1883 | 1883 | <?php if ($is_required) { ?>
|
| 1884 | 1884 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1885 | 1885 | <?php } ?> |
@@ -1889,15 +1889,15 @@ discard block |
||
| 1889 | 1889 | if ($value == $val['default']) {
|
| 1890 | 1890 | $value = ''; |
| 1891 | 1891 | } ?> |
| 1892 | - <div id="<?php echo $name;?>_row" |
|
| 1893 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1892 | + <div id="<?php echo $name; ?>_row" |
|
| 1893 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 1894 | 1894 | <label> |
| 1895 | 1895 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1896 | 1896 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1897 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1897 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1898 | 1898 | </label> |
| 1899 | 1899 | |
| 1900 | - <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
|
| 1900 | + <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
|
| 1901 | 1901 | <?php |
| 1902 | 1902 | global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
| 1903 | 1903 | |
@@ -1909,7 +1909,7 @@ discard block |
||
| 1909 | 1909 | |
| 1910 | 1910 | $package_info = array(); |
| 1911 | 1911 | |
| 1912 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1912 | + $package_info = (array) geodir_post_package_info($package_info, $post, $post_type); |
|
| 1913 | 1913 | |
| 1914 | 1914 | if (!empty($package_info)) {
|
| 1915 | 1915 | |
@@ -1938,7 +1938,7 @@ discard block |
||
| 1938 | 1938 | |
| 1939 | 1939 | $catadd_limit = $wpdb->get_var( |
| 1940 | 1940 | $wpdb->prepare( |
| 1941 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1941 | + "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d", |
|
| 1942 | 1942 | array($package_id) |
| 1943 | 1943 | ) |
| 1944 | 1944 | ); |
@@ -1954,13 +1954,13 @@ discard block |
||
| 1954 | 1954 | $required_limit_msg = ''; |
| 1955 | 1955 | if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
|
| 1956 | 1956 | |
| 1957 | - $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
|
|
| 1957 | + $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
|
|
| 1958 | 1958 | |
| 1959 | 1959 | } else {
|
| 1960 | 1960 | $required_limit_msg = $required_msg; |
| 1961 | 1961 | } |
| 1962 | 1962 | |
| 1963 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1963 | + echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']" />'; |
|
| 1964 | 1964 | |
| 1965 | 1965 | |
| 1966 | 1966 | if ($cat_display == 'select' || $cat_display == 'multiselect') {
|
@@ -1970,11 +1970,11 @@ discard block |
||
| 1970 | 1970 | if ($cat_display == 'multiselect') |
| 1971 | 1971 | $multiple = 'multiple="multiple"'; |
| 1972 | 1972 | |
| 1973 | - echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
|
|
| 1973 | + echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">';
|
|
| 1974 | 1974 | |
| 1975 | 1975 | |
| 1976 | 1976 | if ($cat_display == 'select') |
| 1977 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1977 | + echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
|
|
| 1978 | 1978 | |
| 1979 | 1979 | } |
| 1980 | 1980 | |
@@ -1992,7 +1992,7 @@ discard block |
||
| 1992 | 1992 | ?> |
| 1993 | 1993 | </div> |
| 1994 | 1994 | |
| 1995 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1995 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1996 | 1996 | <?php if ($is_required) { ?>
|
| 1997 | 1997 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1998 | 1998 | <?php } ?> |
@@ -2034,8 +2034,8 @@ discard block |
||
| 2034 | 2034 | $file_totImg = count($curImages); |
| 2035 | 2035 | } |
| 2036 | 2036 | |
| 2037 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
|
|
| 2038 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
|
|
| 2037 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
|
|
| 2038 | + $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
|
|
| 2039 | 2039 | |
| 2040 | 2040 | ?> |
| 2041 | 2041 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
@@ -2045,13 +2045,13 @@ discard block |
||
| 2045 | 2045 | </h5> <?php */ |
| 2046 | 2046 | ?> |
| 2047 | 2047 | |
| 2048 | - <div id="<?php echo $name;?>_row" |
|
| 2049 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 2048 | + <div id="<?php echo $name; ?>_row" |
|
| 2049 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>"> |
|
| 2050 | 2050 | |
| 2051 | 2051 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 2052 | 2052 | <label |
| 2053 | 2053 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 2054 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 2054 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label> |
|
| 2055 | 2055 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 2056 | 2056 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 2057 | 2057 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -2059,7 +2059,7 @@ discard block |
||
| 2059 | 2059 | id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/> |
| 2060 | 2060 | <?php if ($allowed_file_types != '') { ?>
|
| 2061 | 2061 | <input type="hidden" name="<?php echo $file_id; ?>_allowed_types" |
| 2062 | - id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/> |
|
| 2062 | + id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/> |
|
| 2063 | 2063 | <?php } ?> |
| 2064 | 2064 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
| 2065 | 2065 | value="<?php if (isset($file_totImg)) {
|
@@ -2075,10 +2075,10 @@ discard block |
||
| 2075 | 2075 | <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
|
| 2076 | 2076 | ?> |
| 2077 | 2077 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button" |
| 2078 | - value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
|
|
| 2078 | + value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
|
|
| 2079 | 2079 | class="geodir_button" style="margin-top:10px;"/> |
| 2080 | 2080 | <span class="ajaxnonceplu" |
| 2081 | - id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span> |
|
| 2081 | + id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span> |
|
| 2082 | 2082 | <?php if ($file_width && $file_height): ?> |
| 2083 | 2083 | <span class="plupload-resize"></span> |
| 2084 | 2084 | <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span> |
@@ -2098,7 +2098,7 @@ discard block |
||
| 2098 | 2098 | |
| 2099 | 2099 | </div> |
| 2100 | 2100 | </div> |
| 2101 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
|
|
| 2101 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
|
|
| 2102 | 2102 | <?php if ($is_required) { ?>
|
| 2103 | 2103 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 2104 | 2104 | <?php } ?> |
@@ -2117,7 +2117,7 @@ discard block |
||
| 2117 | 2117 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 2118 | 2118 | * @see 'geodir_before_custom_form_field_$name' |
| 2119 | 2119 | */ |
| 2120 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 2120 | + do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 2121 | 2121 | |
| 2122 | 2122 | } |
| 2123 | 2123 | |
@@ -2143,7 +2143,7 @@ discard block |
||
| 2143 | 2143 | |
| 2144 | 2144 | $filter = $wpdb->get_row( |
| 2145 | 2145 | $wpdb->prepare( |
| 2146 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 2146 | + "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'", |
|
| 2147 | 2147 | array($geodir_post_type) |
| 2148 | 2148 | ) |
| 2149 | 2149 | ); |
@@ -2203,7 +2203,7 @@ discard block |
||
| 2203 | 2203 | |
| 2204 | 2204 | $variables_array = array(); |
| 2205 | 2205 | |
| 2206 | - if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 2206 | + if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int) $type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 2207 | 2207 | continue; |
| 2208 | 2208 | } |
| 2209 | 2209 | |
@@ -2218,9 +2218,9 @@ discard block |
||
| 2218 | 2218 | //if($type['field_icon']) |
| 2219 | 2219 | |
| 2220 | 2220 | if (strpos($type['field_icon'], 'http') !== false) {
|
| 2221 | - $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 2221 | + $field_icon = ' background: url('.$type['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 2222 | 2222 | } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
|
| 2223 | - $field_icon = '<i class="' . $type['field_icon'] . '"></i>'; |
|
| 2223 | + $field_icon = '<i class="'.$type['field_icon'].'"></i>'; |
|
| 2224 | 2224 | } |
| 2225 | 2225 | //else{$field_icon = $type['field_icon'];}
|
| 2226 | 2226 | |
@@ -2232,9 +2232,9 @@ discard block |
||
| 2232 | 2232 | $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']); |
| 2233 | 2233 | |
| 2234 | 2234 | if ($field_set_start == 1) {
|
| 2235 | - echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>'; |
|
| 2235 | + echo '</div><div class="geodir-company_info field-group '.$type['htmlvar_name'].'"><h2 class="'.$fieldset_class.'">'.__($type['site_title'], 'geodirectory').'</h2>'; |
|
| 2236 | 2236 | } else {
|
| 2237 | - echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>'; |
|
| 2237 | + echo '<h2 class="'.$fieldset_class.'">'.__($type['site_title'], 'geodirectory').'</h2>'; |
|
| 2238 | 2238 | $field_set_start = 1; |
| 2239 | 2239 | } |
| 2240 | 2240 | |
@@ -2242,7 +2242,7 @@ discard block |
||
| 2242 | 2242 | |
| 2243 | 2243 | case 'address': |
| 2244 | 2244 | |
| 2245 | - $html_var = $type['htmlvar_name'] . '_address'; |
|
| 2245 | + $html_var = $type['htmlvar_name'].'_address'; |
|
| 2246 | 2246 | |
| 2247 | 2247 | if ($type['extra_fields']) {
|
| 2248 | 2248 | |
@@ -2258,17 +2258,17 @@ discard block |
||
| 2258 | 2258 | */ |
| 2259 | 2259 | $show_city_in_address = apply_filters('geodir_show_city_in_address', false);
|
| 2260 | 2260 | if (isset($extra_fields['show_city']) && $extra_fields['show_city'] && $show_city_in_address) {
|
| 2261 | - $field = $type['htmlvar_name'] . '_city'; |
|
| 2261 | + $field = $type['htmlvar_name'].'_city'; |
|
| 2262 | 2262 | if ($post->{$field}) {
|
| 2263 | - $addition_fields .= ', ' . $post->{$field};
|
|
| 2263 | + $addition_fields .= ', '.$post->{$field};
|
|
| 2264 | 2264 | } |
| 2265 | 2265 | } |
| 2266 | 2266 | |
| 2267 | 2267 | |
| 2268 | 2268 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 2269 | - $field = $type['htmlvar_name'] . '_zip'; |
|
| 2269 | + $field = $type['htmlvar_name'].'_zip'; |
|
| 2270 | 2270 | if ($post->{$field}) {
|
| 2271 | - $addition_fields .= ', ' . $post->{$field};
|
|
| 2271 | + $addition_fields .= ', '.$post->{$field};
|
|
| 2272 | 2272 | } |
| 2273 | 2273 | } |
| 2274 | 2274 | |
@@ -2345,28 +2345,28 @@ discard block |
||
| 2345 | 2345 | $i++; |
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;" itemscope itemtype="http://schema.org/PostalAddress">'; |
|
| 2349 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2350 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2348 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;" itemscope itemtype="http://schema.org/PostalAddress">'; |
|
| 2349 | + $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2350 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ' '; |
|
| 2351 | 2351 | $html .= '</span>'; |
| 2352 | 2352 | |
| 2353 | 2353 | if ($preview) {
|
| 2354 | - $html .= stripslashes($post->{$html_var}) . $addition_fields . '</p></div>';
|
|
| 2354 | + $html .= stripslashes($post->{$html_var}).$addition_fields.'</p></div>';
|
|
| 2355 | 2355 | } else {
|
| 2356 | 2356 | if ($post->post_address) {
|
| 2357 | - $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 2357 | + $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>'; |
|
| 2358 | 2358 | } |
| 2359 | 2359 | if ($post->post_city) {
|
| 2360 | - $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 2360 | + $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>'; |
|
| 2361 | 2361 | } |
| 2362 | 2362 | if ($post->post_region) {
|
| 2363 | - $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 2363 | + $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>'; |
|
| 2364 | 2364 | } |
| 2365 | 2365 | if ($post->post_zip) {
|
| 2366 | - $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 2366 | + $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>'; |
|
| 2367 | 2367 | } |
| 2368 | 2368 | if ($post->post_country) {
|
| 2369 | - $html .= '<span itemprop="addressCountry">' . __($post->post_country, 'geodirectory') . '</span><br>'; |
|
| 2369 | + $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>'; |
|
| 2370 | 2370 | } |
| 2371 | 2371 | $html .= '</div>'; |
| 2372 | 2372 | } |
@@ -2406,7 +2406,7 @@ discard block |
||
| 2406 | 2406 | |
| 2407 | 2407 | $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
| 2408 | 2408 | $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title']; |
| 2409 | - if(!empty($type['default_value'])){$title = $type['default_value'];}
|
|
| 2409 | + if (!empty($type['default_value'])) {$title = $type['default_value']; }
|
|
| 2410 | 2410 | $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
| 2411 | 2411 | |
| 2412 | 2412 | |
@@ -2432,7 +2432,7 @@ discard block |
||
| 2432 | 2432 | * @param string $website Website URL. |
| 2433 | 2433 | * @param int $post->ID Post ID. |
| 2434 | 2434 | */ |
| 2435 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
|
|
| 2435 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
|
|
| 2436 | 2436 | |
| 2437 | 2437 | endif; |
| 2438 | 2438 | |
@@ -2463,9 +2463,9 @@ discard block |
||
| 2463 | 2463 | $i++; |
| 2464 | 2464 | } |
| 2465 | 2465 | |
| 2466 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 2467 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2468 | - $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}) . '">' . stripslashes($post->{$type['htmlvar_name']}) . '</a></div>';
|
|
| 2466 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af. |
|
| 2467 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ' '; |
|
| 2468 | + $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$type['htmlvar_name']}).'">'.stripslashes($post->{$type['htmlvar_name']}).'</a></div>';
|
|
| 2469 | 2469 | |
| 2470 | 2470 | endif; |
| 2471 | 2471 | |
@@ -2501,9 +2501,9 @@ discard block |
||
| 2501 | 2501 | $i++; |
| 2502 | 2502 | } |
| 2503 | 2503 | |
| 2504 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2505 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2506 | - $html .= '</span>' . stripslashes($value) . '</div>'; |
|
| 2504 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2505 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ' '; |
|
| 2506 | + $html .= '</span>'.stripslashes($value).'</div>'; |
|
| 2507 | 2507 | |
| 2508 | 2508 | endif; |
| 2509 | 2509 | |
@@ -2519,17 +2519,17 @@ discard block |
||
| 2519 | 2519 | $date_format = $date_format['date_format']; |
| 2520 | 2520 | } |
| 2521 | 2521 | |
| 2522 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
|
|
| 2523 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format
|
|
| 2522 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
|
|
| 2523 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
|
|
| 2524 | 2524 | |
| 2525 | 2525 | $date_format = str_replace($search, $replace, $date_format); |
| 2526 | 2526 | |
| 2527 | 2527 | $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
|
| 2528 | 2528 | |
| 2529 | 2529 | $value = ''; |
| 2530 | - if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
|
|
| 2530 | + if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']} != "0000-00-00") {
|
|
| 2531 | 2531 | $value = date($date_format, strtotime($post_htmlvar_value)); |
| 2532 | - }else{
|
|
| 2532 | + } else {
|
|
| 2533 | 2533 | continue; |
| 2534 | 2534 | } |
| 2535 | 2535 | |
@@ -2552,9 +2552,9 @@ discard block |
||
| 2552 | 2552 | $i++; |
| 2553 | 2553 | } |
| 2554 | 2554 | |
| 2555 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2556 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2557 | - $html .= '</span>' . $value . '</div>'; |
|
| 2555 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2556 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 2557 | + $html .= '</span>'.$value.'</div>'; |
|
| 2558 | 2558 | |
| 2559 | 2559 | endif; |
| 2560 | 2560 | |
@@ -2585,9 +2585,9 @@ discard block |
||
| 2585 | 2585 | $i++; |
| 2586 | 2586 | } |
| 2587 | 2587 | |
| 2588 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2589 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 2590 | - $html .= '</span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
|
|
| 2588 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2589 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ' '; |
|
| 2590 | + $html .= '</span>'.stripslashes($post->{$type['htmlvar_name']}).'</div>';
|
|
| 2591 | 2591 | |
| 2592 | 2592 | elseif (isset($post->{$type['htmlvar_name']}) && $post->{$type['htmlvar_name']}):
|
| 2593 | 2593 | |
@@ -2610,9 +2610,9 @@ discard block |
||
| 2610 | 2610 | $i++; |
| 2611 | 2611 | } |
| 2612 | 2612 | |
| 2613 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2614 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2615 | - $html .= '</span>' . stripslashes($post->{$type['htmlvar_name']}) . '</div>';
|
|
| 2613 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2614 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 2615 | + $html .= '</span>'.stripslashes($post->{$type['htmlvar_name']}).'</div>';
|
|
| 2616 | 2616 | |
| 2617 | 2617 | endif; |
| 2618 | 2618 | |
@@ -2621,7 +2621,7 @@ discard block |
||
| 2621 | 2621 | case 'radio': |
| 2622 | 2622 | |
| 2623 | 2623 | $html_var = $type['htmlvar_name']; |
| 2624 | - if(!isset($post->{$type['htmlvar_name']})){continue;}
|
|
| 2624 | + if (!isset($post->{$type['htmlvar_name']})) {continue; }
|
|
| 2625 | 2625 | $html_val = __($post->{$type['htmlvar_name']}, 'geodirectory');
|
| 2626 | 2626 | if ($post->{$type['htmlvar_name']} != ''):
|
| 2627 | 2627 | |
@@ -2662,9 +2662,9 @@ discard block |
||
| 2662 | 2662 | $i++; |
| 2663 | 2663 | } |
| 2664 | 2664 | |
| 2665 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2666 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2667 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 2665 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2666 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 2667 | + $html .= '</span>'.$html_val.'</div>'; |
|
| 2668 | 2668 | endif; |
| 2669 | 2669 | |
| 2670 | 2670 | break; |
@@ -2673,7 +2673,7 @@ discard block |
||
| 2673 | 2673 | |
| 2674 | 2674 | $html_var = $type['htmlvar_name']; |
| 2675 | 2675 | |
| 2676 | - if ((int)$post->{$html_var} == 1):
|
|
| 2676 | + if ((int) $post->{$html_var} == 1):
|
|
| 2677 | 2677 | |
| 2678 | 2678 | if ($post->{$type['htmlvar_name']} == '1'):
|
| 2679 | 2679 | $html_val = __('Yes', 'geodirectory');
|
@@ -2700,9 +2700,9 @@ discard block |
||
| 2700 | 2700 | $i++; |
| 2701 | 2701 | } |
| 2702 | 2702 | |
| 2703 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2704 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2705 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 2703 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2704 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 2705 | + $html .= '</span>'.$html_val.'</div>'; |
|
| 2706 | 2706 | endif; |
| 2707 | 2707 | |
| 2708 | 2708 | break; |
@@ -2710,7 +2710,7 @@ discard block |
||
| 2710 | 2710 | case 'select': |
| 2711 | 2711 | |
| 2712 | 2712 | $html_var = $type['htmlvar_name']; |
| 2713 | - if(!isset($post->{$type['htmlvar_name']})){continue;}
|
|
| 2713 | + if (!isset($post->{$type['htmlvar_name']})) {continue; }
|
|
| 2714 | 2714 | if ($post->{$type['htmlvar_name']}):
|
| 2715 | 2715 | $field_value = __($post->{$type['htmlvar_name']}, 'geodirectory');
|
| 2716 | 2716 | |
@@ -2745,9 +2745,9 @@ discard block |
||
| 2745 | 2745 | $i++; |
| 2746 | 2746 | } |
| 2747 | 2747 | |
| 2748 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2749 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2750 | - $html .= '</span>' . $field_value . '</div>'; |
|
| 2748 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2749 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 2750 | + $html .= '</span>'.$field_value.'</div>'; |
|
| 2751 | 2751 | endif; |
| 2752 | 2752 | |
| 2753 | 2753 | break; |
@@ -2797,15 +2797,15 @@ discard block |
||
| 2797 | 2797 | $i++; |
| 2798 | 2798 | } |
| 2799 | 2799 | |
| 2800 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2801 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2800 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2801 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 2802 | 2802 | $html .= '</span>'; |
| 2803 | 2803 | |
| 2804 | 2804 | if (count($option_values) > 1) {
|
| 2805 | 2805 | $html .= '<ul>'; |
| 2806 | 2806 | |
| 2807 | 2807 | foreach ($option_values as $val) {
|
| 2808 | - $html .= '<li>' . $val . '</li>'; |
|
| 2808 | + $html .= '<li>'.$val.'</li>'; |
|
| 2809 | 2809 | } |
| 2810 | 2810 | |
| 2811 | 2811 | $html .= '</ul>'; |
@@ -2831,7 +2831,7 @@ discard block |
||
| 2831 | 2831 | if (!$preview) {
|
| 2832 | 2832 | $b_send_inquiry = 'b_send_inquiry'; |
| 2833 | 2833 | $b_sendtofriend = 'b_sendtofriend'; |
| 2834 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 2834 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>'; |
|
| 2835 | 2835 | } |
| 2836 | 2836 | |
| 2837 | 2837 | if (strpos($field_icon, 'http') !== false) {
|
@@ -2853,26 +2853,26 @@ discard block |
||
| 2853 | 2853 | $i++; |
| 2854 | 2854 | } |
| 2855 | 2855 | |
| 2856 | - $html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2856 | + $html .= '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2857 | 2857 | $seperator = ''; |
| 2858 | 2858 | if ($post->{$type['htmlvar_name']}) {
|
| 2859 | - $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 2859 | + $html .= '<a href="javascript:void(0);" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>'; |
|
| 2860 | 2860 | $seperator = ' | '; |
| 2861 | 2861 | } |
| 2862 | 2862 | |
| 2863 | 2863 | if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
|
| 2864 | - $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 2864 | + $html .= $seperator.'<a href="javascript:void(0);" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>'; |
|
| 2865 | 2865 | } |
| 2866 | 2866 | |
| 2867 | 2867 | $html .= '</span></div>'; |
| 2868 | 2868 | |
| 2869 | 2869 | |
| 2870 | 2870 | if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
|
| 2871 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 2871 | + $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>'; |
|
| 2872 | 2872 | } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
|
| 2873 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 2873 | + $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>'; |
|
| 2874 | 2874 | } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
|
| 2875 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 2875 | + $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>'; |
|
| 2876 | 2876 | } |
| 2877 | 2877 | |
| 2878 | 2878 | /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
|
@@ -2899,11 +2899,11 @@ discard block |
||
| 2899 | 2899 | $i++; |
| 2900 | 2900 | } |
| 2901 | 2901 | |
| 2902 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 2903 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 2902 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af; |
|
| 2903 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 2904 | 2904 | $html .= '</span><span class="geodir-email-address-output">'; |
| 2905 | - $email = stripslashes($post->{$type['htmlvar_name']}) ;
|
|
| 2906 | - if($e_split = explode('@',$email)){
|
|
| 2905 | + $email = stripslashes($post->{$type['htmlvar_name']});
|
|
| 2906 | + if ($e_split = explode('@', $email)) {
|
|
| 2907 | 2907 | /** |
| 2908 | 2908 | * Filter email custom field name output. |
| 2909 | 2909 | * |
@@ -2912,10 +2912,10 @@ discard block |
||
| 2912 | 2912 | * @param string $email The email string being output. |
| 2913 | 2913 | * @param array $type Custom field variables array. |
| 2914 | 2914 | */ |
| 2915 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
|
|
| 2916 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
|
|
| 2917 | - }else{
|
|
| 2918 | - $html .= $email; |
|
| 2915 | + $email_name = apply_filters('geodir_email_field_name_output', $email, $type);
|
|
| 2916 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
|
|
| 2917 | + } else {
|
|
| 2918 | + $html .= $email; |
|
| 2919 | 2919 | } |
| 2920 | 2920 | $html .= '</span></div>'; |
| 2921 | 2921 | } |
@@ -2935,7 +2935,7 @@ discard block |
||
| 2935 | 2935 | if (!empty($files)): |
| 2936 | 2936 | |
| 2937 | 2937 | $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL; |
| 2938 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 2938 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
|
|
| 2939 | 2939 | |
| 2940 | 2940 | $file_paths = ''; |
| 2941 | 2941 | foreach ($files as $file) {
|
@@ -2972,9 +2972,9 @@ discard block |
||
| 2972 | 2972 | //$file_paths .= '<img src="'.$file.'" />'; |
| 2973 | 2973 | $file_paths .= '</div>'; |
| 2974 | 2974 | } else {
|
| 2975 | - $ext_path = '_' . $html_var . '_'; |
|
| 2975 | + $ext_path = '_'.$html_var.'_'; |
|
| 2976 | 2976 | $filename = explode($ext_path, $filename); |
| 2977 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 2977 | + $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>'; |
|
| 2978 | 2978 | } |
| 2979 | 2979 | } |
| 2980 | 2980 | } |
@@ -2998,11 +2998,11 @@ discard block |
||
| 2998 | 2998 | $i++; |
| 2999 | 2999 | } |
| 3000 | 3000 | |
| 3001 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' geodir-custom-file-box ' . $type['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3001 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' geodir-custom-file-box '.$type['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af; |
|
| 3002 | 3002 | $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
| 3003 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3003 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 3004 | 3004 | $html .= '</span>'; |
| 3005 | - $html .= $file_paths . '</div></div>'; |
|
| 3005 | + $html .= $file_paths.'</div></div>'; |
|
| 3006 | 3006 | |
| 3007 | 3007 | endif; |
| 3008 | 3008 | endif; |
@@ -3033,9 +3033,9 @@ discard block |
||
| 3033 | 3033 | $i++; |
| 3034 | 3034 | } |
| 3035 | 3035 | |
| 3036 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3037 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3038 | - $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
|
|
| 3036 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af; |
|
| 3037 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 3038 | + $html .= '</span>'.wpautop(stripslashes($post->{$type['htmlvar_name']})).'</div>';
|
|
| 3039 | 3039 | |
| 3040 | 3040 | } |
| 3041 | 3041 | break; |
@@ -3062,16 +3062,16 @@ discard block |
||
| 3062 | 3062 | $i++; |
| 3063 | 3063 | } |
| 3064 | 3064 | |
| 3065 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3066 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3067 | - $html .= '</span>' . wpautop(stripslashes($post->{$type['htmlvar_name']})) . '</div>';
|
|
| 3065 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$type['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af; |
|
| 3066 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 3067 | + $html .= '</span>'.wpautop(stripslashes($post->{$type['htmlvar_name']})).'</div>';
|
|
| 3068 | 3068 | |
| 3069 | 3069 | } |
| 3070 | 3070 | break; |
| 3071 | 3071 | case 'taxonomy': {
|
| 3072 | 3072 | $html_var = $type['htmlvar_name']; |
| 3073 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
|
|
| 3074 | - $post_taxonomy = $post->post_type . 'category'; |
|
| 3073 | + if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
|
|
| 3074 | + $post_taxonomy = $post->post_type.'category'; |
|
| 3075 | 3075 | $field_value = $post->{$html_var};
|
| 3076 | 3076 | $links = array(); |
| 3077 | 3077 | $terms = array(); |
@@ -3089,7 +3089,7 @@ discard block |
||
| 3089 | 3089 | if ($term != '') {
|
| 3090 | 3090 | $term = get_term_by('id', $term, $html_var);
|
| 3091 | 3091 | if (is_object($term)) {
|
| 3092 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 3092 | + $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>"; |
|
| 3093 | 3093 | $terms[] = $term; |
| 3094 | 3094 | } |
| 3095 | 3095 | } |
@@ -3103,7 +3103,7 @@ discard block |
||
| 3103 | 3103 | $terms = $termsOrdered; |
| 3104 | 3104 | } |
| 3105 | 3105 | } |
| 3106 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
|
|
| 3106 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
|
|
| 3107 | 3107 | |
| 3108 | 3108 | if ($html_value != '') {
|
| 3109 | 3109 | if (strpos($field_icon, 'http') !== false) {
|
@@ -3124,9 +3124,9 @@ discard block |
||
| 3124 | 3124 | $i++; |
| 3125 | 3125 | } |
| 3126 | 3126 | |
| 3127 | - $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
| 3128 | - $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : ''; |
|
| 3129 | - $html .= '</span> ' . $html_value . '</div>'; |
|
| 3127 | + $html = '<div class="geodir_more_info '.$geodir_odd_even.' '.$type['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af; |
|
| 3128 | + $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory').': ' : ''; |
|
| 3129 | + $html .= '</span> '.$html_value.'</div>'; |
|
| 3130 | 3130 | } |
| 3131 | 3131 | } |
| 3132 | 3132 | } |
@@ -3246,7 +3246,7 @@ discard block |
||
| 3246 | 3246 | |
| 3247 | 3247 | $post_type = get_post_type($post_id); |
| 3248 | 3248 | //echo $field_id; exit; |
| 3249 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3249 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 3250 | 3250 | |
| 3251 | 3251 | $postcurr_images = array(); |
| 3252 | 3252 | $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
@@ -3265,13 +3265,13 @@ discard block |
||
| 3265 | 3265 | $geodir_uploadurl = $uploads['url']; |
| 3266 | 3266 | $sub_dir = $uploads['subdir']; |
| 3267 | 3267 | |
| 3268 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 3268 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
|
|
| 3269 | 3269 | |
| 3270 | 3270 | for ($m = 0; $m < count($post_image); $m++) {
|
| 3271 | 3271 | |
| 3272 | 3272 | /* --------- start ------- */ |
| 3273 | 3273 | |
| 3274 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 3274 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM ".$table." WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 3275 | 3275 | |
| 3276 | 3276 | |
| 3277 | 3277 | $curr_img_url = $post_image[$m]; |
@@ -3297,24 +3297,24 @@ discard block |
||
| 3297 | 3297 | //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
| 3298 | 3298 | |
| 3299 | 3299 | if (!function_exists('wp_handle_upload'))
|
| 3300 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 3300 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 3301 | 3301 | |
| 3302 | 3302 | if (!is_dir($geodir_uploadpath)) |
| 3303 | 3303 | mkdir($geodir_uploadpath); |
| 3304 | 3304 | |
| 3305 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 3305 | + $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1]; |
|
| 3306 | 3306 | $explode_sub_dir = explode("/", $sub_dir);
|
| 3307 | 3307 | if ($curr_img_dir == end($explode_sub_dir)) {
|
| 3308 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 3309 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 3308 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 3309 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 3310 | 3310 | } else {
|
| 3311 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 3312 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 3311 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 3312 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 3313 | 3313 | } |
| 3314 | 3314 | |
| 3315 | 3315 | $uploaded_file = ''; |
| 3316 | 3316 | if (file_exists($img_path)) |
| 3317 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 3317 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 3318 | 3318 | |
| 3319 | 3319 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 3320 | 3320 | if (file_exists($img_path)) |
@@ -3322,7 +3322,7 @@ discard block |
||
| 3322 | 3322 | } |
| 3323 | 3323 | |
| 3324 | 3324 | if (!empty($uploaded_file)) |
| 3325 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 3325 | + $file_urls = $geodir_uploadurl.'/'.$new_name; |
|
| 3326 | 3326 | |
| 3327 | 3327 | } else {
|
| 3328 | 3328 | $file_urls = $post_image[$m]; |
@@ -3336,8 +3336,8 @@ discard block |
||
| 3336 | 3336 | if (!empty($postcurr_images)) {
|
| 3337 | 3337 | |
| 3338 | 3338 | if ($file_urls != $postcurr_images) {
|
| 3339 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 3340 | - $invalid_files = (object)$invalid_files; |
|
| 3339 | + $invalid_files[] = (object) array('src' => $postcurr_images);
|
|
| 3340 | + $invalid_files = (object) $invalid_files; |
|
| 3341 | 3341 | } |
| 3342 | 3342 | } |
| 3343 | 3343 | |
@@ -3389,9 +3389,9 @@ discard block |
||
| 3389 | 3389 | function geodir_upload_dir($upload) |
| 3390 | 3390 | {
|
| 3391 | 3391 | global $current_user; |
| 3392 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 3393 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 3394 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 3392 | + $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID; |
|
| 3393 | + $upload['path'] = $upload['basedir'].$upload['subdir']; |
|
| 3394 | + $upload['url'] = $upload['baseurl'].$upload['subdir']; |
|
| 3395 | 3395 | return $upload; |
| 3396 | 3396 | } |
| 3397 | 3397 | |
@@ -3406,20 +3406,20 @@ discard block |
||
| 3406 | 3406 | // check ajax noonce |
| 3407 | 3407 | $imgid = $_POST["imgid"]; |
| 3408 | 3408 | |
| 3409 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 3409 | + check_ajax_referer($imgid.'pluploadan'); |
|
| 3410 | 3410 | |
| 3411 | 3411 | // handle custom file uploaddir |
| 3412 | 3412 | add_filter('upload_dir', 'geodir_upload_dir');
|
| 3413 | 3413 | |
| 3414 | 3414 | // change file orinetation if needed |
| 3415 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 3415 | + $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']); |
|
| 3416 | 3416 | |
| 3417 | 3417 | // handle file upload |
| 3418 | 3418 | $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
| 3419 | 3419 | // remove handle custom file uploaddir |
| 3420 | 3420 | remove_filter('upload_dir', 'geodir_upload_dir');
|
| 3421 | 3421 | |
| 3422 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 3422 | + if (!isset($status['url']) && isset($status['error'])) {
|
|
| 3423 | 3423 | print_r($status); |
| 3424 | 3424 | } |
| 3425 | 3425 | |
@@ -3449,9 +3449,9 @@ discard block |
||
| 3449 | 3449 | |
| 3450 | 3450 | $post_type = get_post_type($post_id); |
| 3451 | 3451 | |
| 3452 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3452 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 3453 | 3453 | |
| 3454 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 3454 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 3455 | 3455 | |
| 3456 | 3456 | if ($results) {
|
| 3457 | 3457 | return $results[0]->geodir_video; |
@@ -3475,9 +3475,9 @@ discard block |
||
| 3475 | 3475 | |
| 3476 | 3476 | $post_type = get_post_type($post_id); |
| 3477 | 3477 | |
| 3478 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 3478 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 3479 | 3479 | |
| 3480 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 3480 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 3481 | 3481 | |
| 3482 | 3482 | if ($results) {
|
| 3483 | 3483 | return $results[0]->geodir_special_offers; |
@@ -3495,12 +3495,12 @@ discard block |
||
| 3495 | 3495 | */ |
| 3496 | 3496 | function geodir_max_upload_size() |
| 3497 | 3497 | {
|
| 3498 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 3498 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 3499 | 3499 | |
| 3500 | 3500 | if ($max_filesize > 0 && $max_filesize < 1) {
|
| 3501 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 3501 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 3502 | 3502 | } else {
|
| 3503 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 3503 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 3504 | 3504 | } |
| 3505 | 3505 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 3506 | 3506 | return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
@@ -3532,7 +3532,7 @@ discard block |
||
| 3532 | 3532 | |
| 3533 | 3533 | $custom_fields = $wpdb->get_results( |
| 3534 | 3534 | $wpdb->prepare( |
| 3535 | - "select post_type,data_type,field_type,site_title,htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 3535 | + "select post_type,data_type,field_type,site_title,htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 3536 | 3536 | array($post_type) |
| 3537 | 3537 | ), 'ARRAY_A' |
| 3538 | 3538 | ); |
@@ -3649,7 +3649,7 @@ discard block |
||
| 3649 | 3649 | |
| 3650 | 3650 | $post_meta_info = $wpdb->query( |
| 3651 | 3651 | $wpdb->prepare( |
| 3652 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3652 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 3653 | 3653 | sort_order=%d |
| 3654 | 3654 | where id= %d", |
| 3655 | 3655 | array($count, $cf) |
@@ -3731,14 +3731,14 @@ discard block |
||
| 3731 | 3731 | |
| 3732 | 3732 | $check_html_variable = $wpdb->get_var( |
| 3733 | 3733 | $wpdb->prepare( |
| 3734 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 3734 | + "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 3735 | 3735 | array($cehhtmlvar_name, $post_type, $field_type) |
| 3736 | 3736 | ) |
| 3737 | 3737 | ); |
| 3738 | 3738 | |
| 3739 | 3739 | if ($is_default == 1) {
|
| 3740 | 3740 | |
| 3741 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 3741 | + $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 3742 | 3742 | |
| 3743 | 3743 | } |
| 3744 | 3744 | |
@@ -3749,7 +3749,7 @@ discard block |
||
| 3749 | 3749 | |
| 3750 | 3750 | $wpdb->prepare( |
| 3751 | 3751 | |
| 3752 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3752 | + "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 3753 | 3753 | post_type = %s, |
| 3754 | 3754 | data_type = %s, |
| 3755 | 3755 | field_type = %s, |
@@ -3780,7 +3780,7 @@ discard block |
||
| 3780 | 3780 | |
| 3781 | 3781 | $wpdb->prepare( |
| 3782 | 3782 | |
| 3783 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 3783 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 3784 | 3784 | post_type = %s, |
| 3785 | 3785 | data_type = %s, |
| 3786 | 3786 | field_type = %s, |
@@ -3806,7 +3806,7 @@ discard block |
||
| 3806 | 3806 | } |
| 3807 | 3807 | |
| 3808 | 3808 | |
| 3809 | - return (int)$lastid; |
|
| 3809 | + return (int) $lastid; |
|
| 3810 | 3810 | |
| 3811 | 3811 | } |
| 3812 | 3812 | } |
@@ -3829,7 +3829,7 @@ discard block |
||
| 3829 | 3829 | if ($field_id != '') {
|
| 3830 | 3830 | $cf = trim($field_id, '_'); |
| 3831 | 3831 | |
| 3832 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 3832 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 3833 | 3833 | |
| 3834 | 3834 | return $field_id; |
| 3835 | 3835 | |
@@ -3857,7 +3857,7 @@ discard block |
||
| 3857 | 3857 | global $wpdb; |
| 3858 | 3858 | $cf = $result_str; |
| 3859 | 3859 | if (!is_object($cf)) {
|
| 3860 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 3860 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
|
|
| 3861 | 3861 | } else {
|
| 3862 | 3862 | $field_info = $cf; |
| 3863 | 3863 | $result_str = $cf->id; |
@@ -3894,41 +3894,41 @@ discard block |
||
| 3894 | 3894 | if ($htmlvar_name == '') |
| 3895 | 3895 | $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
| 3896 | 3896 | |
| 3897 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 3897 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 3898 | 3898 | |
| 3899 | 3899 | ?> |
| 3900 | - <li class="text" id="licontainer_<?php echo $result_str;?>"> |
|
| 3901 | - <div class="title title<?php echo $result_str;?> gt-fieldset" |
|
| 3902 | - title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
|
| 3903 | - ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
|
| 3900 | + <li class="text" id="licontainer_<?php echo $result_str; ?>"> |
|
| 3901 | + <div class="title title<?php echo $result_str; ?> gt-fieldset" |
|
| 3902 | + title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
|
|
| 3903 | + ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
|
| 3904 | 3904 | <?php |
| 3905 | 3905 | |
| 3906 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 3906 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 3907 | 3907 | ?> |
| 3908 | 3908 | |
| 3909 | - <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
|
| 3910 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 3909 | + <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 3910 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 3911 | 3911 | class="handlediv close"></div> |
| 3912 | 3912 | |
| 3913 | 3913 | <b style="cursor:pointer;" |
| 3914 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
|
|
| 3914 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
|
|
| 3915 | 3915 | |
| 3916 | 3916 | </div> |
| 3917 | 3917 | |
| 3918 | - <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
|
| 3918 | + <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
|
| 3919 | 3919 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 3920 | 3920 | echo 'block;'; |
| 3921 | 3921 | } else {
|
| 3922 | 3922 | echo 'none;'; |
| 3923 | 3923 | } ?>"> |
| 3924 | 3924 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 3925 | - <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
|
| 3926 | - <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
|
| 3927 | - <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
|
| 3925 | + <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
|
| 3926 | + <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
|
| 3927 | + <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/> |
|
| 3928 | 3928 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 3929 | 3929 | echo $field_info->data_type; |
| 3930 | 3930 | }?>"/> |
| 3931 | - <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
|
| 3931 | + <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/> |
|
| 3932 | 3932 | |
| 3933 | 3933 | |
| 3934 | 3934 | <table class="widefat post fixed" border="0" style="width:100%;"> |
@@ -3952,7 +3952,7 @@ discard block |
||
| 3952 | 3952 | } ?>" style="width:45%;"/> |
| 3953 | 3953 | |
| 3954 | 3954 | <input type="radio" name="is_default" |
| 3955 | - value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
|
| 3955 | + value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
|
|
| 3956 | 3956 | echo 'checked="checked"'; |
| 3957 | 3957 | } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
| 3958 | 3958 | |
@@ -3975,7 +3975,7 @@ discard block |
||
| 3975 | 3975 | echo esc_attr($field_info->desc_title); |
| 3976 | 3976 | } ?>" style="width:45%;"/> |
| 3977 | 3977 | <input type="radio" name="is_default" |
| 3978 | - value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
|
| 3978 | + value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
|
|
| 3979 | 3979 | echo 'checked="checked"'; |
| 3980 | 3980 | } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
| 3981 | 3981 | <br/> |
@@ -4010,42 +4010,42 @@ discard block |
||
| 4010 | 4010 | <?php } ?> |
| 4011 | 4011 | |
| 4012 | 4012 | <tr> |
| 4013 | - <td><strong><?php _e('Is active :', 'geodirectory');?></strong></td>
|
|
| 4013 | + <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
|
|
| 4014 | 4014 | <td align="left"> |
| 4015 | 4015 | <select name="is_active" id="is_active"> |
| 4016 | 4016 | <option |
| 4017 | 4017 | value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
|
| 4018 | 4018 | echo 'selected="selected"'; |
| 4019 | - }?>><?php _e('Yes', 'geodirectory');?></option>
|
|
| 4019 | + }?>><?php _e('Yes', 'geodirectory'); ?></option>
|
|
| 4020 | 4020 | <option |
| 4021 | 4021 | value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
|
| 4022 | 4022 | echo 'selected="selected"'; |
| 4023 | - }?>><?php _e('No', 'geodirectory');?></option>
|
|
| 4023 | + }?>><?php _e('No', 'geodirectory'); ?></option>
|
|
| 4024 | 4024 | </select> |
| 4025 | 4025 | <br/> |
| 4026 | - <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
|
|
| 4026 | + <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory'); ?></span>
|
|
| 4027 | 4027 | </td> |
| 4028 | 4028 | </tr> |
| 4029 | 4029 | |
| 4030 | 4030 | <tr> |
| 4031 | - <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
|
|
| 4031 | + <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
|
|
| 4032 | 4032 | <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order" |
| 4033 | 4033 | value="<?php if (isset($field_info->sort_order)) {
|
| 4034 | 4034 | echo esc_attr($field_info->sort_order); |
| 4035 | 4035 | }?>" size="50"/> |
| 4036 | 4036 | <br/> |
| 4037 | - <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
|
|
| 4037 | + <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
|
|
| 4038 | 4038 | </td> |
| 4039 | 4039 | </tr> |
| 4040 | 4040 | |
| 4041 | 4041 | <tr> |
| 4042 | 4042 | <td> </td> |
| 4043 | 4043 | <td align="left"> |
| 4044 | - <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory');?>"
|
|
| 4045 | - onclick="save_sort_field('<?php echo $result_str;?>')"/>
|
|
| 4044 | + <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory'); ?>"
|
|
| 4045 | + onclick="save_sort_field('<?php echo $result_str; ?>')"/>
|
|
| 4046 | 4046 | |
| 4047 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory');?>"
|
|
| 4048 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 4047 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory'); ?>"
|
|
| 4048 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 4049 | 4049 | class="button_n"/></a> |
| 4050 | 4050 | |
| 4051 | 4051 | </td> |
@@ -4080,7 +4080,7 @@ discard block |
||
| 4080 | 4080 | if (!$package_id || !$field_name || !$post_type) {
|
| 4081 | 4081 | return true; |
| 4082 | 4082 | } |
| 4083 | - $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 4083 | + $sql = $wpdb->prepare("SELECT id FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
|
|
| 4084 | 4084 | |
| 4085 | 4085 | if ($wpdb->get_var($sql)) {
|
| 4086 | 4086 | return true; |
@@ -51,8 +51,9 @@ discard block |
||
| 51 | 51 | global $wpdb; |
| 52 | 52 | $result = 0;// no rows affected |
| 53 | 53 | if (!geodir_column_exist($db, $column)) {
|
| 54 | - if (!empty($db) && !empty($column)) |
|
| 55 | - $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 54 | + if (!empty($db) && !empty($column)) { |
|
| 55 | + $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr"); |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | return $result; |
| 58 | 59 | } |
@@ -82,10 +83,11 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | $default_query = ''; |
| 84 | 85 | |
| 85 | - if ($default == 'default') |
|
| 86 | - $default_query = " and is_default IN ('1') ";
|
|
| 87 | - elseif ($default == 'custom') |
|
| 88 | - $default_query = " and is_default = '0' "; |
|
| 86 | + if ($default == 'default') { |
|
| 87 | + $default_query = " and is_default IN ('1') "; |
|
| 88 | + } elseif ($default == 'custom') { |
|
| 89 | + $default_query = " and is_default = '0' "; |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | if ($fields_location == 'detail') {
|
| 91 | 93 | $default_query = " and show_on_detail='1' "; |
@@ -240,10 +242,12 @@ discard block |
||
| 240 | 242 | } |
| 241 | 243 | |
| 242 | 244 | return $field_id; |
| 243 | - } else |
|
| 244 | - return 0; |
|
| 245 | - } else |
|
| 246 | - return 0; |
|
| 245 | + } else { |
|
| 246 | + return 0; |
|
| 247 | + } |
|
| 248 | + } else { |
|
| 249 | + return 0; |
|
| 250 | + } |
|
| 247 | 251 | } |
| 248 | 252 | } |
| 249 | 253 | |
@@ -349,7 +353,9 @@ discard block |
||
| 349 | 353 | |
| 350 | 354 | |
| 351 | 355 | |
| 352 | - if ($post_type == '') $post_type = 'gd_place'; |
|
| 356 | + if ($post_type == '') { |
|
| 357 | + $post_type = 'gd_place'; |
|
| 358 | + } |
|
| 353 | 359 | |
| 354 | 360 | |
| 355 | 361 | $detail_table = $plugin_prefix . $post_type . '_detail'; |
@@ -382,20 +388,23 @@ discard block |
||
| 382 | 388 | } |
| 383 | 389 | |
| 384 | 390 | $option_values = ''; |
| 385 | - if (isset($request_field['option_values'])) |
|
| 386 | - $option_values = $request_field['option_values']; |
|
| 391 | + if (isset($request_field['option_values'])) { |
|
| 392 | + $option_values = $request_field['option_values']; |
|
| 393 | + } |
|
| 387 | 394 | |
| 388 | 395 | $cat_sort = ''; |
| 389 | - if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) |
|
| 390 | - $cat_sort = implode(",", $request_field['cat_sort']);
|
|
| 396 | + if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) { |
|
| 397 | + $cat_sort = implode(",", $request_field['cat_sort']); |
|
| 398 | + } |
|
| 391 | 399 | |
| 392 | 400 | $cat_filter = ''; |
| 393 | - if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) |
|
| 394 | - $cat_filter = implode(",", $request_field['cat_filter']);
|
|
| 401 | + if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) { |
|
| 402 | + $cat_filter = implode(",", $request_field['cat_filter']); |
|
| 403 | + } |
|
| 395 | 404 | |
| 396 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 397 | - $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 398 | - else {
|
|
| 405 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) { |
|
| 406 | + $price_pkg = implode(",", $request_field['show_on_pkg']); |
|
| 407 | + } else {
|
|
| 399 | 408 | $package_info = array(); |
| 400 | 409 | |
| 401 | 410 | $package_info = geodir_post_package_info($package_info, '', $post_type); |
@@ -403,22 +412,29 @@ discard block |
||
| 403 | 412 | } |
| 404 | 413 | |
| 405 | 414 | |
| 406 | - if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 407 | - $extra_fields = $request_field['extra']; |
|
| 415 | + if (isset($request_field['extra']) && !empty($request_field['extra'])) { |
|
| 416 | + $extra_fields = $request_field['extra']; |
|
| 417 | + } |
|
| 408 | 418 | |
| 409 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 410 | - $is_default = $request_field['is_default']; |
|
| 411 | - else |
|
| 412 | - $is_default = '0'; |
|
| 419 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '') { |
|
| 420 | + $is_default = $request_field['is_default']; |
|
| 421 | + } else { |
|
| 422 | + $is_default = '0'; |
|
| 423 | + } |
|
| 413 | 424 | |
| 414 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 415 | - $is_admin = $request_field['is_admin']; |
|
| 416 | - else |
|
| 417 | - $is_admin = '0'; |
|
| 425 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') { |
|
| 426 | + $is_admin = $request_field['is_admin']; |
|
| 427 | + } else { |
|
| 428 | + $is_admin = '0'; |
|
| 429 | + } |
|
| 418 | 430 | |
| 419 | 431 | |
| 420 | - if ($is_active == '') $is_active = 1; |
|
| 421 | - if ($is_required == '') $is_required = 0; |
|
| 432 | + if ($is_active == '') { |
|
| 433 | + $is_active = 1; |
|
| 434 | + } |
|
| 435 | + if ($is_required == '') { |
|
| 436 | + $is_required = 0; |
|
| 437 | + } |
|
| 422 | 438 | |
| 423 | 439 | |
| 424 | 440 | if ($sort_order == '') {
|
@@ -686,7 +702,7 @@ discard block |
||
| 686 | 702 | } |
| 687 | 703 | if($op_max){$op_size =$op_max; }
|
| 688 | 704 | } |
| 689 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 705 | + } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 690 | 706 | if(strlen($option_values)){
|
| 691 | 707 | $op_size = strlen($option_values); |
| 692 | 708 | } |
@@ -703,11 +719,13 @@ discard block |
||
| 703 | 719 | return __('Column change failed, you may have too many columns.','geodirectory');
|
| 704 | 720 | } |
| 705 | 721 | |
| 706 | - if (isset($request_field['cat_display_type'])) |
|
| 707 | - $extra_fields = $request_field['cat_display_type']; |
|
| 722 | + if (isset($request_field['cat_display_type'])) { |
|
| 723 | + $extra_fields = $request_field['cat_display_type']; |
|
| 724 | + } |
|
| 708 | 725 | |
| 709 | - if (isset($request_field['multi_display_type'])) |
|
| 710 | - $extra_fields = $request_field['multi_display_type']; |
|
| 726 | + if (isset($request_field['multi_display_type'])) { |
|
| 727 | + $extra_fields = $request_field['multi_display_type']; |
|
| 728 | + } |
|
| 711 | 729 | |
| 712 | 730 | |
| 713 | 731 | break; |
@@ -721,8 +739,9 @@ discard block |
||
| 721 | 739 | if($alter_result===false){
|
| 722 | 740 | return __('Column change failed, you may have too many columns.','geodirectory');
|
| 723 | 741 | } |
| 724 | - if (isset($request_field['advanced_editor'])) |
|
| 725 | - $extra_fields = $request_field['advanced_editor']; |
|
| 742 | + if (isset($request_field['advanced_editor'])) { |
|
| 743 | + $extra_fields = $request_field['advanced_editor']; |
|
| 744 | + } |
|
| 726 | 745 | |
| 727 | 746 | break; |
| 728 | 747 | |
@@ -816,8 +835,9 @@ discard block |
||
| 816 | 835 | ); |
| 817 | 836 | |
| 818 | 837 | |
| 819 | - if ($cat_sort == '') |
|
| 820 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 838 | + if ($cat_sort == '') { |
|
| 839 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name))); |
|
| 840 | + } |
|
| 821 | 841 | |
| 822 | 842 | |
| 823 | 843 | /** |
@@ -1185,8 +1205,10 @@ discard block |
||
| 1185 | 1205 | } |
| 1186 | 1206 | |
| 1187 | 1207 | return $post_meta_info; |
| 1188 | - else: |
|
| 1189 | - return false; |
|
| 1208 | + else { |
|
| 1209 | + : |
|
| 1210 | + return false; |
|
| 1211 | + } |
|
| 1190 | 1212 | endif; |
| 1191 | 1213 | } |
| 1192 | 1214 | |
@@ -1239,8 +1261,9 @@ discard block |
||
| 1239 | 1261 | if (is_admin()) {
|
| 1240 | 1262 | global $post; |
| 1241 | 1263 | |
| 1242 | - if (isset($_REQUEST['post'])) |
|
| 1243 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1264 | + if (isset($_REQUEST['post'])) { |
|
| 1265 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1266 | + } |
|
| 1244 | 1267 | } |
| 1245 | 1268 | |
| 1246 | 1269 | if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
@@ -1272,7 +1295,10 @@ discard block |
||
| 1272 | 1295 | $fieldset_field_class = 'gd-fieldset-' . $fieldset_id; |
| 1273 | 1296 | ?> |
| 1274 | 1297 | <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?> |
| 1275 | - <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5> |
|
| 1298 | + <?php if ($admin_desc != '') { |
|
| 1299 | + echo '<small>( ' . $admin_desc . ' )</small>'; |
|
| 1300 | +} |
|
| 1301 | +?></h5> |
|
| 1276 | 1302 | <?php |
| 1277 | 1303 | } else if ($type == 'address') {
|
| 1278 | 1304 | $prefix = $name . '_'; |
@@ -1309,17 +1335,27 @@ discard block |
||
| 1309 | 1335 | } |
| 1310 | 1336 | |
| 1311 | 1337 | $location = geodir_get_default_location(); |
| 1312 | - if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1313 | - if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1314 | - if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1338 | + if (empty($city)) { |
|
| 1339 | + $city = isset($location->city) ? $location->city : ''; |
|
| 1340 | + } |
|
| 1341 | + if (empty($region)) { |
|
| 1342 | + $region = isset($location->region) ? $location->region : ''; |
|
| 1343 | + } |
|
| 1344 | + if (empty($country)) { |
|
| 1345 | + $country = isset($location->country) ? $location->country : ''; |
|
| 1346 | + } |
|
| 1315 | 1347 | |
| 1316 | 1348 | $lat_lng_blank = false; |
| 1317 | 1349 | if (empty($lat) && empty($lng)) {
|
| 1318 | 1350 | $lat_lng_blank = true; |
| 1319 | 1351 | } |
| 1320 | 1352 | |
| 1321 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1322 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1353 | + if (empty($lat)) { |
|
| 1354 | + $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1355 | + } |
|
| 1356 | + if (empty($lng)) { |
|
| 1357 | + $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1358 | + } |
|
| 1323 | 1359 | |
| 1324 | 1360 | /** |
| 1325 | 1361 | * Filter the default latitude. |
@@ -1343,10 +1379,16 @@ discard block |
||
| 1343 | 1379 | ?> |
| 1344 | 1380 | |
| 1345 | 1381 | <div id="geodir_<?php echo $prefix . 'address';?>_row" |
| 1346 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1382 | + class="<?php if ($is_required) { |
|
| 1383 | + echo 'required_field'; |
|
| 1384 | +} |
|
| 1385 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1347 | 1386 | <label> |
| 1348 | 1387 | <?php _e($address_title, 'geodirectory'); ?> |
| 1349 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1388 | + <?php if ($is_required) { |
|
| 1389 | + echo '<span>*</span>'; |
|
| 1390 | +} |
|
| 1391 | +?> |
|
| 1350 | 1392 | </label> |
| 1351 | 1393 | <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>" |
| 1352 | 1394 | id="<?php echo $prefix . 'address';?>" class="geodir_textfield" |
@@ -1407,10 +1449,16 @@ discard block |
||
| 1407 | 1449 | /* show lat lng */ |
| 1408 | 1450 | $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
| 1409 | 1451 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
| 1410 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1452 | + class="<?php if ($is_required) { |
|
| 1453 | + echo 'required_field'; |
|
| 1454 | +} |
|
| 1455 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1411 | 1456 | <label> |
| 1412 | 1457 | <?php echo PLACE_ADDRESS_LAT; ?> |
| 1413 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1458 | + <?php if ($is_required) { |
|
| 1459 | + echo '<span>*</span>'; |
|
| 1460 | +} |
|
| 1461 | +?> |
|
| 1414 | 1462 | </label> |
| 1415 | 1463 | <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>" |
| 1416 | 1464 | id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield" |
@@ -1422,10 +1470,16 @@ discard block |
||
| 1422 | 1470 | </div> |
| 1423 | 1471 | |
| 1424 | 1472 | <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row" |
| 1425 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1473 | + class="<?php if ($is_required) { |
|
| 1474 | + echo 'required_field'; |
|
| 1475 | +} |
|
| 1476 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>> |
|
| 1426 | 1477 | <label> |
| 1427 | 1478 | <?php echo PLACE_ADDRESS_LNG; ?> |
| 1428 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1479 | + <?php if ($is_required) { |
|
| 1480 | + echo '<span>*</span>'; |
|
| 1481 | +} |
|
| 1482 | +?> |
|
| 1429 | 1483 | </label> |
| 1430 | 1484 | <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>" |
| 1431 | 1485 | id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield" |
@@ -1480,26 +1534,31 @@ discard block |
||
| 1480 | 1534 | <?php } elseif ($type == 'text') {
|
| 1481 | 1535 | |
| 1482 | 1536 | //number and float validation $validation_pattern |
| 1483 | - if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
|
|
| 1484 | - elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
|
|
| 1537 | + if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';} elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
|
|
| 1485 | 1538 | //print_r($val); |
| 1486 | 1539 | //validation |
| 1487 | 1540 | if(isset($val['validation_pattern']) && $val['validation_pattern']){
|
| 1488 | 1541 | $validation = 'pattern="'.$val['validation_pattern'].'"'; |
| 1489 | - }else{$validation='';}
|
|
| 1542 | + } else{$validation='';}
|
|
| 1490 | 1543 | |
| 1491 | 1544 | // validation message |
| 1492 | 1545 | if(isset($val['validation_msg']) && $val['validation_msg']){
|
| 1493 | 1546 | $validation_msg = 'title="'.$val['validation_msg'].'"'; |
| 1494 | - }else{$validation_msg='';}
|
|
| 1547 | + } else{$validation_msg='';}
|
|
| 1495 | 1548 | ?> |
| 1496 | 1549 | |
| 1497 | 1550 | <div id="<?php echo $name;?>_row" |
| 1498 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1551 | + class="<?php if ($is_required) { |
|
| 1552 | + echo 'required_field'; |
|
| 1553 | +} |
|
| 1554 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1499 | 1555 | <label> |
| 1500 | 1556 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1501 | 1557 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1502 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1558 | + <?php if ($is_required) { |
|
| 1559 | + echo '<span>*</span>'; |
|
| 1560 | +} |
|
| 1561 | +?> |
|
| 1503 | 1562 | </label> |
| 1504 | 1563 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1505 | 1564 | value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> /> |
@@ -1515,11 +1574,17 @@ discard block |
||
| 1515 | 1574 | }?> |
| 1516 | 1575 | |
| 1517 | 1576 | <div id="<?php echo $name;?>_row" |
| 1518 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1577 | + class="<?php if ($is_required) { |
|
| 1578 | + echo 'required_field'; |
|
| 1579 | +} |
|
| 1580 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1519 | 1581 | <label> |
| 1520 | 1582 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1521 | 1583 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1522 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1584 | + <?php if ($is_required) { |
|
| 1585 | + echo '<span>*</span>'; |
|
| 1586 | +} |
|
| 1587 | +?> |
|
| 1523 | 1588 | </label> |
| 1524 | 1589 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1525 | 1590 | value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/> |
@@ -1535,11 +1600,17 @@ discard block |
||
| 1535 | 1600 | } ?> |
| 1536 | 1601 | |
| 1537 | 1602 | <div id="<?php echo $name;?>_row" |
| 1538 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1603 | + class="<?php if ($is_required) { |
|
| 1604 | + echo 'required_field'; |
|
| 1605 | +} |
|
| 1606 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1539 | 1607 | <label> |
| 1540 | 1608 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1541 | 1609 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1542 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1610 | + <?php if ($is_required) { |
|
| 1611 | + echo '<span>*</span>'; |
|
| 1612 | +} |
|
| 1613 | +?> |
|
| 1543 | 1614 | </label> |
| 1544 | 1615 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1545 | 1616 | value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/> |
@@ -1555,11 +1626,17 @@ discard block |
||
| 1555 | 1626 | }?> |
| 1556 | 1627 | |
| 1557 | 1628 | <div id="<?php echo $name;?>_row" |
| 1558 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1629 | + class="<?php if ($is_required) { |
|
| 1630 | + echo 'required_field'; |
|
| 1631 | +} |
|
| 1632 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1559 | 1633 | <label> |
| 1560 | 1634 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1561 | 1635 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1562 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1636 | + <?php if ($is_required) { |
|
| 1637 | + echo '<span>*</span>'; |
|
| 1638 | +} |
|
| 1639 | +?> |
|
| 1563 | 1640 | </label> |
| 1564 | 1641 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
| 1565 | 1642 | value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield" |
@@ -1574,11 +1651,17 @@ discard block |
||
| 1574 | 1651 | |
| 1575 | 1652 | <?php } elseif ($type == 'radio') { ?>
|
| 1576 | 1653 | <div id="<?php echo $name;?>_row" |
| 1577 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1654 | + class="<?php if ($is_required) { |
|
| 1655 | + echo 'required_field'; |
|
| 1656 | +} |
|
| 1657 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1578 | 1658 | <label> |
| 1579 | 1659 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1580 | 1660 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1581 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1661 | + <?php if ($is_required) { |
|
| 1662 | + echo '<span>*</span>'; |
|
| 1663 | +} |
|
| 1664 | +?> |
|
| 1582 | 1665 | </label> |
| 1583 | 1666 | <?php if ($option_values) {
|
| 1584 | 1667 | $option_values = geodir_string_values_to_options($option_values, true); |
@@ -1603,11 +1686,17 @@ discard block |
||
| 1603 | 1686 | <?php } elseif ($type == 'checkbox') { ?>
|
| 1604 | 1687 | |
| 1605 | 1688 | <div id="<?php echo $name;?>_row" |
| 1606 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1689 | + class="<?php if ($is_required) { |
|
| 1690 | + echo 'required_field'; |
|
| 1691 | +} |
|
| 1692 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1607 | 1693 | <label> |
| 1608 | 1694 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1609 | 1695 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1610 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1696 | + <?php if ($is_required) { |
|
| 1697 | + echo '<span>*</span>'; |
|
| 1698 | +} |
|
| 1699 | +?> |
|
| 1611 | 1700 | </label> |
| 1612 | 1701 | <?php if ($value != '1') {
|
| 1613 | 1702 | $value = '0'; |
@@ -1627,11 +1716,17 @@ discard block |
||
| 1627 | 1716 | ?> |
| 1628 | 1717 | |
| 1629 | 1718 | <div id="<?php echo $name;?>_row" |
| 1630 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1719 | + class="<?php if ($is_required) { |
|
| 1720 | + echo 'required_field'; |
|
| 1721 | +} |
|
| 1722 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1631 | 1723 | <label> |
| 1632 | 1724 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1633 | 1725 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1634 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1726 | + <?php if ($is_required) { |
|
| 1727 | + echo '<span>*</span>'; |
|
| 1728 | +} |
|
| 1729 | +?> |
|
| 1635 | 1730 | </label><?php |
| 1636 | 1731 | |
| 1637 | 1732 | |
@@ -1659,11 +1754,17 @@ discard block |
||
| 1659 | 1754 | |
| 1660 | 1755 | <?php } elseif ($type == 'select') { ?>
|
| 1661 | 1756 | <div id="<?php echo $name;?>_row" |
| 1662 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1757 | + class="<?php if ($is_required) { |
|
| 1758 | + echo 'required_field'; |
|
| 1759 | +} |
|
| 1760 | +?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1663 | 1761 | <label> |
| 1664 | 1762 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1665 | 1763 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1666 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1764 | + <?php if ($is_required) { |
|
| 1765 | + echo '<span>*</span>'; |
|
| 1766 | +} |
|
| 1767 | +?> |
|
| 1667 | 1768 | </label> |
| 1668 | 1769 | <?php |
| 1669 | 1770 | $option_values_arr = geodir_string_values_to_options($option_values, true); |
@@ -1702,11 +1803,17 @@ discard block |
||
| 1702 | 1803 | } |
| 1703 | 1804 | ?> |
| 1704 | 1805 | <div id="<?php echo $name; ?>_row" |
| 1705 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1806 | + class="<?php if ($is_required) { |
|
| 1807 | + echo 'required_field'; |
|
| 1808 | +} |
|
| 1809 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1706 | 1810 | <label> |
| 1707 | 1811 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1708 | 1812 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1709 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1813 | + <?php if ($is_required) { |
|
| 1814 | + echo '<span>*</span>'; |
|
| 1815 | +} |
|
| 1816 | +?> |
|
| 1710 | 1817 | </label> |
| 1711 | 1818 | <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/> |
| 1712 | 1819 | <?php if ($multi_display == 'select') { ?>
|
@@ -1776,11 +1883,17 @@ discard block |
||
| 1776 | 1883 | ?> |
| 1777 | 1884 | |
| 1778 | 1885 | <div id="<?php echo $name; ?>_row" |
| 1779 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1886 | + class="<?php if ($is_required) { |
|
| 1887 | + echo 'required_field'; |
|
| 1888 | +} |
|
| 1889 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1780 | 1890 | <label> |
| 1781 | 1891 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1782 | 1892 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1783 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1893 | + <?php if ($is_required) { |
|
| 1894 | + echo '<span>*</span>'; |
|
| 1895 | +} |
|
| 1896 | +?> |
|
| 1784 | 1897 | </label> |
| 1785 | 1898 | |
| 1786 | 1899 | <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
|
@@ -1797,8 +1910,9 @@ discard block |
||
| 1797 | 1910 | </div> |
| 1798 | 1911 | <?php } elseif ($type == 'datepicker') {
|
| 1799 | 1912 | |
| 1800 | - if ($extra_fields['date_format'] == '') |
|
| 1801 | - $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 1913 | + if ($extra_fields['date_format'] == '') { |
|
| 1914 | + $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 1915 | + } |
|
| 1802 | 1916 | |
| 1803 | 1917 | |
| 1804 | 1918 | $search = array('dd', 'mm', 'yy');
|
@@ -1836,12 +1950,18 @@ discard block |
||
| 1836 | 1950 | |
| 1837 | 1951 | </script> |
| 1838 | 1952 | <div id="<?php echo $name;?>_row" |
| 1839 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1953 | + class="<?php if ($is_required) { |
|
| 1954 | + echo 'required_field'; |
|
| 1955 | +} |
|
| 1956 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1840 | 1957 | <label> |
| 1841 | 1958 | |
| 1842 | 1959 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1843 | 1960 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1844 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1961 | + <?php if ($is_required) { |
|
| 1962 | + echo '<span>*</span>'; |
|
| 1963 | +} |
|
| 1964 | +?> |
|
| 1845 | 1965 | </label> |
| 1846 | 1966 | |
| 1847 | 1967 | <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
@@ -1855,8 +1975,9 @@ discard block |
||
| 1855 | 1975 | |
| 1856 | 1976 | <?php } elseif ($type == 'time') {
|
| 1857 | 1977 | |
| 1858 | - if ($value != '') |
|
| 1859 | - $value = date('H:i', strtotime($value));
|
|
| 1978 | + if ($value != '') { |
|
| 1979 | + $value = date('H:i', strtotime($value)); |
|
| 1980 | + } |
|
| 1860 | 1981 | ?> |
| 1861 | 1982 | <script type="text/javascript"> |
| 1862 | 1983 | jQuery(document).ready(function () {
|
@@ -1869,12 +1990,18 @@ discard block |
||
| 1869 | 1990 | }); |
| 1870 | 1991 | </script> |
| 1871 | 1992 | <div id="<?php echo $name;?>_row" |
| 1872 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1993 | + class="<?php if ($is_required) { |
|
| 1994 | + echo 'required_field'; |
|
| 1995 | +} |
|
| 1996 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1873 | 1997 | <label> |
| 1874 | 1998 | |
| 1875 | 1999 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1876 | 2000 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1877 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 2001 | + <?php if ($is_required) { |
|
| 2002 | + echo '<span>*</span>'; |
|
| 2003 | +} |
|
| 2004 | +?> |
|
| 1878 | 2005 | </label> |
| 1879 | 2006 | <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>" |
| 1880 | 2007 | id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
@@ -1890,11 +2017,17 @@ discard block |
||
| 1890 | 2017 | $value = ''; |
| 1891 | 2018 | } ?> |
| 1892 | 2019 | <div id="<?php echo $name;?>_row" |
| 1893 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 2020 | + class="<?php if ($is_required) { |
|
| 2021 | + echo 'required_field'; |
|
| 2022 | +} |
|
| 2023 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 1894 | 2024 | <label> |
| 1895 | 2025 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1896 | 2026 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1897 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 2027 | + <?php if ($is_required) { |
|
| 2028 | + echo '<span>*</span>'; |
|
| 2029 | +} |
|
| 2030 | +?> |
|
| 1898 | 2031 | </label> |
| 1899 | 2032 | |
| 1900 | 2033 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
@@ -1928,8 +2061,9 @@ discard block |
||
| 1928 | 2061 | $post_cat = implode(",", $post_cat[$name]);
|
| 1929 | 2062 | |
| 1930 | 2063 | } else {
|
| 1931 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1932 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 2064 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
| 2065 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 2066 | + } |
|
| 1933 | 2067 | } |
| 1934 | 2068 | |
| 1935 | 2069 | |
@@ -1967,21 +2101,24 @@ discard block |
||
| 1967 | 2101 | |
| 1968 | 2102 | $cat_display == ''; |
| 1969 | 2103 | $multiple = ''; |
| 1970 | - if ($cat_display == 'multiselect') |
|
| 1971 | - $multiple = 'multiple="multiple"'; |
|
| 2104 | + if ($cat_display == 'multiselect') { |
|
| 2105 | + $multiple = 'multiple="multiple"'; |
|
| 2106 | + } |
|
| 1972 | 2107 | |
| 1973 | 2108 | echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
|
| 1974 | 2109 | |
| 1975 | 2110 | |
| 1976 | - if ($cat_display == 'select') |
|
| 1977 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 2111 | + if ($cat_display == 'select') { |
|
| 2112 | + echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 2113 | + } |
|
| 1978 | 2114 | |
| 1979 | 2115 | } |
| 1980 | 2116 | |
| 1981 | 2117 | echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
| 1982 | 2118 | |
| 1983 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1984 | - echo '</select>'; |
|
| 2119 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 2120 | + echo '</select>'; |
|
| 2121 | + } |
|
| 1985 | 2122 | |
| 1986 | 2123 | } else {
|
| 1987 | 2124 | |
@@ -2011,18 +2148,23 @@ discard block |
||
| 2011 | 2148 | |
| 2012 | 2149 | $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
| 2013 | 2150 | |
| 2014 | - } else |
|
| 2015 | - $file_value = ''; |
|
| 2151 | + } else { |
|
| 2152 | + $file_value = ''; |
|
| 2153 | + } |
|
| 2016 | 2154 | |
| 2017 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 2018 | - $file_multiple = true; // allow multiple files upload |
|
| 2019 | - else |
|
| 2020 | - $file_multiple = false; |
|
| 2155 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) { |
|
| 2156 | + $file_multiple = true; |
|
| 2157 | + } |
|
| 2158 | + // allow multiple files upload |
|
| 2159 | + else { |
|
| 2160 | + $file_multiple = false; |
|
| 2161 | + } |
|
| 2021 | 2162 | |
| 2022 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 2023 | - $file_image_limit = $extra_fields['image_limit']; |
|
| 2024 | - else |
|
| 2025 | - $file_image_limit = 1; |
|
| 2163 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) { |
|
| 2164 | + $file_image_limit = $extra_fields['image_limit']; |
|
| 2165 | + } else { |
|
| 2166 | + $file_image_limit = 1; |
|
| 2167 | + } |
|
| 2026 | 2168 | |
| 2027 | 2169 | $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
| 2028 | 2170 | |
@@ -2030,8 +2172,9 @@ discard block |
||
| 2030 | 2172 | |
| 2031 | 2173 | if (!empty($file_value)) {
|
| 2032 | 2174 | $curImages = explode(',', $file_value);
|
| 2033 | - if (!empty($curImages)) |
|
| 2034 | - $file_totImg = count($curImages); |
|
| 2175 | + if (!empty($curImages)) { |
|
| 2176 | + $file_totImg = count($curImages); |
|
| 2177 | + } |
|
| 2035 | 2178 | } |
| 2036 | 2179 | |
| 2037 | 2180 | $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
|
@@ -2046,12 +2189,18 @@ discard block |
||
| 2046 | 2189 | ?> |
| 2047 | 2190 | |
| 2048 | 2191 | <div id="<?php echo $name;?>_row" |
| 2049 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 2192 | + class="<?php if ($is_required) { |
|
| 2193 | + echo 'required_field'; |
|
| 2194 | +} |
|
| 2195 | +?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>"> |
|
| 2050 | 2196 | |
| 2051 | 2197 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 2052 | 2198 | <label |
| 2053 | 2199 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 2054 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 2200 | + echo $site_title; ?><?php if ($is_required) { |
|
| 2201 | + echo '<span>*</span>'; |
|
| 2202 | + } |
|
| 2203 | + ?></label> |
|
| 2055 | 2204 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 2056 | 2205 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 2057 | 2206 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -2192,9 +2341,10 @@ discard block |
||
| 2192 | 2341 | $field_set_start = 0; |
| 2193 | 2342 | |
| 2194 | 2343 | |
| 2195 | - if ($fields_location == 'detail') |
|
| 2196 | - |
|
| 2197 | - $i = 1; |
|
| 2344 | + if ($fields_location == 'detail') { |
|
| 2345 | + |
|
| 2346 | + $i = 1; |
|
| 2347 | + } |
|
| 2198 | 2348 | foreach ($fields_info as $type) {
|
| 2199 | 2349 | $type = stripslashes_deep($type); // strip slashes |
| 2200 | 2350 | $html = ''; |
@@ -2211,8 +2361,9 @@ discard block |
||
| 2211 | 2361 | $variables_array['post_id'] = $post->ID; |
| 2212 | 2362 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
| 2213 | 2363 | $variables_array['value'] = ''; |
| 2214 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 2215 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 2364 | + if (isset($post->{$type['htmlvar_name']})) { |
|
| 2365 | + $variables_array['value'] = $post->{$type['htmlvar_name']}; |
|
| 2366 | + } |
|
| 2216 | 2367 | endif; |
| 2217 | 2368 | |
| 2218 | 2369 | //if($type['field_icon']) |
@@ -2339,8 +2490,9 @@ discard block |
||
| 2339 | 2490 | if ($fields_location == 'detail') {
|
| 2340 | 2491 | |
| 2341 | 2492 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2342 | - if ($i % 2 == 0) |
|
| 2343 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2493 | + if ($i % 2 == 0) { |
|
| 2494 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2495 | + } |
|
| 2344 | 2496 | |
| 2345 | 2497 | $i++; |
| 2346 | 2498 | } |
@@ -2414,8 +2566,9 @@ discard block |
||
| 2414 | 2566 | if ($fields_location == 'detail') {
|
| 2415 | 2567 | |
| 2416 | 2568 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2417 | - if ($i % 2 == 0) |
|
| 2418 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2569 | + if ($i % 2 == 0) { |
|
| 2570 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2571 | + } |
|
| 2419 | 2572 | |
| 2420 | 2573 | $i++; |
| 2421 | 2574 | } |
@@ -2457,8 +2610,9 @@ discard block |
||
| 2457 | 2610 | if ($fields_location == 'detail') {
|
| 2458 | 2611 | |
| 2459 | 2612 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2460 | - if ($i % 2 == 0) |
|
| 2461 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2613 | + if ($i % 2 == 0) { |
|
| 2614 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2615 | + } |
|
| 2462 | 2616 | |
| 2463 | 2617 | $i++; |
| 2464 | 2618 | } |
@@ -2478,9 +2632,10 @@ discard block |
||
| 2478 | 2632 | if ($post->{$type['htmlvar_name']}):
|
| 2479 | 2633 | |
| 2480 | 2634 | $value = ''; |
| 2481 | - if ($post->{$type['htmlvar_name']} != '')
|
|
| 2482 | - //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
|
|
| 2483 | - $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
|
|
| 2635 | + if ($post->{$type['htmlvar_name']} != '') { |
|
| 2636 | + //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
|
|
| 2637 | + $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']})); |
|
| 2638 | + } |
|
| 2484 | 2639 | |
| 2485 | 2640 | if (strpos($field_icon, 'http') !== false) {
|
| 2486 | 2641 | $field_icon_af = ''; |
@@ -2495,8 +2650,9 @@ discard block |
||
| 2495 | 2650 | if ($fields_location == 'detail') {
|
| 2496 | 2651 | |
| 2497 | 2652 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2498 | - if ($i % 2 == 0) |
|
| 2499 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2653 | + if ($i % 2 == 0) { |
|
| 2654 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2655 | + } |
|
| 2500 | 2656 | |
| 2501 | 2657 | $i++; |
| 2502 | 2658 | } |
@@ -2529,7 +2685,7 @@ discard block |
||
| 2529 | 2685 | $value = ''; |
| 2530 | 2686 | if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
|
| 2531 | 2687 | $value = date($date_format, strtotime($post_htmlvar_value)); |
| 2532 | - }else{
|
|
| 2688 | + } else{
|
|
| 2533 | 2689 | continue; |
| 2534 | 2690 | } |
| 2535 | 2691 | |
@@ -2546,8 +2702,9 @@ discard block |
||
| 2546 | 2702 | if ($fields_location == 'detail') {
|
| 2547 | 2703 | |
| 2548 | 2704 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2549 | - if ($i % 2 == 0) |
|
| 2550 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2705 | + if ($i % 2 == 0) { |
|
| 2706 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2707 | + } |
|
| 2551 | 2708 | |
| 2552 | 2709 | $i++; |
| 2553 | 2710 | } |
@@ -2579,8 +2736,9 @@ discard block |
||
| 2579 | 2736 | if ($fields_location == 'detail') {
|
| 2580 | 2737 | |
| 2581 | 2738 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2582 | - if ($i % 2 == 0) |
|
| 2583 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2739 | + if ($i % 2 == 0) { |
|
| 2740 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2741 | + } |
|
| 2584 | 2742 | |
| 2585 | 2743 | $i++; |
| 2586 | 2744 | } |
@@ -2604,8 +2762,9 @@ discard block |
||
| 2604 | 2762 | if ($fields_location == 'detail') {
|
| 2605 | 2763 | |
| 2606 | 2764 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2607 | - if ($i % 2 == 0) |
|
| 2608 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2765 | + if ($i % 2 == 0) { |
|
| 2766 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2767 | + } |
|
| 2609 | 2768 | |
| 2610 | 2769 | $i++; |
| 2611 | 2770 | } |
@@ -2656,8 +2815,9 @@ discard block |
||
| 2656 | 2815 | if ($fields_location == 'detail') {
|
| 2657 | 2816 | |
| 2658 | 2817 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2659 | - if ($i % 2 == 0) |
|
| 2660 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2818 | + if ($i % 2 == 0) { |
|
| 2819 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2820 | + } |
|
| 2661 | 2821 | |
| 2662 | 2822 | $i++; |
| 2663 | 2823 | } |
@@ -2677,8 +2837,10 @@ discard block |
||
| 2677 | 2837 | |
| 2678 | 2838 | if ($post->{$type['htmlvar_name']} == '1'):
|
| 2679 | 2839 | $html_val = __('Yes', 'geodirectory');
|
| 2680 | - else: |
|
| 2681 | - $html_val = __('No', 'geodirectory');
|
|
| 2840 | + else { |
|
| 2841 | + : |
|
| 2842 | + $html_val = __('No', 'geodirectory'); |
|
| 2843 | + } |
|
| 2682 | 2844 | endif; |
| 2683 | 2845 | |
| 2684 | 2846 | if (strpos($field_icon, 'http') !== false) {
|
@@ -2694,8 +2856,9 @@ discard block |
||
| 2694 | 2856 | if ($fields_location == 'detail') {
|
| 2695 | 2857 | |
| 2696 | 2858 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2697 | - if ($i % 2 == 0) |
|
| 2698 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2859 | + if ($i % 2 == 0) { |
|
| 2860 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2861 | + } |
|
| 2699 | 2862 | |
| 2700 | 2863 | $i++; |
| 2701 | 2864 | } |
@@ -2739,8 +2902,9 @@ discard block |
||
| 2739 | 2902 | if ($fields_location == 'detail') {
|
| 2740 | 2903 | |
| 2741 | 2904 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2742 | - if ($i % 2 == 0) |
|
| 2743 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2905 | + if ($i % 2 == 0) { |
|
| 2906 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2907 | + } |
|
| 2744 | 2908 | |
| 2745 | 2909 | $i++; |
| 2746 | 2910 | } |
@@ -2791,8 +2955,9 @@ discard block |
||
| 2791 | 2955 | if ($fields_location == 'detail') {
|
| 2792 | 2956 | |
| 2793 | 2957 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2794 | - if ($i % 2 == 0) |
|
| 2795 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2958 | + if ($i % 2 == 0) { |
|
| 2959 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 2960 | + } |
|
| 2796 | 2961 | |
| 2797 | 2962 | $i++; |
| 2798 | 2963 | } |
@@ -2847,8 +3012,9 @@ discard block |
||
| 2847 | 3012 | if ($fields_location == 'detail') {
|
| 2848 | 3013 | |
| 2849 | 3014 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2850 | - if ($i % 2 == 0) |
|
| 2851 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3015 | + if ($i % 2 == 0) { |
|
| 3016 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3017 | + } |
|
| 2852 | 3018 | |
| 2853 | 3019 | $i++; |
| 2854 | 3020 | } |
@@ -2893,8 +3059,9 @@ discard block |
||
| 2893 | 3059 | if ($fields_location == 'detail') {
|
| 2894 | 3060 | |
| 2895 | 3061 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2896 | - if ($i % 2 == 0) |
|
| 2897 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3062 | + if ($i % 2 == 0) { |
|
| 3063 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3064 | + } |
|
| 2898 | 3065 | |
| 2899 | 3066 | $i++; |
| 2900 | 3067 | } |
@@ -2914,7 +3081,7 @@ discard block |
||
| 2914 | 3081 | */ |
| 2915 | 3082 | $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
|
| 2916 | 3083 | $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
|
| 2917 | - }else{
|
|
| 3084 | + } else{
|
|
| 2918 | 3085 | $html .= $email; |
| 2919 | 3086 | } |
| 2920 | 3087 | $html .= '</span></div>'; |
@@ -2992,8 +3159,9 @@ discard block |
||
| 2992 | 3159 | if ($fields_location == 'detail') {
|
| 2993 | 3160 | |
| 2994 | 3161 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 2995 | - if ($i % 2 == 0) |
|
| 2996 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3162 | + if ($i % 2 == 0) { |
|
| 3163 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3164 | + } |
|
| 2997 | 3165 | |
| 2998 | 3166 | $i++; |
| 2999 | 3167 | } |
@@ -3027,8 +3195,9 @@ discard block |
||
| 3027 | 3195 | if ($fields_location == 'detail') {
|
| 3028 | 3196 | |
| 3029 | 3197 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 3030 | - if ($i % 2 == 0) |
|
| 3031 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3198 | + if ($i % 2 == 0) { |
|
| 3199 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3200 | + } |
|
| 3032 | 3201 | |
| 3033 | 3202 | $i++; |
| 3034 | 3203 | } |
@@ -3056,8 +3225,9 @@ discard block |
||
| 3056 | 3225 | if ($fields_location == 'detail') {
|
| 3057 | 3226 | |
| 3058 | 3227 | $geodir_odd_even = 'geodir_more_info_odd'; |
| 3059 | - if ($i % 2 == 0) |
|
| 3060 | - $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3228 | + if ($i % 2 == 0) { |
|
| 3229 | + $geodir_odd_even = 'geodir_more_info_even'; |
|
| 3230 | + } |
|
| 3061 | 3231 | |
| 3062 | 3232 | $i++; |
| 3063 | 3233 | } |
@@ -3152,7 +3322,9 @@ discard block |
||
| 3152 | 3322 | * @param string $html Custom field unfiltered HTML. |
| 3153 | 3323 | * @param array $variables_array Custom field variables array. |
| 3154 | 3324 | */ |
| 3155 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 3325 | + if ($html) { |
|
| 3326 | + echo apply_filters("geodir_show_{$html_var}", $html, $variables_array); |
|
| 3327 | + } |
|
| 3156 | 3328 | |
| 3157 | 3329 | /** |
| 3158 | 3330 | * Called after a custom fields is output on the frontend. |
@@ -3186,10 +3358,11 @@ discard block |
||
| 3186 | 3358 | */ |
| 3187 | 3359 | function geodir_default_date_format() |
| 3188 | 3360 | {
|
| 3189 | - if ($format = get_option('date_format'))
|
|
| 3190 | - return $format; |
|
| 3191 | - else |
|
| 3192 | - return 'dd-mm-yy'; |
|
| 3361 | + if ($format = get_option('date_format')) { |
|
| 3362 | + return $format; |
|
| 3363 | + } else { |
|
| 3364 | + return 'dd-mm-yy'; |
|
| 3365 | + } |
|
| 3193 | 3366 | } |
| 3194 | 3367 | } |
| 3195 | 3368 | |
@@ -3296,11 +3469,13 @@ discard block |
||
| 3296 | 3469 | // Set an array containing a list of acceptable formats |
| 3297 | 3470 | //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
| 3298 | 3471 | |
| 3299 | - if (!function_exists('wp_handle_upload'))
|
|
| 3300 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 3472 | + if (!function_exists('wp_handle_upload')) { |
|
| 3473 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 3474 | + } |
|
| 3301 | 3475 | |
| 3302 | - if (!is_dir($geodir_uploadpath)) |
|
| 3303 | - mkdir($geodir_uploadpath); |
|
| 3476 | + if (!is_dir($geodir_uploadpath)) { |
|
| 3477 | + mkdir($geodir_uploadpath); |
|
| 3478 | + } |
|
| 3304 | 3479 | |
| 3305 | 3480 | $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
| 3306 | 3481 | $explode_sub_dir = explode("/", $sub_dir);
|
@@ -3313,16 +3488,19 @@ discard block |
||
| 3313 | 3488 | } |
| 3314 | 3489 | |
| 3315 | 3490 | $uploaded_file = ''; |
| 3316 | - if (file_exists($img_path)) |
|
| 3317 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 3491 | + if (file_exists($img_path)) { |
|
| 3492 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 3493 | + } |
|
| 3318 | 3494 | |
| 3319 | 3495 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 3320 | - if (file_exists($img_path)) |
|
| 3321 | - unlink($img_path); |
|
| 3496 | + if (file_exists($img_path)) { |
|
| 3497 | + unlink($img_path); |
|
| 3498 | + } |
|
| 3322 | 3499 | } |
| 3323 | 3500 | |
| 3324 | - if (!empty($uploaded_file)) |
|
| 3325 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 3501 | + if (!empty($uploaded_file)) { |
|
| 3502 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 3503 | + } |
|
| 3326 | 3504 | |
| 3327 | 3505 | } else {
|
| 3328 | 3506 | $file_urls = $post_image[$m]; |
@@ -3343,8 +3521,9 @@ discard block |
||
| 3343 | 3521 | |
| 3344 | 3522 | geodir_save_post_meta($post_id, $field_id, $file_urls); |
| 3345 | 3523 | |
| 3346 | - if (!empty($invalid_files)) |
|
| 3347 | - geodir_remove_attachments($invalid_files); |
|
| 3524 | + if (!empty($invalid_files)) { |
|
| 3525 | + geodir_remove_attachments($invalid_files); |
|
| 3526 | + } |
|
| 3348 | 3527 | |
| 3349 | 3528 | } |
| 3350 | 3529 | } |
@@ -3570,8 +3749,9 @@ discard block |
||
| 3570 | 3749 | |
| 3571 | 3750 | $all_postypes = geodir_get_posttypes(); |
| 3572 | 3751 | |
| 3573 | - if (!in_array($post_type, $all_postypes)) |
|
| 3574 | - return false; |
|
| 3752 | + if (!in_array($post_type, $all_postypes)) { |
|
| 3753 | + return false; |
|
| 3754 | + } |
|
| 3575 | 3755 | |
| 3576 | 3756 | $fields = array(); |
| 3577 | 3757 | |
@@ -3659,8 +3839,10 @@ discard block |
||
| 3659 | 3839 | } |
| 3660 | 3840 | |
| 3661 | 3841 | return $field_ids; |
| 3662 | - else: |
|
| 3663 | - return false; |
|
| 3842 | + else { |
|
| 3843 | + : |
|
| 3844 | + return false; |
|
| 3845 | + } |
|
| 3664 | 3846 | endif; |
| 3665 | 3847 | } |
| 3666 | 3848 | |
@@ -3833,8 +4015,9 @@ discard block |
||
| 3833 | 4015 | |
| 3834 | 4016 | return $field_id; |
| 3835 | 4017 | |
| 3836 | - } else |
|
| 3837 | - return 0; |
|
| 4018 | + } else { |
|
| 4019 | + return 0; |
|
| 4020 | + } |
|
| 3838 | 4021 | |
| 3839 | 4022 | } |
| 3840 | 4023 | } |
@@ -3876,8 +4059,9 @@ discard block |
||
| 3876 | 4059 | $htmlvar_name = isset($field_types[1]) ? $field_types[1] : ''; |
| 3877 | 4060 | |
| 3878 | 4061 | $site_title = ''; |
| 3879 | - if ($site_title == '') |
|
| 3880 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 4062 | + if ($site_title == '') { |
|
| 4063 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 4064 | + } |
|
| 3881 | 4065 | |
| 3882 | 4066 | if ($site_title == '') {
|
| 3883 | 4067 | $fields = geodir_get_custom_sort_options($post_type); |
@@ -3891,8 +4075,9 @@ discard block |
||
| 3891 | 4075 | } |
| 3892 | 4076 | } |
| 3893 | 4077 | |
| 3894 | - if ($htmlvar_name == '') |
|
| 3895 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 4078 | + if ($htmlvar_name == '') { |
|
| 4079 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 4080 | + } |
|
| 3896 | 4081 | |
| 3897 | 4082 | $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
| 3898 | 4083 | |