HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/z/w/a/zwafgyp/lacalita/wp-content/plugins/rey-core/inc/libs/importer/tasks/attributes.php
<?php
namespace ReyCore\Libs\Importer\Tasks;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use ReyCore\Libs\Importer\Base;
use ReyCore\Libs\Importer\Helper;

class Attributes extends TaskBase
{

	public function get_id(){
		return 'attributes';
	}

	public function get_status(){
		return esc_html__('Process attributes ...', 'rey-core');
	}

	public function run(){

		if( ! ($data = get_transient('rey_demo_data')) ){
			return $this->add_error( 'Cannot retrieve content data.' );
		}

		if( ! ( isset($data['attributes']) && ($attributes = $data['attributes']) ) ){
			return $this->add_notice( 'Cannot retrieve attributes. Most likely not added in this demo.' );
		}

		if( $this->maybe_skip('terms') ){
			return $this->add_notice( 'Skipping terms (attributes) as requested.' );
		}

		if( ! function_exists('wc_update_attribute') ){
			return $this->add_notice( 'WooCommerce is not installed.' );
		}

		foreach ($attributes as $taxonomy => $attribute) {

			$attr_id = wc_update_attribute(0, [
				'id'           => 0,
				'name'         => $attribute['attribute_label'],
				'slug'         => $taxonomy,
				'order_by'     => $attribute['attribute_orderby'],
				'type'         => $attribute['attribute_type'],
				'has_archives' => (bool) $attribute['attribute_public'],
			]);

			if( is_wp_error($attr_id) ){
				continue;
			}

			$this->map['attr_' . $taxonomy] = $attr_id;
		}

		Base::update_map($this->map);

	}

}