VariableProductTitle
9 years ago
.gitkeep
11 years ago
WpaeInvalidPhpException.php
9 years ago
WpaeInvalidStringException.php
9 years ago
WpaeMethodNotFoundException.php
9 years ago
WpaePhpInterpreterErrorHandler.php
2 years ago
WpaeString.php
9 years ago
WpaeTooMuchRecursionException.php
9 years ago
WpaeXmlProcessor.php
2 years ago
XmlCsvExport.php
2 years ago
XmlExportComment.php
4 years ago
XmlExportCpt.php
2 years ago
XmlExportCustomRecord.php
3 years ago
XmlExportEngine.php
2 years ago
XmlExportFiltering.php
4 years ago
XmlExportMediaGallery.php
3 years ago
XmlExportTaxonomy.php
4 years ago
XmlGoogleMerchants.php
9 years ago
XmlSpec.php
9 years ago
XmlExportFiltering.php
107 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 | $vatiationOptionsFactory = new VariationOptionsFactory(); |
| 53 | $variationOptions = $vatiationOptionsFactory->createVariationOptions(PMXE_EDITION); |
| 54 | |
| 55 | $this->queryWhere .= $variationOptions->getQueryWhere($wpdb, $where, $join, false); |
| 56 | |
| 57 | } |
| 58 | |
| 59 | } |
| 60 | |
| 61 | public static function render_filtering_block( $engine, $isWizard, $post, $is_on_template_screen = false ) |
| 62 | { |
| 63 | ?> |
| 64 | <input type="hidden" class="hierarhy-output" name="filter_rules_hierarhy" value="<?php echo esc_attr($post['filter_rules_hierarhy']);?>"/> |
| 65 | <?php |
| 66 | |
| 67 | if ( $isWizard or $post['export_type'] != 'specific' ) return; |
| 68 | |
| 69 | ?> |
| 70 | <div class="wpallexport-collapsed wpallexport-section closed"> |
| 71 | <div class="wpallexport-content-section wpallexport-filtering-section" <?php if ($is_on_template_screen):?>style="margin-bottom: 10px;"<?php endif; ?>> |
| 72 | <div class="wpallexport-collapsed-header" style="padding-left: 25px;"> |
| 73 | <h3><?php esc_html_e('Filtering Options','wp_all_export_plugin');?></h3> |
| 74 | </div> |
| 75 | <div class="wpallexport-collapsed-content" style="padding: 0;"> |
| 76 | <div class="wpallexport-collapsed-content-inner"> |
| 77 | <?php include_once PMXE_ROOT_DIR . '/views/admin/export/blocks/filters.php'; ?> |
| 78 | </div> |
| 79 | </div> |
| 80 | </div> |
| 81 | </div> |
| 82 | <?php |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * __get function. |
| 87 | * |
| 88 | * @access public |
| 89 | * @param mixed $key |
| 90 | * @return mixed |
| 91 | */ |
| 92 | public function __get( $key ) { |
| 93 | return $this->get( $key ); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Get a session variable |
| 98 | * |
| 99 | * @param string $key |
| 100 | * @param mixed $default used if the session variable isn't set |
| 101 | * @return mixed value of session variable |
| 102 | */ |
| 103 | public function get( $key, $default = null ) { |
| 104 | return isset( $this->{$key} ) ? $this->{$key} : $default; |
| 105 | } |
| 106 | } |
| 107 | } |