VariableProductTitle
3 weeks ago
.gitkeep
10 years ago
WpaeInvalidPhpException.php
9 years ago
WpaeInvalidStringException.php
9 years ago
WpaeMethodNotFoundException.php
9 years ago
WpaePhpInterpreterErrorHandler.php
3 weeks ago
WpaeString.php
8 years ago
WpaeTooMuchRecursionException.php
9 years ago
XmlCsvExport.php
3 weeks ago
XmlExportCpt.php
3 weeks ago
XmlExportCustomRecord.php
3 weeks ago
XmlExportEngine.php
3 weeks ago
XmlExportFiltering.php
3 weeks ago
XmlExportMediaGallery.php
3 weeks ago
XmlExportTaxonomy.php
3 weeks ago
XmlExportFiltering.php
111 lines
| 1 | <?php |
| 2 | |
| 3 | // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- legitimate plugin prefixes (pmxe/PMXE/wpae/Wpae/wp_all_export/wpallexport/XmlExport/CdataStrategy/VariableProductTitle/Soflyy/GF_Export); Plugin Check does not honor phpcs.xml prefix declaration |
| 4 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | |
| 7 | use Wpae\App\Service\VariationOptions\VariationOptionsFactory; |
| 8 | |
| 9 | if ( ! class_exists('XmlExportFiltering') ) |
| 10 | { |
| 11 | class XmlExportFiltering |
| 12 | { |
| 13 | private $queryWhere = ""; |
| 14 | private $queryJoin = array(); |
| 15 | private $userWhere = ""; |
| 16 | private $userJoin = array(); |
| 17 | private $options; |
| 18 | private $tax_query = false; |
| 19 | private $meta_query = false; |
| 20 | |
| 21 | public function __construct($args = array()) |
| 22 | { |
| 23 | $this->options = $args; |
| 24 | |
| 25 | add_filter('wp_all_export_single_filter_rule', array(&$this, 'parse_rule_value'), 10, 1); |
| 26 | } |
| 27 | |
| 28 | public function parseQuery() |
| 29 | { |
| 30 | // do not apply filters for child exports |
| 31 | if ( ! empty(XmlExportEngine::$exportRecord->parent_id) ) |
| 32 | { |
| 33 | $this->queryWhere = XmlExportEngine::$exportRecord->options['whereclause']; |
| 34 | $this->queryJoin = XmlExportEngine::$exportRecord->options['joinclause']; |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | global $wpdb; |
| 39 | |
| 40 | // disable exports for orphaned variations entirely |
| 41 | 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')) |
| 42 | { |
| 43 | $tmp_queryWhere = $this->queryWhere; |
| 44 | $tmp_queryJoin = $this->queryJoin; |
| 45 | |
| 46 | $this->queryJoin = array(); |
| 47 | |
| 48 | $this->queryWhere = " $wpdb->posts.post_type = 'product' AND (($wpdb->posts.post_status <> 'trash' AND $wpdb->posts.post_status <> 'auto-draft'))"; |
| 49 | |
| 50 | $where = $this->queryWhere; |
| 51 | $join = implode( ' ', array_unique( $this->queryJoin ) ); |
| 52 | |
| 53 | $this->queryWhere = $tmp_queryWhere; |
| 54 | $this->queryJoin = $tmp_queryJoin; |
| 55 | |
| 56 | $vatiationOptionsFactory = new VariationOptionsFactory(); |
| 57 | $variationOptions = $vatiationOptionsFactory->createVariationOptions(PMXE_EDITION); |
| 58 | |
| 59 | $this->queryWhere .= $variationOptions->getQueryWhere($wpdb, $where, $join, false); |
| 60 | |
| 61 | } |
| 62 | |
| 63 | } |
| 64 | |
| 65 | public static function render_filtering_block( $engine, $isWizard, $post, $is_on_template_screen = false ) |
| 66 | { |
| 67 | ?> |
| 68 | <input type="hidden" class="hierarhy-output" name="filter_rules_hierarhy" value="<?php echo esc_attr($post['filter_rules_hierarhy']);?>"/> |
| 69 | <?php |
| 70 | |
| 71 | if ( $isWizard or $post['export_type'] != 'specific' ) return; |
| 72 | |
| 73 | ?> |
| 74 | <div class="wpallexport-collapsed wpallexport-section closed"> |
| 75 | <div class="wpallexport-content-section wpallexport-filtering-section" <?php if ($is_on_template_screen):?>style="margin-bottom: 10px;"<?php endif; ?>> |
| 76 | <div class="wpallexport-collapsed-header" style="padding-left: 25px;"> |
| 77 | <h3><?php esc_html_e('Filtering Options','wp-all-export');?></h3> |
| 78 | </div> |
| 79 | <div class="wpallexport-collapsed-content" style="padding: 0;"> |
| 80 | <div class="wpallexport-collapsed-content-inner"> |
| 81 | <?php include_once PMXE_ROOT_DIR . '/views/admin/export/blocks/filters.php'; ?> |
| 82 | </div> |
| 83 | </div> |
| 84 | </div> |
| 85 | </div> |
| 86 | <?php |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * __get function. |
| 91 | * |
| 92 | * @access public |
| 93 | * @param mixed $key |
| 94 | * @return mixed |
| 95 | */ |
| 96 | public function __get( $key ) { |
| 97 | return $this->get( $key ); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Get a session variable |
| 102 | * |
| 103 | * @param string $key |
| 104 | * @param mixed $default used if the session variable isn't set |
| 105 | * @return mixed value of session variable |
| 106 | */ |
| 107 | public function get( $key, $default = null ) { |
| 108 | return isset( $this->{$key} ) ? $this->{$key} : $default; |
| 109 | } |
| 110 | } |
| 111 | } |