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 / libraries / XmlExportFiltering.php
wp-all-export / libraries Last commit date
VariableProductTitle 4 years ago .gitkeep 4 years ago WpaeInvalidPhpException.php 4 years ago WpaeInvalidStringException.php 4 years ago WpaeMethodNotFoundException.php 4 years ago WpaePhpInterpreterErrorHandler.php 4 years ago WpaeString.php 4 years ago WpaeTooMuchRecursionException.php 4 years ago WpaeXmlProcessor.php 4 years ago XmlCsvExport.php 4 years ago XmlExportACF.php 4 years ago XmlExportComment.php 4 years ago XmlExportCpt.php 4 years ago XmlExportEngine.php 4 years ago XmlExportFiltering.php 4 years ago XmlExportMediaGallery.php 4 years ago XmlExportTaxonomy.php 4 years ago XmlExportUser.php 4 years ago XmlExportWooCommerce.php 4 years ago XmlExportWooCommerceCoupon.php 4 years ago XmlExportWooCommerceOrder.php 4 years ago XmlGoogleMerchants.php 4 years ago XmlSpec.php 4 years ago
XmlExportFiltering.php
119 lines
1 <?php
2
3 use Wpae\App\Service\VariationOptions\VariationOptionsFactory;
4
5 if ( ! class_exists('XmlExportFiltering') )
6 {
7 class XmlExportFiltering
8 {
9 private $queryWhere = "";
10 private $queryJoin = array();
11 private $userWhere = "";
12 private $userJoin = array();
13 private $options;
14 private $tax_query = false;
15 private $meta_query = false;
16
17 public function __construct($args = array())
18 {
19 $this->options = $args;
20
21 add_filter('wp_all_export_single_filter_rule', array(&$this, 'parse_rule_value'), 10, 1);
22 }
23
24 public function parseQuery()
25 {
26 // do not apply filters for child exports
27 if ( ! empty(XmlExportEngine::$exportRecord->parent_id) )
28 {
29 $this->queryWhere = XmlExportEngine::$exportRecord->options['whereclause'];
30 $this->queryJoin = XmlExportEngine::$exportRecord->options['joinclause'];
31 return;
32 }
33
34 global $wpdb;
35
36 // disable exports for orphaned variations entirely
37 if ( ! XmlExportEngine::$is_comment_export and ! XmlExportEngine::$is_user_export and ! empty(XmlExportEngine::$post_types) and @in_array("product", XmlExportEngine::$post_types) and class_exists('WooCommerce'))
38 {
39 $tmp_queryWhere = $this->queryWhere;
40 $tmp_queryJoin = $this->queryJoin;
41
42 $this->queryJoin = array();
43
44 $this->queryWhere = " $wpdb->posts.post_type = 'product' AND (($wpdb->posts.post_status <> 'trash' AND $wpdb->posts.post_status <> 'auto-draft'))";
45
46 // $where = $this->queryWhere;
47 // $join = implode( ' ', array_unique( $this->queryJoin ) );
48 //
49 // $this->queryWhere = $tmp_queryWhere;
50 // $this->queryJoin = $tmp_queryJoin;
51 //
52 // $this->queryWhere .= " AND $wpdb->posts.post_type = 'product' OR ($wpdb->posts.post_type = 'product_variation' AND $wpdb->posts.post_parent IN (
53 // SELECT DISTINCT $wpdb->posts.ID
54 // FROM $wpdb->posts $join
55 // WHERE $where
56 // )) GROUP BY $wpdb->posts.ID";
57
58 $where = $this->queryWhere;
59 $join = implode( ' ', array_unique( $this->queryJoin ) );
60
61 $this->queryWhere = $tmp_queryWhere;
62 $this->queryJoin = $tmp_queryJoin;
63
64 $vatiationOptionsFactory = new VariationOptionsFactory();
65 $variationOptions = $vatiationOptionsFactory->createVariationOptions(PMXE_EDITION);
66
67 $this->queryWhere .= $variationOptions->getQueryWhere($wpdb, $where, $join, false);
68
69 }
70
71 }
72
73 public static function render_filtering_block( $engine, $isWizard, $post, $is_on_template_screen = false )
74 {
75 ?>
76 <input type="hidden" class="hierarhy-output" name="filter_rules_hierarhy" value="<?php echo esc_html($post['filter_rules_hierarhy']);?>"/>
77 <?php
78
79 if ( $isWizard or $post['export_type'] != 'specific' ) return;
80
81 ?>
82 <div class="wpallexport-collapsed wpallexport-section closed">
83 <div class="wpallexport-content-section wpallexport-filtering-section" <?php if ($is_on_template_screen):?>style="margin-bottom: 10px;"<?php endif; ?>>
84 <div class="wpallexport-collapsed-header" style="padding-left: 25px;">
85 <h3><?php _e('Filtering Options','wp_all_export_plugin');?></h3>
86 </div>
87 <div class="wpallexport-collapsed-content" style="padding: 0;">
88 <div class="wpallexport-collapsed-content-inner">
89 <?php include_once PMXE_ROOT_DIR . '/views/admin/export/blocks/filters.php'; ?>
90 </div>
91 </div>
92 </div>
93 </div>
94 <?php
95 }
96
97 /**
98 * __get function.
99 *
100 * @access public
101 * @param mixed $key
102 * @return mixed
103 */
104 public function __get( $key ) {
105 return $this->get( $key );
106 }
107
108 /**
109 * Get a session variable
110 *
111 * @param string $key
112 * @param mixed $default used if the session variable isn't set
113 * @return mixed value of session variable
114 */
115 public function get( $key, $default = null ) {
116 return isset( $this->{$key} ) ? $this->{$key} : $default;
117 }
118 }
119 }