Submit
Path:
~
/
home
/
getwphos
/
www
/
dynastymetalworks
/
wp-content
/
plugins
/
indostio-addons
/
inc
/
backend
/
File Content:
importer.php
<?php /** * Hooks for importer * * @package Indostio */ namespace Indostio\Addons; /** * Class Importter */ class Importer { /** * Instance * * @var $instance */ private static $instance; /** * Initiator * * @since 1.0.0 * @return object */ public static function instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Instantiate the object. * * @since 1.0.0 * * @return void */ public function __construct() { add_filter( 'soo_demo_packages', array( $this, 'importer' ), 20 ); add_action( 'soodi_before_import_content', array( $this,'import_product_attributes') ); add_action( 'soodi_before_import_content', array( $this,'enable_svg_upload') ); add_action( 'soodi_after_setup_pages', array( $this,'disable_svg_upload') ); } /** * Importer the demo content * * @since 1.0.0 * * @return array */ function importer() { return array( array( 'name' => 'Home v1', 'content' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/demo-content.xml', 'widgets' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/widgets.wie', 'customizer' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/customizer.dat', 'sliders' => 'https://github.com/nttber/indostio/raw/main/demo-content/home-v1/sliders.zip', 'preview' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/preview-01.jpg', 'pages' => array( 'front_page' => 'Home v1', 'blog' => 'Blog', ), 'menus' => array( 'primary-menu' => 'primary-menu', ), 'options' => array( 'shop_catalog_image_size' => array( 'width' => 370, 'height' => 370, 'crop' => 1, ), 'shop_single_image_size' => array( 'width' => 670, 'height' => 670, 'crop' => 1, ), 'shop_thumbnail_image_size' => array( 'width' => 70, 'height' => 70, 'crop' => 1, ), ), ), array( 'name' => 'Home v2', 'content' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/demo-content.xml', 'widgets' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/widgets.wie', 'customizer' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/customizer.dat', 'sliders' => 'https://github.com/nttber/indostio/raw/main/demo-content/home-v2/sliders.zip', 'preview' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/preview-02.jpg', 'pages' => array( 'front_page' => 'Home v2', 'blog' => 'Blog', ), 'menus' => array( 'primary-menu' => 'primary-menu', ), 'options' => array( 'shop_catalog_image_size' => array( 'width' => 370, 'height' => 370, 'crop' => 1, ), 'shop_single_image_size' => array( 'width' => 670, 'height' => 670, 'crop' => 1, ), 'shop_thumbnail_image_size' => array( 'width' => 70, 'height' => 70, 'crop' => 1, ), ), ), array( 'name' => 'Home v3', 'content' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/demo-content.xml', 'widgets' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/widgets.wie', 'customizer' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/customizer.dat', 'sliders' => 'https://github.com/nttber/indostio/raw/main/demo-content/home-v3/sliders.zip', 'preview' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/preview-03.jpg', 'pages' => array( 'front_page' => 'Home v3', 'blog' => 'Blog', ), 'menus' => array( 'primary-menu' => 'primary-menu', ), 'options' => array( 'shop_catalog_image_size' => array( 'width' => 370, 'height' => 370, 'crop' => 1, ), 'shop_single_image_size' => array( 'width' => 670, 'height' => 670, 'crop' => 1, ), 'shop_thumbnail_image_size' => array( 'width' => 70, 'height' => 70, 'crop' => 1, ), ), ), array( 'name' => 'Home v4', 'content' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/demo-content.xml', 'widgets' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/widgets.wie', 'customizer' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/customizer.dat', 'sliders' => 'https://github.com/nttber/indostio/raw/main/demo-content/home-v4/sliders.zip', 'preview' => 'https://raw.githubusercontent.com/nttber/indostio/main/demo-content/preview-04.jpg', 'pages' => array( 'front_page' => 'Home v4', 'blog' => 'Blog', ), 'menus' => array( 'primary-menu' => 'primary-menu', ), 'options' => array( 'shop_catalog_image_size' => array( 'width' => 370, 'height' => 370, 'crop' => 1, ), 'shop_single_image_size' => array( 'width' => 670, 'height' => 670, 'crop' => 1, ), 'shop_thumbnail_image_size' => array( 'width' => 70, 'height' => 70, 'crop' => 1, ), ), ), ); } /** * Prepare product attributes before import demo content * * @param $file */ function import_product_attributes( $file ) { global $wpdb; if ( ! class_exists( 'WXR_Parser' ) ) { if ( ! file_exists( WP_PLUGIN_DIR . '/soo-demo-importer/includes/parsers.php' ) ) { return; } require_once WP_PLUGIN_DIR . '/soo-demo-importer/includes/parsers.php'; } $parser = new \WXR_Parser(); $import_data = $parser->parse( $file ); if ( empty( $import_data ) || is_wp_error( $import_data ) ) { return; } if ( isset( $import_data['posts'] ) ) { $posts = $import_data['posts']; if ( $posts && sizeof( $posts ) > 0 ) { foreach ( $posts as $post ) { if ( 'product' === $post['post_type'] ) { if ( ! empty( $post['terms'] ) ) { foreach ( $post['terms'] as $term ) { if ( strstr( $term['domain'], 'pa_' ) ) { if ( ! taxonomy_exists( $term['domain'] ) ) { $attribute_name = wc_sanitize_taxonomy_name( str_replace( 'pa_', '', $term['domain'] ) ); // Create the taxonomy if ( ! in_array( $attribute_name, wc_get_attribute_taxonomies() ) ) { $attribute = array( 'attribute_label' => $attribute_name, 'attribute_name' => $attribute_name, 'attribute_type' => 'select', 'attribute_orderby' => 'menu_order', 'attribute_public' => 0 ); $wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute ); delete_transient( 'wc_attribute_taxonomies' ); } // Register the taxonomy now so that the import works! register_taxonomy( $term['domain'], apply_filters( 'woocommerce_taxonomy_objects_' . $term['domain'], array( 'product' ) ), apply_filters( 'woocommerce_taxonomy_args_' . $term['domain'], array( 'hierarchical' => true, 'show_ui' => false, 'query_var' => true, 'rewrite' => false, ) ) ); } } } } } } } } } /** * Enable svg upload * * @param $file */ function enable_svg_upload() { add_filter('upload_mimes', array($this, 'svg_upload_types')); } /** * Enable svg upload * * @param $file */ function svg_upload_types($file_types) { $new_filetypes = array(); $new_filetypes['svg'] = 'image/svg+xml'; $file_types = array_merge($file_types, $new_filetypes ); return $file_types; } /** * Enable svg upload * * @param $file */ function disable_svg_upload() { remove_filter('upload_mimes', array($this, 'svg_upload_types')); } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
importer.php
8474 bytes
0644
theme-builder.php
5457 bytes
0644
theme-settings.php
5405 bytes
0644
user.php
1142 bytes
0644
N4ST4R_ID | Naxtarrr