PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.2.10
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.2.10
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 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.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / helpers / pmxe_functions.php
wp-all-export / helpers Last commit date
backward.php 4 years ago get_taxonomies_by_object_type.php 4 years ago pmxe_filter.php 4 years ago pmxe_functions.php 4 years ago pmxe_prepare_price.php 4 years ago pmxe_render_xml_attributes.php 4 years ago pmxe_render_xml_element.php 4 years ago pmxe_render_xml_text.php 4 years ago str_getcsv.php 4 years ago wp_all_export_check_children_assign.php 4 years ago wp_all_export_generate_export_file.php 4 years ago wp_all_export_get_cpt_name.php 4 years ago wp_all_export_get_export_format.php 4 years ago wp_all_export_is_compatible.php 4 years ago wp_all_export_parse_field_name.php 4 years ago wp_all_export_posts_join.php 4 years ago wp_all_export_posts_where.php 4 years ago wp_all_export_pre_user_query.php 4 years ago wp_all_export_prepare_template_csv.php 4 years ago wp_all_export_prepare_template_xml.php 4 years ago wp_all_export_rand_char.php 4 years ago wp_all_export_remove_colons.php 4 years ago wp_all_export_remove_source.php 4 years ago wp_all_export_reverse_rules_html.php 4 years ago wp_all_export_rmdir.php 4 years ago wp_all_export_secure_file.php 4 years ago wp_all_export_url_title.php 4 years ago wp_all_export_write_article.php 4 years ago wp_redirect_or_javascript.php 4 years ago
pmxe_functions.php
157 lines
1 <?php
2
3 if ( ! function_exists('wp_all_export_isValidMd5')){
4 function wp_all_export_isValidMd5($md5 ='')
5 {
6 return preg_match('/^[a-f0-9]{32}$/', $md5);
7 }
8 }
9
10 if ( ! function_exists('wp_all_export_get_relative_path') ){
11 function wp_all_export_get_relative_path($path){
12
13 $uploads = wp_upload_dir();
14
15 return str_replace($uploads['basedir'], '', $path);
16
17 }
18 }
19
20 if ( ! function_exists('wp_all_export_get_absolute_path') ){
21 function wp_all_export_get_absolute_path($path){
22 $uploads = wp_upload_dir();
23 return ( strpos($path, $uploads['basedir']) === false and ! preg_match('%^https?://%i', $path)) ? $uploads['basedir'] . $path : $path;
24 }
25 }
26
27 if ( ! function_exists('wp_all_export_rrmdir') ){
28 function wp_all_export_rrmdir($dir) {
29 if (is_dir($dir)) {
30 $objects = scandir($dir);
31 foreach ($objects as $object) {
32 if ($object != "." && $object != "..") {
33 if (filetype($dir . "/" . $object) == "dir") wp_all_export_rrmdir($dir . "/" . $object); else unlink($dir . "/" . $object);
34 }
35 }
36 reset($objects);
37 rmdir($dir);
38 }
39 }
40 }
41
42 if ( ! function_exists('pmxe_getExtension')){
43 function pmxe_getExtension($str)
44 {
45 $i = strrpos($str,".");
46 if (!$i) return "";
47 $l = strlen($str) - $i;
48 $ext = substr($str,$i+1,$l);
49 return (strlen($ext) <= 4) ? $ext : "";
50 }
51 }
52
53 if ( ! function_exists('wp_all_export_get_existing_meta_by_cpt'))
54 {
55 function wp_all_export_get_existing_meta_by_cpt( $post_type = false )
56 {
57 if (empty($post_type)) return array();
58
59 $post_type = ($post_type == 'product' and class_exists('WooCommerce')) ? array('product', 'product_variation') : array($post_type);
60
61 global $wpdb;
62 $table_prefix = $wpdb->prefix;
63 $meta_keys = $wpdb->get_results("SELECT DISTINCT {$table_prefix}postmeta.meta_key FROM {$table_prefix}postmeta, {$table_prefix}posts WHERE {$table_prefix}postmeta.post_id = {$table_prefix}posts.ID AND {$table_prefix}posts.post_type IN ('" . implode('\',\'', $post_type) . "') AND {$table_prefix}postmeta.meta_key NOT LIKE '_edit%' AND {$table_prefix}postmeta.meta_key NOT LIKE '_oembed_%' LIMIT 1000");
64
65 $_existing_meta_keys = array();
66 if ( ! empty($meta_keys)){
67 $exclude_keys = array('_first_variation_attributes', '_is_first_variation_created');
68 foreach ($meta_keys as $meta_key) {
69 if ( strpos($meta_key->meta_key, "_tmp") === false && strpos($meta_key->meta_key, "_v_") === false && ! in_array($meta_key->meta_key, $exclude_keys))
70 $_existing_meta_keys[] = $meta_key->meta_key;
71 }
72 }
73 return $_existing_meta_keys;
74 }
75 }
76
77 if ( ! function_exists('wp_all_export_get_existing_taxonomies_by_cpt'))
78 {
79 function wp_all_export_get_existing_taxonomies_by_cpt( $post_type = false )
80 {
81 if (empty($post_type)) return array();
82
83 $post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip(array('post_format')));
84 $_existing_taxonomies = array();
85 if ( ! empty($post_taxonomies)){
86 foreach ($post_taxonomies as $tx) {
87 if (strpos($tx->name, "pa_") !== 0)
88 $_existing_taxonomies[] = array(
89 'name' => empty($tx->label) ? $tx->name : $tx->label,
90 'label' => $tx->name,
91 'type' => 'cats'
92 );
93 }
94 }
95 return $_existing_taxonomies;
96 }
97 }
98
99 if ( ! function_exists('wp_all_export_get_taxonomies')) {
100 function wp_all_export_get_taxonomies() {
101 // get all taxonomies
102 $taxonomies = get_taxonomies(FALSE, 'objects');
103 $ignore = array('nav_menu', 'link_category');
104 $r = array();
105 // populate $r
106 foreach ($taxonomies as $taxonomy) {
107 if (in_array($taxonomy->name, $ignore)) {
108 continue;
109 }
110 if ( ! empty($taxonomy->labels->name) && strpos($taxonomy->labels->name, "_") === false){
111 $r[$taxonomy->name] = $taxonomy->labels->name;
112 }
113 else{
114 $r[$taxonomy->name] = empty($taxonomy->labels->singular_name) ? $taxonomy->name : $taxonomy->labels->singular_name;
115 }
116 }
117 asort($r, SORT_FLAG_CASE | SORT_STRING);
118 // return
119 return $r;
120
121 }
122 }
123
124 if ( ! function_exists('wp_all_export_cmp_custom_types')){
125 function wp_all_export_cmp_custom_types($a, $b)
126 {
127 return strcmp($a->labels->name, $b->labels->name);
128 }
129 }
130
131 if ( ! function_exists('prepare_date_field_value')){
132 function prepare_date_field_value($fieldOptions, $timestamp, $defaultFormat = false){
133
134 if ( ! empty($fieldOptions))
135 {
136 switch ($fieldOptions)
137 {
138 case 'unix':
139 $post_date = $timestamp;
140 break;
141 default:
142 $post_date = date($fieldOptions, $timestamp);
143 break;
144 }
145 }
146 else
147 {
148
149 if ( in_array(XmlExportEngine::$exportOptions['xml_template_type'], array('custom', 'XmlGoogleMerchants')) ){
150 $post_date = date("Y-m-d H:i:s", $timestamp);
151 } else {
152 $post_date = date("Y-m-d", $timestamp);
153 }
154 }
155 return $post_date;
156 }
157 }