Version Description
Download this release
Release Info
Developer | vrundakansara |
Plugin | Astra Starter Sites |
Version | 1.3.7 |
Comparing to | |
See all releases |
Code changes from version 1.3.6 to 1.3.7
astra-sites.php
CHANGED
@@ -1,54 +1,54 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: Astra Starter Sites – Elementor, Beaver Builder & Gutenberg Templates
|
4 |
-
* Plugin URI: http://www.wpastra.com/pro/
|
5 |
-
* Description: Import free sites build with Astra theme.
|
6 |
-
* Version: 1.3.
|
7 |
-
* Author: Brainstorm Force
|
8 |
-
* Author URI: http://www.brainstormforce.com
|
9 |
-
* Text Domain: astra-sites
|
10 |
-
*
|
11 |
-
* @package Astra Sites
|
12 |
-
*/
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Set constants.
|
16 |
-
*/
|
17 |
-
if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
|
18 |
-
define( 'ASTRA_SITES_NAME', __( 'Astra Sites', 'astra-sites' ) );
|
19 |
-
}
|
20 |
-
|
21 |
-
if ( ! defined( 'ASTRA_SITES_VER' ) ) {
|
22 |
-
define( 'ASTRA_SITES_VER', '1.3.
|
23 |
-
}
|
24 |
-
|
25 |
-
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
|
26 |
-
define( 'ASTRA_SITES_FILE', __FILE__ );
|
27 |
-
}
|
28 |
-
|
29 |
-
if ( ! defined( 'ASTRA_SITES_BASE' ) ) {
|
30 |
-
define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
|
31 |
-
}
|
32 |
-
|
33 |
-
if ( ! defined( 'ASTRA_SITES_DIR' ) ) {
|
34 |
-
define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
|
35 |
-
}
|
36 |
-
|
37 |
-
if ( ! defined( 'ASTRA_SITES_URI' ) ) {
|
38 |
-
define( 'ASTRA_SITES_URI', plugins_url( '/', ASTRA_SITES_FILE ) );
|
39 |
-
}
|
40 |
-
|
41 |
-
if ( ! function_exists( 'astra_sites_setup' ) ) :
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Astra Sites Setup
|
45 |
-
*
|
46 |
-
* @since 1.0.5
|
47 |
-
*/
|
48 |
-
function astra_sites_setup() {
|
49 |
-
require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites.php';
|
50 |
-
}
|
51 |
-
|
52 |
-
add_action( 'plugins_loaded', 'astra_sites_setup' );
|
53 |
-
|
54 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Astra Starter Sites – Elementor, Beaver Builder & Gutenberg Templates
|
4 |
+
* Plugin URI: http://www.wpastra.com/pro/
|
5 |
+
* Description: Import free sites build with Astra theme.
|
6 |
+
* Version: 1.3.7
|
7 |
+
* Author: Brainstorm Force
|
8 |
+
* Author URI: http://www.brainstormforce.com
|
9 |
+
* Text Domain: astra-sites
|
10 |
+
*
|
11 |
+
* @package Astra Sites
|
12 |
+
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Set constants.
|
16 |
+
*/
|
17 |
+
if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
|
18 |
+
define( 'ASTRA_SITES_NAME', __( 'Astra Sites', 'astra-sites' ) );
|
19 |
+
}
|
20 |
+
|
21 |
+
if ( ! defined( 'ASTRA_SITES_VER' ) ) {
|
22 |
+
define( 'ASTRA_SITES_VER', '1.3.7' );
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
|
26 |
+
define( 'ASTRA_SITES_FILE', __FILE__ );
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( ! defined( 'ASTRA_SITES_BASE' ) ) {
|
30 |
+
define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
|
31 |
+
}
|
32 |
+
|
33 |
+
if ( ! defined( 'ASTRA_SITES_DIR' ) ) {
|
34 |
+
define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( ! defined( 'ASTRA_SITES_URI' ) ) {
|
38 |
+
define( 'ASTRA_SITES_URI', plugins_url( '/', ASTRA_SITES_FILE ) );
|
39 |
+
}
|
40 |
+
|
41 |
+
if ( ! function_exists( 'astra_sites_setup' ) ) :
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Astra Sites Setup
|
45 |
+
*
|
46 |
+
* @since 1.0.5
|
47 |
+
*/
|
48 |
+
function astra_sites_setup() {
|
49 |
+
require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites.php';
|
50 |
+
}
|
51 |
+
|
52 |
+
add_action( 'plugins_loaded', 'astra_sites_setup' );
|
53 |
+
|
54 |
+
endif;
|
inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php
CHANGED
@@ -1,109 +1,109 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Elementor Importer
|
4 |
-
*
|
5 |
-
* @package Astra Sites
|
6 |
-
*/
|
7 |
-
|
8 |
-
namespace Elementor\TemplateLibrary;
|
9 |
-
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit; // Exit if accessed directly.
|
12 |
-
}
|
13 |
-
|
14 |
-
// If plugin - 'Elementor' not exist then return.
|
15 |
-
if ( ! class_exists( '\Elementor\Plugin' ) ) {
|
16 |
-
return;
|
17 |
-
}
|
18 |
-
|
19 |
-
use Elementor\Core\Base\Document;
|
20 |
-
use Elementor\DB;
|
21 |
-
use Elementor\Core\Settings\Page\Manager as PageSettingsManager;
|
22 |
-
use Elementor\Core\Settings\Manager as SettingsManager;
|
23 |
-
use Elementor\Core\Settings\Page\Model;
|
24 |
-
use Elementor\Editor;
|
25 |
-
use Elementor\Plugin;
|
26 |
-
use Elementor\Settings;
|
27 |
-
use Elementor\Utils;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Elementor template library local source.
|
31 |
-
*
|
32 |
-
* Elementor template library local source handler class is responsible for
|
33 |
-
* handling local Elementor templates saved by the user locally on his site.
|
34 |
-
*
|
35 |
-
* @since 1.2.13 Added compatibility for Elemetnor v2.5.0
|
36 |
-
* @since 1.0.0
|
37 |
-
*/
|
38 |
-
class Astra_Sites_Batch_Processing_Elementor extends Source_Local {
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Import
|
42 |
-
*
|
43 |
-
* @since 1.0.14
|
44 |
-
* @return void
|
45 |
-
*/
|
46 |
-
public function import() {
|
47 |
-
|
48 |
-
$post_types =
|
49 |
-
if ( empty( $post_types ) && ! is_array( $post_types ) ) {
|
50 |
-
return;
|
51 |
-
}
|
52 |
-
|
53 |
-
$post_ids = \Astra_Sites_Batch_Processing::get_pages( $post_types );
|
54 |
-
if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
|
55 |
-
return;
|
56 |
-
}
|
57 |
-
|
58 |
-
foreach ( $post_ids as $post_id ) {
|
59 |
-
$is_elementor_post = get_post_meta( $post_id, '_elementor_version', true );
|
60 |
-
if ( $is_elementor_post ) {
|
61 |
-
$this->import_single_post( $post_id );
|
62 |
-
}
|
63 |
-
}
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* Update post meta.
|
67 |
-
*
|
68 |
-
* @since 1.0.14
|
69 |
-
* @param integer $post_id Post ID.
|
70 |
-
* @return void
|
71 |
-
*/
|
72 |
-
public function import_single_post( $post_id = 0 ) {
|
73 |
-
|
74 |
-
if ( ! empty( $post_id ) ) {
|
75 |
-
|
76 |
-
$hotlink_imported = get_post_meta( $post_id, '_astra_sites_hotlink_imported', true );
|
77 |
-
|
78 |
-
if ( empty( $hotlink_imported ) ) {
|
79 |
-
|
80 |
-
$data = get_post_meta( $post_id, '_elementor_data', true );
|
81 |
-
|
82 |
-
if ( ! empty( $data ) ) {
|
83 |
-
|
84 |
-
// Update WP form IDs.
|
85 |
-
$ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
|
86 |
-
if ( $ids_mapping ) {
|
87 |
-
foreach ( $ids_mapping as $old_id => $new_id ) {
|
88 |
-
$data = str_replace( '[wpforms id=\"' . $old_id, '[wpforms id=\"' . $new_id, $data );
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
$data = add_magic_quotes( $data );
|
93 |
-
$data = json_decode( $data, true );
|
94 |
-
|
95 |
-
// Import the data.
|
96 |
-
$data = $this->process_export_import_content( $data, 'on_import' );
|
97 |
-
|
98 |
-
// Update processed meta.
|
99 |
-
update_metadata( 'post', $post_id, '_elementor_data', $data );
|
100 |
-
update_metadata( 'post', $post_id, '_astra_sites_hotlink_imported', true );
|
101 |
-
|
102 |
-
// !important, Clear the cache after images import.
|
103 |
-
Plugin::$instance->posts_css_manager->clear_cache();
|
104 |
-
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Elementor Importer
|
4 |
+
*
|
5 |
+
* @package Astra Sites
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace Elementor\TemplateLibrary;
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit; // Exit if accessed directly.
|
12 |
+
}
|
13 |
+
|
14 |
+
// If plugin - 'Elementor' not exist then return.
|
15 |
+
if ( ! class_exists( '\Elementor\Plugin' ) ) {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
use Elementor\Core\Base\Document;
|
20 |
+
use Elementor\DB;
|
21 |
+
use Elementor\Core\Settings\Page\Manager as PageSettingsManager;
|
22 |
+
use Elementor\Core\Settings\Manager as SettingsManager;
|
23 |
+
use Elementor\Core\Settings\Page\Model;
|
24 |
+
use Elementor\Editor;
|
25 |
+
use Elementor\Plugin;
|
26 |
+
use Elementor\Settings;
|
27 |
+
use Elementor\Utils;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Elementor template library local source.
|
31 |
+
*
|
32 |
+
* Elementor template library local source handler class is responsible for
|
33 |
+
* handling local Elementor templates saved by the user locally on his site.
|
34 |
+
*
|
35 |
+
* @since 1.2.13 Added compatibility for Elemetnor v2.5.0
|
36 |
+
* @since 1.0.0
|
37 |
+
*/
|
38 |
+
class Astra_Sites_Batch_Processing_Elementor extends Source_Local {
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Import
|
42 |
+
*
|
43 |
+
* @since 1.0.14
|
44 |
+
* @return void
|
45 |
+
*/
|
46 |
+
public function import() {
|
47 |
+
|
48 |
+
$post_types = \Astra_Sites_Batch_Processing::get_post_types_supporting( 'elementor' );
|
49 |
+
if ( empty( $post_types ) && ! is_array( $post_types ) ) {
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
|
53 |
+
$post_ids = \Astra_Sites_Batch_Processing::get_pages( $post_types );
|
54 |
+
if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
|
58 |
+
foreach ( $post_ids as $post_id ) {
|
59 |
+
$is_elementor_post = get_post_meta( $post_id, '_elementor_version', true );
|
60 |
+
if ( $is_elementor_post ) {
|
61 |
+
$this->import_single_post( $post_id );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
/**
|
66 |
+
* Update post meta.
|
67 |
+
*
|
68 |
+
* @since 1.0.14
|
69 |
+
* @param integer $post_id Post ID.
|
70 |
+
* @return void
|
71 |
+
*/
|
72 |
+
public function import_single_post( $post_id = 0 ) {
|
73 |
+
|
74 |
+
if ( ! empty( $post_id ) ) {
|
75 |
+
|
76 |
+
$hotlink_imported = get_post_meta( $post_id, '_astra_sites_hotlink_imported', true );
|
77 |
+
|
78 |
+
if ( empty( $hotlink_imported ) ) {
|
79 |
+
|
80 |
+
$data = get_post_meta( $post_id, '_elementor_data', true );
|
81 |
+
|
82 |
+
if ( ! empty( $data ) ) {
|
83 |
+
|
84 |
+
// Update WP form IDs.
|
85 |
+
$ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
|
86 |
+
if ( $ids_mapping ) {
|
87 |
+
foreach ( $ids_mapping as $old_id => $new_id ) {
|
88 |
+
$data = str_replace( '[wpforms id=\"' . $old_id, '[wpforms id=\"' . $new_id, $data );
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
$data = add_magic_quotes( $data );
|
93 |
+
$data = json_decode( $data, true );
|
94 |
+
|
95 |
+
// Import the data.
|
96 |
+
$data = $this->process_export_import_content( $data, 'on_import' );
|
97 |
+
|
98 |
+
// Update processed meta.
|
99 |
+
update_metadata( 'post', $post_id, '_elementor_data', $data );
|
100 |
+
update_metadata( 'post', $post_id, '_astra_sites_hotlink_imported', true );
|
101 |
+
|
102 |
+
// !important, Clear the cache after images import.
|
103 |
+
Plugin::$instance->posts_css_manager->clear_cache();
|
104 |
+
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
inc/importers/batch-processing/class-astra-sites-batch-processing.php
CHANGED
@@ -1,210 +1,227 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Batch Processing
|
4 |
-
*
|
5 |
-
* @package Astra Sites
|
6 |
-
* @since 1.0.14
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! class_exists( 'Astra_Sites_Batch_Processing' ) ) :
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Astra_Sites_Batch_Processing
|
13 |
-
*
|
14 |
-
* @since 1.0.14
|
15 |
-
*/
|
16 |
-
class Astra_Sites_Batch_Processing {
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Instance
|
20 |
-
*
|
21 |
-
* @since 1.0.14
|
22 |
-
* @var object Class object.
|
23 |
-
* @access private
|
24 |
-
*/
|
25 |
-
private static $instance;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Process All
|
29 |
-
*
|
30 |
-
* @since 1.0.14
|
31 |
-
* @var object Class object.
|
32 |
-
* @access public
|
33 |
-
*/
|
34 |
-
public static $process_all;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Initiator
|
38 |
-
*
|
39 |
-
* @since 1.0.14
|
40 |
-
* @return object initialized object of class.
|
41 |
-
*/
|
42 |
-
public static function get_instance() {
|
43 |
-
if ( ! isset( self::$instance ) ) {
|
44 |
-
self::$instance = new self;
|
45 |
-
}
|
46 |
-
return self::$instance;
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Constructor
|
51 |
-
*
|
52 |
-
* @since 1.0.14
|
53 |
-
*/
|
54 |
-
public function __construct() {
|
55 |
-
|
56 |
-
// Core Helpers - Image.
|
57 |
-
// @todo This file is required for Elementor.
|
58 |
-
// Once we implement our logic for updating elementor data then we'll delete this file.
|
59 |
-
require_once ABSPATH . 'wp-admin/includes/image.php';
|
60 |
-
|
61 |
-
// Core Helpers - Image Downloader.
|
62 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php';
|
63 |
-
|
64 |
-
// Core Helpers - Batch Processing.
|
65 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-async-request.php';
|
66 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process.php';
|
67 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process-astra.php';
|
68 |
-
|
69 |
-
// Prepare Widgets.
|
70 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-widgets.php';
|
71 |
-
|
72 |
-
// Prepare Page Builders.
|
73 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-beaver-builder.php';
|
74 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php';
|
75 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-gutenberg.php';
|
76 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-brizy.php';
|
77 |
-
|
78 |
-
// Prepare Misc.
|
79 |
-
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-misc.php';
|
80 |
-
|
81 |
-
self::$process_all = new WP_Background_Process_Astra();
|
82 |
-
|
83 |
-
// Start image importing after site import complete.
|
84 |
-
add_filter( 'astra_sites_image_importer_skip_image', array( $this, 'skip_image' ), 10, 2 );
|
85 |
-
add_action( 'astra_sites_import_complete', array( $this, 'start_process' ) );
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Skip Image from Batch Processing.
|
90 |
-
*
|
91 |
-
* @since 1.0.14
|
92 |
-
*
|
93 |
-
* @param boolean $can_process Batch process image status.
|
94 |
-
* @param array $attachment Batch process image input.
|
95 |
-
* @return boolean
|
96 |
-
*/
|
97 |
-
function skip_image( $can_process, $attachment ) {
|
98 |
-
|
99 |
-
if ( isset( $attachment['url'] ) && ! empty( $attachment['url'] ) ) {
|
100 |
-
if (
|
101 |
-
strpos( $attachment['url'], 'brainstormforce.com' ) !== false ||
|
102 |
-
strpos( $attachment['url'], 'wpastra.com' ) !== false ||
|
103 |
-
strpos( $attachment['url'], 'sharkz.in' ) !== false ||
|
104 |
-
strpos( $attachment['url'], 'websitedemos.net' ) !== false
|
105 |
-
) {
|
106 |
-
return false;
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
return true;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Start Image Import
|
115 |
-
*
|
116 |
-
* @since 1.0.14
|
117 |
-
*
|
118 |
-
* @return void
|
119 |
-
*/
|
120 |
-
public function start_process() {
|
121 |
-
|
122 |
-
Astra_Sites_Importer_Log::add( 'Batch Process Started!' );
|
123 |
-
Astra_Sites_Importer_Log::add( Astra_Sites_White_Label::get_instance()->page_title( ASTRA_SITES_NAME ) . ' - Importing Images for Blog name \'' . get_bloginfo( 'name' ) . '\' (' . get_current_blog_id() . ')' );
|
124 |
-
|
125 |
-
// Add "widget" in import [queue].
|
126 |
-
if ( class_exists( 'Astra_Sites_Batch_Processing_Widgets' ) ) {
|
127 |
-
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Widgets::get_instance() );
|
128 |
-
}
|
129 |
-
|
130 |
-
// Add "gutenberg" in import [queue].
|
131 |
-
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Gutenberg::get_instance() );
|
132 |
-
|
133 |
-
// Add "brizy" in import [queue].
|
134 |
-
if ( is_plugin_active( 'brizy/brizy.php' ) ) {
|
135 |
-
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Brizy::get_instance() );
|
136 |
-
}
|
137 |
-
|
138 |
-
// Add "bb-plugin" in import [queue].
|
139 |
-
// Add "beaver-builder-lite-version" in import [queue].
|
140 |
-
if ( is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active( 'bb-plugin/fl-builder.php' ) ) {
|
141 |
-
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Beaver_Builder::get_instance() );
|
142 |
-
}
|
143 |
-
|
144 |
-
// Add "elementor" in import [queue].
|
145 |
-
// @todo Remove required `allow_url_fopen` support.
|
146 |
-
if ( ini_get( 'allow_url_fopen' ) ) {
|
147 |
-
if ( is_plugin_active( 'elementor/elementor.php' ) ) {
|
148 |
-
$import = new \Elementor\TemplateLibrary\Astra_Sites_Batch_Processing_Elementor();
|
149 |
-
self::$process_all->push_to_queue( $import );
|
150 |
-
}
|
151 |
-
} else {
|
152 |
-
Astra_Sites_Importer_Log::add( 'Couldn\'t not import image due to allow_url_fopen() is disabled!' );
|
153 |
-
}
|
154 |
-
|
155 |
-
// Add "astra-addon" in import [queue].
|
156 |
-
if ( is_plugin_active( 'astra-addon/astra-addon.php' ) ) {
|
157 |
-
if ( class_exists( 'Astra_Sites_Compatibility_Astra_Pro' ) ) {
|
158 |
-
self::$process_all->push_to_queue( Astra_Sites_Compatibility_Astra_Pro::get_instance() );
|
159 |
-
}
|
160 |
-
}
|
161 |
-
|
162 |
-
// Add "misc" in import [queue].
|
163 |
-
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Misc::get_instance() );
|
164 |
-
|
165 |
-
// Dispatch Queue.
|
166 |
-
self::$process_all->save()->dispatch();
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Get all post id's
|
171 |
-
*
|
172 |
-
* @since 1.0.14
|
173 |
-
*
|
174 |
-
* @param array $post_types Post types.
|
175 |
-
* @return array
|
176 |
-
*/
|
177 |
-
public static function get_pages( $post_types = array() ) {
|
178 |
-
|
179 |
-
if ( $post_types ) {
|
180 |
-
$args = array(
|
181 |
-
'post_type' => $post_types,
|
182 |
-
|
183 |
-
// Query performance optimization.
|
184 |
-
'fields' => 'ids',
|
185 |
-
'no_found_rows' => true,
|
186 |
-
'post_status' => 'publish',
|
187 |
-
'posts_per_page' => -1,
|
188 |
-
);
|
189 |
-
|
190 |
-
$query = new WP_Query( $args );
|
191 |
-
|
192 |
-
// Have posts?
|
193 |
-
if ( $query->have_posts() ) :
|
194 |
-
|
195 |
-
return $query->posts;
|
196 |
-
|
197 |
-
endif;
|
198 |
-
}
|
199 |
-
|
200 |
-
return null;
|
201 |
-
}
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Batch Processing
|
4 |
+
*
|
5 |
+
* @package Astra Sites
|
6 |
+
* @since 1.0.14
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'Astra_Sites_Batch_Processing' ) ) :
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Astra_Sites_Batch_Processing
|
13 |
+
*
|
14 |
+
* @since 1.0.14
|
15 |
+
*/
|
16 |
+
class Astra_Sites_Batch_Processing {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Instance
|
20 |
+
*
|
21 |
+
* @since 1.0.14
|
22 |
+
* @var object Class object.
|
23 |
+
* @access private
|
24 |
+
*/
|
25 |
+
private static $instance;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Process All
|
29 |
+
*
|
30 |
+
* @since 1.0.14
|
31 |
+
* @var object Class object.
|
32 |
+
* @access public
|
33 |
+
*/
|
34 |
+
public static $process_all;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Initiator
|
38 |
+
*
|
39 |
+
* @since 1.0.14
|
40 |
+
* @return object initialized object of class.
|
41 |
+
*/
|
42 |
+
public static function get_instance() {
|
43 |
+
if ( ! isset( self::$instance ) ) {
|
44 |
+
self::$instance = new self;
|
45 |
+
}
|
46 |
+
return self::$instance;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Constructor
|
51 |
+
*
|
52 |
+
* @since 1.0.14
|
53 |
+
*/
|
54 |
+
public function __construct() {
|
55 |
+
|
56 |
+
// Core Helpers - Image.
|
57 |
+
// @todo This file is required for Elementor.
|
58 |
+
// Once we implement our logic for updating elementor data then we'll delete this file.
|
59 |
+
require_once ABSPATH . 'wp-admin/includes/image.php';
|
60 |
+
|
61 |
+
// Core Helpers - Image Downloader.
|
62 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php';
|
63 |
+
|
64 |
+
// Core Helpers - Batch Processing.
|
65 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-async-request.php';
|
66 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process.php';
|
67 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/helpers/class-wp-background-process-astra.php';
|
68 |
+
|
69 |
+
// Prepare Widgets.
|
70 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-widgets.php';
|
71 |
+
|
72 |
+
// Prepare Page Builders.
|
73 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-beaver-builder.php';
|
74 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php';
|
75 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-gutenberg.php';
|
76 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-brizy.php';
|
77 |
+
|
78 |
+
// Prepare Misc.
|
79 |
+
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing-misc.php';
|
80 |
+
|
81 |
+
self::$process_all = new WP_Background_Process_Astra();
|
82 |
+
|
83 |
+
// Start image importing after site import complete.
|
84 |
+
add_filter( 'astra_sites_image_importer_skip_image', array( $this, 'skip_image' ), 10, 2 );
|
85 |
+
add_action( 'astra_sites_import_complete', array( $this, 'start_process' ) );
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Skip Image from Batch Processing.
|
90 |
+
*
|
91 |
+
* @since 1.0.14
|
92 |
+
*
|
93 |
+
* @param boolean $can_process Batch process image status.
|
94 |
+
* @param array $attachment Batch process image input.
|
95 |
+
* @return boolean
|
96 |
+
*/
|
97 |
+
function skip_image( $can_process, $attachment ) {
|
98 |
+
|
99 |
+
if ( isset( $attachment['url'] ) && ! empty( $attachment['url'] ) ) {
|
100 |
+
if (
|
101 |
+
strpos( $attachment['url'], 'brainstormforce.com' ) !== false ||
|
102 |
+
strpos( $attachment['url'], 'wpastra.com' ) !== false ||
|
103 |
+
strpos( $attachment['url'], 'sharkz.in' ) !== false ||
|
104 |
+
strpos( $attachment['url'], 'websitedemos.net' ) !== false
|
105 |
+
) {
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
return true;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Start Image Import
|
115 |
+
*
|
116 |
+
* @since 1.0.14
|
117 |
+
*
|
118 |
+
* @return void
|
119 |
+
*/
|
120 |
+
public function start_process() {
|
121 |
+
|
122 |
+
Astra_Sites_Importer_Log::add( 'Batch Process Started!' );
|
123 |
+
Astra_Sites_Importer_Log::add( Astra_Sites_White_Label::get_instance()->page_title( ASTRA_SITES_NAME ) . ' - Importing Images for Blog name \'' . get_bloginfo( 'name' ) . '\' (' . get_current_blog_id() . ')' );
|
124 |
+
|
125 |
+
// Add "widget" in import [queue].
|
126 |
+
if ( class_exists( 'Astra_Sites_Batch_Processing_Widgets' ) ) {
|
127 |
+
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Widgets::get_instance() );
|
128 |
+
}
|
129 |
+
|
130 |
+
// Add "gutenberg" in import [queue].
|
131 |
+
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Gutenberg::get_instance() );
|
132 |
+
|
133 |
+
// Add "brizy" in import [queue].
|
134 |
+
if ( is_plugin_active( 'brizy/brizy.php' ) ) {
|
135 |
+
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Brizy::get_instance() );
|
136 |
+
}
|
137 |
+
|
138 |
+
// Add "bb-plugin" in import [queue].
|
139 |
+
// Add "beaver-builder-lite-version" in import [queue].
|
140 |
+
if ( is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active( 'bb-plugin/fl-builder.php' ) ) {
|
141 |
+
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Beaver_Builder::get_instance() );
|
142 |
+
}
|
143 |
+
|
144 |
+
// Add "elementor" in import [queue].
|
145 |
+
// @todo Remove required `allow_url_fopen` support.
|
146 |
+
if ( ini_get( 'allow_url_fopen' ) ) {
|
147 |
+
if ( is_plugin_active( 'elementor/elementor.php' ) ) {
|
148 |
+
$import = new \Elementor\TemplateLibrary\Astra_Sites_Batch_Processing_Elementor();
|
149 |
+
self::$process_all->push_to_queue( $import );
|
150 |
+
}
|
151 |
+
} else {
|
152 |
+
Astra_Sites_Importer_Log::add( 'Couldn\'t not import image due to allow_url_fopen() is disabled!' );
|
153 |
+
}
|
154 |
+
|
155 |
+
// Add "astra-addon" in import [queue].
|
156 |
+
if ( is_plugin_active( 'astra-addon/astra-addon.php' ) ) {
|
157 |
+
if ( class_exists( 'Astra_Sites_Compatibility_Astra_Pro' ) ) {
|
158 |
+
self::$process_all->push_to_queue( Astra_Sites_Compatibility_Astra_Pro::get_instance() );
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
// Add "misc" in import [queue].
|
163 |
+
self::$process_all->push_to_queue( Astra_Sites_Batch_Processing_Misc::get_instance() );
|
164 |
+
|
165 |
+
// Dispatch Queue.
|
166 |
+
self::$process_all->save()->dispatch();
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Get all post id's
|
171 |
+
*
|
172 |
+
* @since 1.0.14
|
173 |
+
*
|
174 |
+
* @param array $post_types Post types.
|
175 |
+
* @return array
|
176 |
+
*/
|
177 |
+
public static function get_pages( $post_types = array() ) {
|
178 |
+
|
179 |
+
if ( $post_types ) {
|
180 |
+
$args = array(
|
181 |
+
'post_type' => $post_types,
|
182 |
+
|
183 |
+
// Query performance optimization.
|
184 |
+
'fields' => 'ids',
|
185 |
+
'no_found_rows' => true,
|
186 |
+
'post_status' => 'publish',
|
187 |
+
'posts_per_page' => -1,
|
188 |
+
);
|
189 |
+
|
190 |
+
$query = new WP_Query( $args );
|
191 |
+
|
192 |
+
// Have posts?
|
193 |
+
if ( $query->have_posts() ) :
|
194 |
+
|
195 |
+
return $query->posts;
|
196 |
+
|
197 |
+
endif;
|
198 |
+
}
|
199 |
+
|
200 |
+
return null;
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Get Supporting Post Types..
|
205 |
+
*
|
206 |
+
* @since 1.3.7
|
207 |
+
* @param integer $feature Feature.
|
208 |
+
* @return array
|
209 |
+
*/
|
210 |
+
public static function get_post_types_supporting( $feature ) {
|
211 |
+
global $_wp_post_type_features;
|
212 |
+
|
213 |
+
$post_types = array_keys(
|
214 |
+
wp_filter_object_list( $_wp_post_type_features, array( $feature => true ) )
|
215 |
+
);
|
216 |
+
|
217 |
+
return $post_types;
|
218 |
+
}
|
219 |
+
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Kicking this off by calling 'get_instance()' method
|
224 |
+
*/
|
225 |
+
Astra_Sites_Batch_Processing::get_instance();
|
226 |
+
|
227 |
+
endif;
|
languages/astra-sites.pot
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Astra Starter Sites – Elementor, Beaver Builder & "
|
6 |
-
"Gutenberg Templates 1.3.
|
7 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
|
8 |
-
"POT-Creation-Date: 2019-04-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Astra Starter Sites – Elementor, Beaver Builder & "
|
6 |
+
"Gutenberg Templates 1.3.7\n"
|
7 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/astra-sites\n"
|
8 |
+
"POT-Creation-Date: 2019-04-23 12:15:17+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Elementor,Beaver Builder,Templates,Gutenberg,Astra Starter Sites
|
|
5 |
Requires at least: 4.4
|
6 |
Requires PHP: 5.3
|
7 |
Tested up to: 5.1.1
|
8 |
-
Stable tag: 1.3.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -117,6 +117,9 @@ We are open to suggestions and would love to work on topics that our users are l
|
|
117 |
|
118 |
== Changelog ==
|
119 |
|
|
|
|
|
|
|
120 |
v1.3.6 - 19-April-2019
|
121 |
- Fix: After Import UAG - Post Grid categories do not retain issue fixed
|
122 |
- Fix: Premium Sites not importing due to invalid URL error.
|
5 |
Requires at least: 4.4
|
6 |
Requires PHP: 5.3
|
7 |
Tested up to: 5.1.1
|
8 |
+
Stable tag: 1.3.7
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
117 |
|
118 |
== Changelog ==
|
119 |
|
120 |
+
v1.3.7 - 23-April-2019
|
121 |
+
- Fix: Compatibility to WP Forms in Header and Footer of the demo site for Elementor.
|
122 |
+
|
123 |
v1.3.6 - 19-April-2019
|
124 |
- Fix: After Import UAG - Post Grid categories do not retain issue fixed
|
125 |
- Fix: Premium Sites not importing due to invalid URL error.
|