PluginProbe
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings / 5.8.4
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings v5.8.4
7.2.1 7.2 7.1.2 7.1.1 7.1 7.0.4 7.0.6 7.0.7 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 6.3.1 trunk 5.7.3 5.7.5 5.8.1 5.8.2 5.8.3 5.8.4 5.8.6 6.0.4 6.0.5 All 36 releases
mlsimport / admin / partials / mlsimport-admin-fields-select.php

mlsimport-admin-fields-select.php in MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings 5.8.4, at admin/partials/mlsimport-admin-fields-select.php

198 lines 8.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5
6 $options = get_option( $this->plugin_name . '_admin_options' );
7 $mlsimport_mls_metadata_populated = get_option( 'mlsimport_mls_metadata_populated', '' );
8 $permited_tags=mlsimport_allowed_html_tags_content();
9 $post_type= '';
10 if (method_exists($this->env_data, 'get_property_post_type')) {
11 $post_type = $this->env_data->get_property_post_type();
12 }
13
14 $available_taxonomies = mlsimport_get_custom_post_type_taxonomies($post_type);
15
16
17
18 if ( 'yes' === $mlsimport_mls_metadata_populated ) { ?>
19 <form method="post" name="cleanup_options" action="options.php">
20 <?php
21 settings_fields( $this->plugin_name . '_admin_fields_select' );
22 do_settings_sections( $this->plugin_name . '_admin_fields_select' );
23 $options = get_option( $this->plugin_name . '_admin_fields_select' );
24
25 $mlsimport_mls_metadata_theme_schema = get_option( 'mlsimport_mls_metadata_theme_schema', '' );
26 $mlsimport_mls_metadata_mls_data = get_option( 'mlsimport_mls_metadata_mls_data', '' );
27 $mlsimport_mls_metadata_mls_data = json_decode( $mlsimport_mls_metadata_mls_data, true );
28
29 $theme_schema = $mlsimport_mls_metadata_theme_schema;
30 $metadata_api_call_data_service_property = $mlsimport_mls_metadata_mls_data;
31
32
33 global $mlsimport;
34 $mlsimport->admin->mlsimport_saas_setting_up();
35 $mandatory_fields = '';
36 $non_mandatory_fields = '';
37
38
39 if(is_array($metadata_api_call_data_service_property)){
40 foreach ( $metadata_api_call_data_service_property as $key => $value ) {
41 $description = 'no description ';
42 $mandatory = 0;
43
44 $is_checkbox = 0;
45 $is_checkbox_admin = 0;
46
47
48
49 if ( isset( $options['mls-fields'][ $key ] ) && 1 === intval( $options['mls-fields'][ $key ] ) ) {
50 $is_checkbox = 1;
51 } elseif ( ! isset( $options['mls-fields'][ $key ] ) ) {
52 $is_checkbox = 1;
53 }
54
55 if ( isset( $options['mls-fields-admin'][ $key ] ) && 1 === intval( $options['mls-fields-admin'][ $key ]) ) {
56 $is_checkbox_admin = 1;
57 }
58
59
60 if ( array_key_exists( $key, $theme_schema ) ) {
61 $mandatory_fields .= '<strong>' . esc_html($key) . '</strong><div class="mls_mandatory_fields">' . esc_html( $value ) . '</div>';
62 } else {
63 $label_value = '';
64 if ( isset( $options['mls-fields-label'][ $key ] ) ) {
65 $label_value = $options['mls-fields-label'][ $key ];
66 }
67 if ( '' === $label_value ) {
68 $label_value = $key;
69 }
70
71 $label_post_meta='';
72 if ( isset( $options['mls-fields-map-postmeta'][ $key ] ) ) {
73 $label_post_meta = $options['mls-fields-map-postmeta'][ $key ];
74 }
75 $label_tax_meta='';
76 if ( isset( $options['mls-fields-map-taxonomy'][ $key ] ) ) {
77 $label_tax_meta = $options['mls-fields-map-taxonomy'][ $key ];
78 }
79
80
81
82
83 $non_mandatory_fields .= '
84 <fieldset class="mlsimport-fieldset">
85
86 <h4 class="mlsfield_import_title">' . esc_html($key) . ' </h4>
87
88
89 <div class="mlsimport-fieldset-wrapper">
90
91 <div class="mlsimport-fieldset-item">
92 <label>' . esc_html__( 'Label(to not import the label in taxonomy type none )', 'mlsimport' ) . '</label>
93 <input type="text" class="mlsimport-fieldset mlsfield_label" name="' . esc_attr( $this->plugin_name) . '_admin_fields_select[mls-fields-label][' . esc_attr( $key) . ']" value="' . esc_html($label_value) . '">
94 </div>
95
96 <div class="mlsimport-fieldset-item">
97 <label>'.esc_html__('Import?','mlsimport').'</label>
98 <input type="hidden" id="' . esc_attr($this->plugin_name ). '_admin_fields_select-mls_field_' . esc_attr( $key) . '" name="' . esc_attr( $this->plugin_name ). '_admin_fields_select[mls-fields][' . esc_attr( $key) . ']" value="0"/>
99 <input type="checkbox" class="mlsimport_select_import_all" id="' .esc_attr( $this->plugin_name ). '_admin_fields_select-mls_field_' .esc_attr( $key) . '" name="' . esc_attr( $this->plugin_name ). '_admin_fields_select[mls-fields][' . esc_attr( $key) . ']" value="1"' . checked( $is_checkbox, 1, 0 ) . '/>
100 </div>
101
102 <div class="mlsimport-fieldset-item">
103 <label>'.esc_html__('Visible only in admin ?','mlsimport').'</label>
104 <input type="hidden" id="' . esc_attr( $this->plugin_name ). '_admin_fields_select-visible-mls_field_' .esc_attr( $key ). '" name="' . esc_attr( $this->plugin_name ). '_admin_fields_select[mls-fields-admin][' .esc_attr( $key ). ']" value="0"/>
105 <input type="checkbox" class="mlsimport_select_import_admin_all" id="' . esc_attr( $this->plugin_name ). '_admin_fields_select-visible-mls_field_' . esc_attr( $key ). '" name="' . esc_attr( $this->plugin_name ). '_admin_fields_select[mls-fields-admin][' .esc_attr( $key ) . ']" value="1"' . checked( $is_checkbox_admin, 1, 0 ) . '/>
106 </div>
107
108 <div class="mlsimport-fieldset-item">
109 <label>' . esc_html__( 'Save field as this post meta (add field id name)', 'mlsimport' ).'</label>
110 <input type="text" class="mlsimport-fieldset mlsfield_map_post_meta" name="' . esc_attr( $this->plugin_name) . '_admin_fields_select[mls-fields-map-postmeta][' . esc_attr( $key) . ']" value="' . esc_html($label_post_meta) . '">
111 </div>
112
113 <div class="mlsimport-fieldset-item">
114 <label>' . esc_html__( 'Add Field value as term in category:', 'mlsimport' ).'</label>
115
116
117 <select class="mlsfield_map_post_tax_select" name="' . esc_attr( $this->plugin_name) . '_admin_fields_select[mls-fields-map-taxonomy][' . esc_attr( $key) . ']" >
118 <option value="">'.esc_html('None','mlsimport').'</option>';
119
120 foreach($available_taxonomies as $key=>$label){
121 $non_mandatory_fields .= '<option value="' . esc_attr($key) . '"';
122
123 if ($label_tax_meta == $key) {
124 $non_mandatory_fields .= ' selected';
125 }
126
127 $non_mandatory_fields .= '>' . esc_html($label) . '</option>';
128 }
129
130 $non_mandatory_fields .='</select>
131
132
133 </div>
134
135
136 </div>';
137 if( $value !==''){
138 $non_mandatory_fields .= '
139 <div class="mandatory_fields_wrapper_exp">
140 <strong>' . esc_html__( 'Explanation', 'mlsimport' ) . ':</strong> ' . stripslashes(esc_html( $value) ) . '
141 </div>';
142 }
143
144 $non_mandatory_fields .= '</fieldset>';
145 }
146 }
147 }
148 ?>
149
150 <div class="mandatory_fields_wrapper">
151 <h3><?php esc_html_e( 'These fields will be imported (if found) by default:', 'mlsimport' );?> </h3>
152 <?php echo wp_kses ( $mandatory_fields ,$permited_tags ) ;?>
153
154 <div class="mandatory_fields_wrapper">
155 <h3>
156 <?php echo esc_html_e('Select the extra fields you want to import', 'mlsimport'); ?>:
157 </h3>
158
159 <div id="mls_import_select_all" class="mls_import_selec_all_class" data-import="import_select"><?php echo esc_html_e('Import - Select All', 'mlsimport'); ?></div>
160 <div id="mls_import_select_none" class="mls_import_selec_all_class" data-import="import_select_none"><?php echo esc_html_e('Import - Select None', 'mlsimport'); ?></div>
161 <div id="mls_import_admin_select_all" class="mls_import_selec_all_class" data-import="import_admin"><?php echo esc_html_e('Admin Only - Select All', 'mlsimport'); ?></div>
162 <div id="mls_import_admin_select_none" class="mls_import_selec_all_class" data-import="import_admin_none"><?php echo esc_html_e('Admin Only - Select None', 'mlsimport'); ?></div>
163 <?php
164 echo wp_kses ( $non_mandatory_fields ,$permited_tags );
165 ?>
166 </div>
167
168
169
170
171 <input type="hidden" name="<?php echo esc_attr($this->plugin_name ). '_admin_fields_select[mls-fields-admin][force_rand]'; ?>" value="<?php echo esc_attr(wp_rand()); ?>">
172
173 <?php submit_button( __( 'Save Changes', 'mlsimport'), 'mlsimport_button', 'submit', true ); ?>
174 </form>
175
176 <?php
177 } else {
178 global $mlsimport;
179 $token = $mlsimport->admin->mlsimport_saas_get_mls_api_token_from_transient();
180 if ( trim( $token ) !== '' ) {
181 ?>
182
183 <div class="mlsimport_populate_warning">
184 <?php
185 esc_html_e( 'We need to gather some information about your MLS. Please Stand By! ', 'mlsimport' );
186 ?>
187 </div>
188
189 <?php
190 } else {
191 esc_html_e( 'Your are not connected to MLS Import', 'mlsimport' );
192 }
193 }
194
195
196 ?>
197 <input type="hidden" id="mlsimport_saas_get_metadata" value="<?php echo esc_attr($ajax_nonce = wp_create_nonce( "mlsimport_saas_get_metadata" )); ?>" />
198