PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | application/controllers/Wdk_settings.php +81 -50 1.3.8 → 1.5.9 View file →
@@ -85,9 +85,8 @@
85 85 public function mailtemplate()
86 86 {
87 87
88 88 $view_file = $this->input->post_get('file');
89 - dump($view_file);
90 89
91 90 $file = false;
92 91 $sourceFile = null;
93 92
@@ -102,9 +101,18 @@
102 101 {
103 102
104 103 // Create the destination directory if it doesn't exist
105 104 if (!is_dir(get_stylesheet_directory().'/wpdirectorykit/application/views/email/')) {
106 - mkdir(get_stylesheet_directory().'/wpdirectorykit/application/views/email/', 0777, true);
105 + global $wp_filesystem;
106 + if (empty($wp_filesystem)) {
107 + require_once(ABSPATH . '/wp-admin/includes/file.php');
108 + WP_Filesystem();
109 + }
110 + $dir_path = get_stylesheet_directory() . '/wpdirectorykit/application/views/email/';
111 + if (!$wp_filesystem->is_dir($dir_path)) {
112 + $wp_filesystem->mkdir($dir_path, FS_CHMOD_DIR | 0777);
113 + }
114 +
107 115 }
108 116
109 117 $destinationFile = get_stylesheet_directory().'/wpdirectorykit/application/views/email/'.$view_file.'.php';
110 118 copy($sourceFile, $destinationFile);
@@ -112,9 +120,18 @@
112 120 elseif(!is_child_theme() && !file_exists(get_template_directory().'/wpdirectorykit/application/views/email/'.$view_file.'.php'))
113 121 {
114 122 // Create the destination directory if it doesn't exist
115 123 if (!is_dir(get_template_directory().'/wpdirectorykit/application/views/email/')) {
116 - mkdir(get_template_directory().'/wpdirectorykit/application/views/email/', 0777, true);
124 + global $wp_filesystem;
125 + if (empty($wp_filesystem)) {
126 + require_once(ABSPATH . '/wp-admin/includes/file.php');
127 + WP_Filesystem();
128 + }
129 + $dir_path = get_template_directory() . '/wpdirectorykit/application/views/email/';
130 + if (!$wp_filesystem->is_dir($dir_path)) {
131 + $wp_filesystem->mkdir($dir_path, FS_CHMOD_DIR | 0777);
132 + }
133 +
117 134 }
118 135
119 136 $destinationFile = get_template_directory().'/wpdirectorykit/application/views/email/'.$view_file.'.php';
120 137 copy($sourceFile, $destinationFile);
@@ -255,8 +272,13 @@
255 272 array(
256 273 'description' => __('User Email Confirm request','wpdirectorykit').'<br>'.'<em>Data vars $subject(string), $data(sting|array)</em>',
257 274 'template' => 'wdk_membership_confirm_email_user_request',
258 275 ),
276 + array(
277 + 'description' => __('Agency agent invitation email (sent to agent when agency invites them)','wpdirectorykit').'<br>'.'<em>Data vars $subject(string), $agency_name(string), $agent_name(string), $agency_profile_link(string), $confirmation_link(string)</em>',
278 + 'template' => 'agency_agent_submit',
279 + ),
280 +
259 281 );
260 282 }
261 283
262 284 function reset_data () {
@@ -325,9 +347,9 @@
325 347 }
326 348
327 349 $redirect_url = admin_url("admin.php?page=wdk_settings&is_updated");
328 350 if(isset($_GET['redirect_url']) && strpos($_GET['redirect_url'], 'http') === FALSE && strpos($_GET['redirect_url'], '//') === FALSE)
329 - $redirect_url = admin_url(sanitize_text_field($_GET['redirect_url']));
351 + $redirect_url = admin_url(sanitize_text_field(wp_unslash($_GET['redirect_url'])));
330 352
331 353 wp_redirect($redirect_url);
332 354 exit;
333 355 }
@@ -426,9 +448,9 @@
426 448
427 449 $this->data['db_data']['multipurpose'] = 'real-estate.xml';
428 450
429 451 if(isset($_GET['multipurpose']))
430 - $this->data['db_data']['multipurpose'] = sanitize_text_field($_GET['multipurpose']);
452 + $this->data['db_data']['multipurpose'] = sanitize_text_field(wp_unslash($_GET['multipurpose']));
431 453
432 454 $this->data['import_log'] = '';
433 455 $this->data['info_log_message'] = '';
434 456
@@ -476,9 +498,9 @@
476 498 );
477 499
478 500 $plugin = 'elementor/elementor.php';
479 501 if (in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ))) && !class_exists('Elementor\Plugin') ) {
480 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Your Elementor Plugin is not fully active, usually this happen because of old PHP version on server, in such case eventually you can try older Elementor Version or Update PHP on your server').'</div>';
502 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Your Elementor Plugin is not fully active, usually this happen because of old PHP version on server, in such case eventually you can try older Elementor Version or Update PHP on your server', 'wpdirectorykit').'</div>';
481 503 $this->data['required_plugins'] = true;
482 504 }
483 505
484 506 if(!$this->data['required_plugins'])
@@ -572,9 +594,9 @@
572 594
573 595 /* remove fields */
574 596 $this->db->delete($this->location_m->_table_name);
575 597
576 - $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Locations removed').'</div>';
598 + $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Locations removed', 'wpdirectorykit').'</div>';
577 599 /* end remove fields */
578 600
579 601 /* remove fields */
580 602 $this->db->delete($this->category_m->_table_name);
@@ -579,9 +601,9 @@
579 601 /* remove fields */
580 602 $this->db->delete($this->category_m->_table_name);
581 603 $this->db->delete($this->dependfields_m->_table_name);
582 604
583 - $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Categories removed').'</div>';
605 + $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Categories removed', 'wpdirectorykit').'</div>';
584 606 /* end remove fields */
585 607
586 608 /* remove fields */
587 609 $this->db->delete($this->field_m->_table_name);
@@ -590,9 +612,9 @@
590 612 if(strpos($field_name, 'field_') ===FALSE) continue;
591 613 $this->db->query('ALTER TABLE '.$this->listingfield_m->_table_name.' DROP COLUMN '.$field_name.'');
592 614 }
593 615
594 - $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Fields removed').'</div>';
616 + $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Fields removed', 'wpdirectorykit').'</div>';
595 617 /* end remove fields */
596 618
597 619 /* remove listings */
598 620 $this->db->delete($this->listing_m->_table_name);
@@ -597,9 +619,9 @@
597 619 /* remove listings */
598 620 $this->db->delete($this->listing_m->_table_name);
599 621 $this->db->delete($this->listingfield_m->_table_name);
600 622
601 - $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Listings removed').'</div>';
623 + $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Listings removed', 'wpdirectorykit').'</div>';
602 624 /* end remove listings */
603 625
604 626
605 627 /* remove listings */
@@ -604,9 +626,9 @@
604 626
605 627 /* remove listings */
606 628 $this->db->delete($this->resultitem_m->_table_name);
607 629 $this->db->delete($this->searchform_m->_table_name);
608 - $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Result Card And Search form removed').'</div>';
630 + $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Result Card And Search form removed', 'wpdirectorykit').'</div>';
609 631 /* end remove listings */
610 632
611 633
612 634 /* reset autoincrement */
@@ -618,9 +640,9 @@
618 640 $this->db->query('TRUNCATE TABLE `'.$this->listing_m->_table_name.'`');
619 641 $this->db->query('TRUNCATE TABLE `'.$this->resultitem_m->_table_name.'`');
620 642 $this->db->query('TRUNCATE TABLE `'.$this->searchform_m->_table_name.'`');
621 643
622 - $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Tables reset').'</div>';
644 + $this->data['data_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Tables reset', 'wpdirectorykit').'</div>';
623 645 /* end reset autoincrement */
624 646
625 647 $wdk_posts = get_posts( array( 'post_type' => 'wdk-listing', 'numberposts' => -1));
626 648 foreach( $wdk_posts as $post ) {
@@ -798,9 +820,9 @@
798 820 $this->replace_meta($from, $to);
799 821
800 822 /* homepage */
801 823 $from = '2020';
802 - $to = date('Y');
824 + $to = gmdate('Y');
803 825 $this->replace_meta($from, $to);
804 826
805 827
806 828 /* replace in db */
@@ -825,9 +847,9 @@
825 847 /* add demo listing preview page */
826 848 private function demo_page_listing($purpose = '') {
827 849
828 850 if((get_option('wdk_listing_page')) && get_post_status(get_option('wdk_listing_page')) =='publish'){
829 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Listing Preview Page already exists').'</div>';
851 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Listing Preview Page already exists', 'wpdirectorykit').'</div>';
830 852 return false;
831 853 }
832 854
833 855 add_action('wpdirectorykit/elementor-elements/register_widget', function($self){
@@ -856,8 +878,9 @@
856 878 $self->add_widget('Wdk\Elementor\Widgets\WdkListingMap');
857 879 $self->add_widget('Wdk\Elementor\Widgets\WdkListinAgent');
858 880 $self->add_widget('Wdk\Elementor\Widgets\WdkListingAgentField');
859 881 $self->add_widget('Wdk\Elementor\Widgets\WdkListingAgentAvatar');
882 + $self->add_widget('Wdk\Elementor\Widgets\WdkCoolListingCarousel');
860 883 });
861 884
862 885 // Import elementor templates
863 886 $page_listing_preview = $this->create_page(esc_html__('Listing Preview', 'wpdirectorykit'), '', 'elementor_canvas');
@@ -866,9 +889,9 @@
866 889 // Assign page.
867 890 if($page_listing_preview)
868 891 update_option( 'wdk_listing_page', $page_listing_preview->ID, TRUE);
869 892
870 - $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Listing Preview Page imported').'</div>';
893 + $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Listing Preview Page imported', 'wpdirectorykit').'</div>';
871 894
872 895 return true;
873 896 }
874 897
@@ -875,9 +898,9 @@
875 898 /* add demo results page */
876 899 private function demo_page_results($purpose = '') {
877 900
878 901 if((get_option('wdk_results_page')) && get_post_status(get_option('wdk_results_page')) == 'publish'){
879 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Results Listings Page already exists').'</div>';
902 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Results Listings Page already exists', 'wpdirectorykit').'</div>';
880 903 return false;
881 904 }
882 905
883 906 add_action('wpdirectorykit/elementor-elements/register_widget', function($self){
@@ -906,8 +929,9 @@
906 929 $self->add_widget('Wdk\Elementor\Widgets\WdkListingMap');
907 930 $self->add_widget('Wdk\Elementor\Widgets\WdkListinAgent');
908 931 $self->add_widget('Wdk\Elementor\Widgets\WdkListingAgentField');
909 932 $self->add_widget('Wdk\Elementor\Widgets\WdkListingAgentAvatar');
933 + $self->add_widget('Wdk\Elementor\Widgets\WdkCoolListingCarousel');
910 934 });
911 935
912 936 $page_results = $this->create_page(esc_html__('Results Listings', 'wpdirectorykit'), '', 'elementor_canvas');
913 937 $this->elementor_assign($page_results->ID, 'page-results-listings.json');
@@ -917,9 +941,9 @@
917 941 update_option( 'page_on_front', $page_results->ID );
918 942
919 943 update_option( 'wdk_results_page', $page_results->ID, TRUE);
920 944
921 - $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Results Listings Page imported').'</div>';
945 + $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Results Listings Page imported', 'wpdirectorykit').'</div>';
922 946
923 947
924 948 $menus = get_registered_nav_menus();
925 949 // first menu defined by template
@@ -951,8 +975,11 @@
951 975 wp_update_nav_menu_item((int)$menu_id, 0, $itemData);
952 976
953 977 // assign menu to top menu
954 978 $locations = get_theme_mod( 'nav_menu_locations' );
979 + if ( ! is_array( $locations ) ) {
980 + $locations = array();
981 + }
955 982 $locations[$first_menu] = $menu_id;
956 983 set_theme_mod('nav_menu_locations', $locations);
957 984 }
958 985
@@ -1092,13 +1119,13 @@
1092 1119 $data['idresultitem'] = 1;
1093 1120 $insert_id = $this->resultitem_m->insert($data, NULL);
1094 1121 }
1095 1122
1096 - $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Search Form & Result Card imported').'</div>';
1123 + $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Search Form & Result Card imported', 'wpdirectorykit').'</div>';
1097 1124 return true;
1098 1125 }
1099 -
1100 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Missing xml file '.$this->import_xml_file, 'wpdirectorykit').'</div>';
1126 + /* translators: 1: XML file path. */
1127 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('Missing xml file %1$s', 'wpdirectorykit'), $this->import_xml_file).'</div>';
1101 1128 return false;
1102 1129
1103 1130 }
1104 1131
@@ -1112,9 +1139,10 @@
1112 1139
1113 1140 if(file_exists($this->import_xml_file_locations)) {
1114 1141 $dom_array = $this->xmlstr_to_array(file_get_contents($this->import_xml_file_locations));
1115 1142 if(!isset($dom_array['locations']['location']) && empty($dom_array['locations']['location'])) {
1116 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('No fields in xml file '.$this->import_xml_file_locations, 'wpdirectorykit').'</div>';
1143 + /* translators: 1: XML file path. */
1144 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('No fields in xml file %1$s', 'wpdirectorykit'), $this->import_xml_file_locations).'</div>';
1117 1145 return false;
1118 1146 }
1119 1147 foreach ($dom_array['locations']['location'] as $key => $location_data) {
1120 1148 $this->_recursive_add_locations($location_data);
@@ -1119,13 +1147,13 @@
1119 1147 foreach ($dom_array['locations']['location'] as $key => $location_data) {
1120 1148 $this->_recursive_add_locations($location_data);
1121 1149 }
1122 1150
1123 - $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Locations imported').'</div>';
1151 + $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Locations imported', 'wpdirectorykit').'</div>';
1124 1152 return true;
1125 1153 }
1126 -
1127 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Missing xml file '.$this->import_xml_file_locations, 'wpdirectorykit').'</div>';
1154 + /* translators: 1: XML file path. */
1155 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('Missing xml file %1$s', 'wpdirectorykit'), $this->import_xml_file_locations).'</div>';
1128 1156 return false;
1129 1157 }
1130 1158
1131 1159 private function _recursive_add_locations ($data = array(), $parent_id = 0, $level = 0 ) {
@@ -1179,9 +1207,10 @@
1179 1207
1180 1208 if(file_exists($this->import_xml_file)) {
1181 1209 $dom_array = $this->xmlstr_to_array(file_get_contents($this->import_xml_file));
1182 1210 if(!isset($dom_array['categories']['category']) && empty($dom_array['categories']['category'])) {
1183 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('No fields in xml file '.$this->import_xml_file, 'wpdirectorykit').'</div>';
1211 + /* translators: 1: XML file path. */
1212 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('No fields in xml file %1$s', 'wpdirectorykit'), $this->import_xml_file).'</div>';
1184 1213 return false;
1185 1214 }
1186 1215
1187 1216 foreach ($dom_array['categories']['category'] as $key => $category_data) {
@@ -1198,13 +1227,13 @@
1198 1227 $order_index++;
1199 1228 }
1200 1229 $this->db->updateBatch( $this->category_m->_table_name, $values, 'idcategory');
1201 1230
1202 - $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Categories imported').'</div>';
1231 + $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Categories imported', 'wpdirectorykit').'</div>';
1203 1232 return true;
1204 1233 }
1205 -
1206 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Missing xml file '.$this->import_xml_file, 'wpdirectorykit').'</div>';
1234 + /* translators: 1: XML file path. */
1235 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('No fields in xml file %1$s', 'wpdirectorykit'), $this->import_xml_file).'</div>';
1207 1236 return false;
1208 1237 }
1209 1238
1210 1239 private function _recursive_add_categories ($data = array(), $parent_id = 0, $level = 0 ) {
@@ -1321,9 +1350,10 @@
1321 1350 'order_index' => '',
1322 1351 );
1323 1352
1324 1353 if(!isset($dom_array['fields']['field']) && empty($dom_array['fields']['field'])) {
1325 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('No fields in xml file '.$this->import_xml_file, 'wpdirectorykit').'</div>';
1354 + /* translators: 1: XML file path. */
1355 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('No fields in xml file %1$s', 'wpdirectorykit'),$this->import_xml_file).'</div>';
1326 1356 return false;
1327 1357 }
1328 1358
1329 1359 foreach ($dom_array['fields']['field'] as $key => $field) {
@@ -1375,13 +1405,13 @@
1375 1405 if(!empty($insert_id))
1376 1406 $this->listingfield_m->create_table_column($field_data, $insert_id);
1377 1407 }
1378 1408
1379 - $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Fields imported').'</div>';
1409 + $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Fields imported', 'wpdirectorykit').'</div>';
1380 1410 return true;
1381 1411 }
1382 -
1383 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Missing xml file '.$this->import_xml_file, 'wpdirectorykit').'</div>';
1412 + /* translators: 1: XML file path. */
1413 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('No fields in xml file %1$s', 'wpdirectorykit'), $this->import_xml_file).'</div>';
1384 1414 return false;
1385 1415 }
1386 1416
1387 1417 private function import_listings($purpose = '') {
@@ -1437,9 +1467,10 @@
1437 1467
1438 1468 if(file_exists($this->import_xml_file)) {
1439 1469 $dom_array = $this->xmlstr_to_array(file_get_contents($this->import_xml_file));
1440 1470 if(!isset($dom_array['listings']['listing']) && empty($dom_array['listings']['listing'])) {
1441 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('No listings in xml file '.$this->import_xml_file, 'wpdirectorykit').'</div>';
1471 + /* translators: 1: XML file path. */
1472 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('No listings in xml file %1$s', 'wpdirectorykit'), $this->import_xml_file).'</div>';
1442 1473 return false;
1443 1474 }
1444 1475
1445 1476 /* demo agent add/get if exists */
@@ -1452,12 +1483,12 @@
1452 1483 $location_id = '';
1453 1484 $category_id = '';
1454 1485
1455 1486 if(!empty($categories))
1456 - $category_id = $categories[rand(0, count($categories)-1)];
1487 + $category_id = $categories[wp_rand(0, count($categories)-1)];
1457 1488
1458 1489 if(!empty($location))
1459 - $location_id = $locations[rand(0, count($locations)-1)];
1490 + $location_id = $locations[wp_rand(0, count($locations)-1)];
1460 1491
1461 1492 $data_listing = array(
1462 1493 'post_title' => '',
1463 1494 'post_content' => '',
@@ -1467,14 +1498,14 @@
1467 1498 'lat' => '',
1468 1499 'listing_images' => '',
1469 1500 'listing_images_path' => '',
1470 1501 'listing_images_path_medium' => '',
1471 - 'date_modified' => date('Y-m-d H:i:s'),
1502 + 'date_modified' => gmdate('Y-m-d H:i:s'),
1472 1503 'lng' => '',
1473 1504 'is_featured' => '',
1474 1505 'is_activated' => '1',
1475 1506 'is_approved' => '1',
1476 - 'counter_views' => rand(20,250),
1507 + 'counter_views' => wp_rand(20,250),
1477 1508 'user_id_editor' => NULL,
1478 1509 );
1479 1510
1480 1511 $data_listing = array_intersect_key(array_merge($data_listing, $listing), $data_listing);
@@ -1503,19 +1534,19 @@
1503 1534 if(count($values) > 0)
1504 1535 {
1505 1536 $start=0;
1506 1537 if(empty($values[0]))$start=1;
1507 - $data_listings_fields['field_'.$field_data->idfield] = $values[rand($start, count($values)-1)];
1538 + $data_listings_fields['field_'.$field_data->idfield] = $values[wp_rand($start, count($values)-1)];
1508 1539 }
1509 1540 }
1510 1541 elseif($field_data->field_type == 'NUMBER')
1511 1542 {
1512 - $data_listings_fields['field_'.$field_data->idfield] = rand(2,499);
1543 + $data_listings_fields['field_'.$field_data->idfield] = wp_rand(2,499);
1513 1544
1514 1545 }
1515 1546 elseif($field_data->field_type == 'CHECKBOX')
1516 1547 {
1517 - $data_listings_fields['field_'.$field_data->idfield] = rand(0,1);
1548 + $data_listings_fields['field_'.$field_data->idfield] = wp_rand(0,1);
1518 1549 }
1519 1550 elseif($field_data->field_type == 'TEXTAREA')
1520 1551 {
1521 1552 //$data_listings_fields['field_'.$field_data->idfield] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
@@ -1556,9 +1587,9 @@
1556 1587 }
1557 1588
1558 1589 $image_url = wp_get_attachment_image_url($image_id, 'large');
1559 1590 if($image_url) {
1560 - $parsed = parse_url($image_url);
1591 + $parsed = wp_parse_url($image_url);
1561 1592 $next_path = substr($parsed['path'], strpos($parsed['path'], 'uploads/')+8);
1562 1593
1563 1594 if(!empty($data_listing['listing_images_path_medium']))
1564 1595 $data_listing['listing_images_path_medium'] .= ',';
@@ -1597,9 +1628,9 @@
1597 1628 }
1598 1629
1599 1630 $image_url = wp_get_attachment_image_url($image_id, 'large');
1600 1631 if($image_url) {
1601 - $parsed = parse_url($image_url);
1632 + $parsed = wp_parse_url($image_url);
1602 1633 $next_path = substr($parsed['path'], strpos($parsed['path'], 'uploads/')+8);
1603 1634
1604 1635 if(!empty($data_listing['listing_images_path_medium']))
1605 1636 $data_listing['listing_images_path_medium'] .= ',';
@@ -1628,10 +1659,10 @@
1628 1659 if(isset( $data_listing[$field_name]))
1629 1660 $listing_data[$field_name] = $data_listing[$field_name];
1630 1661 }
1631 1662 $listing_data['user_id_editor'] = $user_ids[array_rand($user_ids)];
1632 - $listing_data['date_modified'] = date('Y-m-d H:i:s');
1633 - $listing_data['counter_views'] = rand(20,250);
1663 + $listing_data['date_modified'] = gmdate('Y-m-d H:i:s');
1664 + $listing_data['counter_views'] = wp_rand(20,250);
1634 1665
1635 1666 $this->listing_m->insert($listing_data, NULL);
1636 1667
1637 1668 $data_listings_fields['post_id'] = $id;
@@ -1637,13 +1668,13 @@
1637 1668 $data_listings_fields['post_id'] = $id;
1638 1669 $this->listingfield_m->insert_custom_fields($fields, $data_listings_fields, NULL);
1639 1670 }
1640 1671
1641 - $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Listings imported').'</div>';
1672 + $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.esc_html__('Listings imported', 'wpdirectorykit').'</div>';
1642 1673 return true;
1643 1674 }
1644 -
1645 - $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.esc_html__('Missing xml file '.$this->import_xml_file, 'wpdirectorykit').'</div>';
1675 + /* translators: 1: XML file path. */
1676 + $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.wdk_sprintf(esc_html__('No fields in xml file %1$s', 'wpdirectorykit'), $this->import_xml_file).'</div>';
1646 1677 return false;
1647 1678 }
1648 1679
1649 1680 protected function xmlstr_to_array($xmlstr) {
@@ -1829,9 +1860,9 @@
1829 1860
1830 1861 update_option( 'wdk_is_category_enabled', '1' );
1831 1862 update_option( 'wdk_is_location_enabled', '1' );
1832 1863 update_option( 'wdk_is_address_enabled', '1' );
1833 - update_option( 'wdk_is_results_page_require', '1' );
1864 + update_option( 'wdk_is_results_page_require', 0 );
1834 1865 update_option( 'wdk_seo_description', '2' );
1835 1866 update_option( 'wdk_seo_keywords', '3' );
1836 1867 update_option( 'wdk_card_slider_enable', '1' );
1837 1868 update_option('elementor_load_fa4_shim', 'yes');
@@ -1851,9 +1882,9 @@
1851 1882 $page_title_message = $custom_message_title;
1852 1883 }
1853 1884
1854 1885 if(!empty($option) && (get_option($option)) && get_post_status(get_option($option)) =='publish'){
1855 - // $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.$page_title_message.' '.esc_html__('Page already exists', 'wdk-membership').'</div>';
1886 + // $this->data['import_log'] .= '<div class="alert alert-danger" role="alert">'.$page_title_message.' '.esc_html__('Page already exists', 'wpdirectorykit').'</div>';
1856 1887 // return false;
1857 1888 }
1858 1889
1859 1890 add_action('wdk-membership/elementor-elements/register_widget', function($self){
@@ -1889,9 +1920,9 @@
1889 1920 // Assign page.
1890 1921 if($page && !empty($option))
1891 1922 update_option( $option, $page->ID, TRUE);
1892 1923
1893 - $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.$page_title_message.' '.esc_html__('Page imported', 'wdk-membership').'</div>';
1924 + $this->data['import_log'] .= '<div class="alert alert-success" role="alert">'.$page_title_message.' '.esc_html__('Page imported', 'wpdirectorykit').'</div>';
1894 1925
1895 1926 return $page->ID;
1896 1927 }
1897 1928