PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.2.4
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.2.4
3.8.0 3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 All 112 releases
← All changes | includes/Core/Importer/Runners/BaseRunner.php +19 -5 3.1.1 → 3.2.4 View file →
@@ -11,13 +11,15 @@
11 11 use Templately\Core\Importer\Utils\Utils;
12 12
13 13 abstract class BaseRunner {
14 14 use LogHelper;
15 + use Loop;
15 16
16 17 const META_SESSION_KEY = '_templately_import_session_id';
17 18 /**
18 19 * @var FullSiteImport
19 20 */
21 + protected $dev_mode;
20 22 protected $origin;
21 23 protected $platform;
22 24 protected $manifest;
23 25 protected $dir_path;
@@ -35,18 +37,20 @@
35 37
36 38 /**
37 39 * @throws Exception
38 40 */
39 - public function __construct( FullSiteImport $full_site_import ) {
40 - $this->origin = $full_site_import;
41 - $this->dir_path = $full_site_import->dir_path;
42 - $this->manifest = &$full_site_import->manifest;
41 + public function __construct( $request_params ) {
42 + $this->dev_mode = defined('TEMPLATELY_DEV') && TEMPLATELY_DEV;
43 + $this->origin = $request_params['origin'];
44 + $this->dir_path = $request_params['dir_path'];
45 + $this->manifest = &$request_params['manifest'];
43 46 $this->platform = $this->manifest['platform'] ?? '';
44 - $this->session_id = $full_site_import->session_id;
47 + $this->session_id = $request_params['session_id'];
45 48
46 49
47 50 $this->factory = new TemplateFactory( $this->platform );
48 51 $this->json = Utils::get_json_helper( $this->platform );
52 + $this->json->session_id = $this->session_id;
49 53
50 54 if ( empty( $this->platform ) ) {
51 55 throw new Exception( __( 'Platform is not specified. Please try again after specifying the platform.', 'templately' ) );
52 56 }
@@ -83,6 +87,16 @@
83 87 $action = $this->get_action();
84 88 }
85 89
86 90 $this->sse_log( $this->get_name(), $message, min( $progress, 100 ), $action );
91 + }
92 +
93 + /**
94 + * @throws Exception
95 + */
96 + protected function throw($message, $code = 0) {
97 + if ($this->dev_mode) {
98 + error_log(print_r($message, 1));
99 + }
100 + throw new Exception($message);
87 101 }
88 102 }