| Server IP : 5.129.245.98 / Your IP : 216.73.217.19 Web Server : Apache/2.4.66 (Debian) System : Linux 1b8c17c336b9 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/wpai-woocommerce-add-on/src/parser/ |
Upload File : |
<?php
namespace wpai_woocommerce_add_on\parser;
use wpai_woocommerce_add_on\helpers\ParserOptions;
/**
* Class VariationsParser
* @package wpai_woocommerce_add_on\parser
*/
class VariationsParser extends VariationsParserBase {
/**
* VariationsParser constructor.
*
* @param ParserOptions $options
* @param $index
*/
public function __construct(ParserOptions $options, $index) {
parent::__construct($options);
$this->index = $index;
}
/**
*
* Parse WooCommerce Products Import Template for Variation.
*
* @return array
*/
public function parse() {
try {
$this->getChunk() == 1 && $this->log(__('Composing variations data...', 'wpai_woocommerce_addon_plugin'));
$variations = \XmlImportParser::factory($this->getXml(), $this->getCompleteVariationsXPath(), '/', $file)->parse(); $tmp_files[] = $file;
$this->countVariations = count($variations);
foreach ($this->getParsingWorkflow() as $callback => $options) {
if (!empty($options)) {
array_map(array($this, $callback), $options);
continue;
}
call_user_func(array($this, $callback));
}
}
catch (\Exception $e) {}
// Remove all temporary files created.
$this->unlinkTempFiles();
}
/**
* @return int
*/
public function getCountVariations() {
return $this->countVariations;
}
/**
* Get parsing workflow, where keys are callbacks for values.
*
* @return array
*/
public function getParsingWorkflow() {
return array(
'parseOptionType_1' => array(
'variable_sku',
'variable_global_unique_id',
'variable_file_paths',
'variable_file_names'
),
'parseOptionType_2' => array(
'product_manage_stock',
'product_downloadable',
'product_virtual'
),
'parseOptionType_3' => array(
'product_shipping_class',
'product_tax_class'
),
'parseOptionType_4' => array(
'variable_description',
'variable_stock',
'variable_image',
'variable_weight',
'variable_length',
'variable_width',
'variable_height',
'variable_download_limit',
'variable_download_expiry'
),
'parseOptionType_5' => array(
'variable_regular_price',
'variable_sale_price',
'variable_whosale_price'
),
'parseVariationStockStatus' => array(),
'parseVariationBackorders' => array(),
'parseVariationStatus' => array(),
'parseVariationSalePriceSchedule' => array(),
'parseVariationAttributes' => array()
);
}
}