| @@ -87,18 +87,8 @@ | ||
| 87 | 87 | * WXR attachment ID |
| 88 | 88 | */ |
| 89 | 89 | private $id; |
| 90 | 90 | |
| 91 | - /** | |
| 92 | - * @var mixed | |
| 93 | - */ | |
| 94 | - private $json; | |
| 95 | - | |
| 96 | - /** | |
| 97 | - * @var string | |
| 98 | - */ | |
| 99 | - private $session_id; | |
| 100 | - | |
| 101 | 91 | // Information to import from WXR file. |
| 102 | 92 | private $version; |
| 103 | 93 | private $authors = []; |
| 104 | 94 | public $posts = []; |
| @@ -327,10 +317,9 @@ | ||
| 327 | 317 | |
| 328 | 318 | wp_defer_term_counting( true ); |
| 329 | 319 | wp_defer_comment_counting( true ); |
| 330 | 320 | |
| 331 | - do_action( 'import_start' ); | |
| 332 | - do_action( 'templately_import_start', $this ); | |
| 321 | + do_action( 'import_start', $this ); | |
| 333 | 322 | |
| 334 | 323 | return true; |
| 335 | 324 | } |
| 336 | 325 | |
| @@ -395,9 +384,9 @@ | ||
| 395 | 384 | return; |
| 396 | 385 | } |
| 397 | 386 | |
| 398 | 387 | |
| 399 | - $processed_templates = $this->get_loop_result([], $this->import_data_key); | |
| 388 | + $processed_templates = $this->get_progress([], $this->import_data_key); | |
| 400 | 389 | if (!empty($processed_templates)) { |
| 401 | 390 | return; |
| 402 | 391 | } |
| 403 | 392 | |
| @@ -457,9 +446,9 @@ | ||
| 457 | 446 | $this->author_mapping[ $santized_old_login ] = (int) get_current_user_id(); |
| 458 | 447 | } |
| 459 | 448 | } |
| 460 | 449 | |
| 461 | - $this->set_loop_result( true, $this->import_data_key ); | |
| 450 | + $this->update_progress( true, null, $this->import_data_key ); | |
| 462 | 451 | } |
| 463 | 452 | |
| 464 | 453 | /** |
| 465 | 454 | * Create new terms based on import information |
| @@ -473,11 +462,11 @@ | ||
| 473 | 462 | 'succeed' => [], |
| 474 | 463 | 'failed' => [], |
| 475 | 464 | ]; |
| 476 | 465 | |
| 477 | - $processed_templates = $this->get_loop_result([], "wp_import_terms_" . $this->import_data_key); | |
| 466 | + $processed_templates = $this->get_progress([], "wp_import_terms_" . $this->import_data_key); | |
| 478 | 467 | if (!empty($processed_templates)) { |
| 479 | - $result = $this->get_loop_result([], "wp_import_terms_" . $this->import_data_key); | |
| 468 | + $result = $this->get_result([], "wp_import_terms_" . $this->import_data_key); | |
| 480 | 469 | return $result; |
| 481 | 470 | } |
| 482 | 471 | |
| 483 | 472 | $this->terms = apply_filters( 'wp_import_terms', $this->terms ); |
| @@ -561,9 +550,9 @@ | ||
| 561 | 550 | |
| 562 | 551 | unset( $this->terms ); |
| 563 | 552 | |
| 564 | 553 | // Add the template to the processed templates and update the session data |
| 565 | - $this->set_loop_result( $result, "wp_import_terms_" . $this->import_data_key); | |
| 554 | + $this->update_progress( true, $result, "wp_import_terms_" . $this->import_data_key); | |
| 566 | 555 | return $result; |
| 567 | 556 | } |
| 568 | 557 | |
| 569 | 558 | /** |
| @@ -1142,9 +1131,9 @@ | ||
| 1142 | 1131 | |
| 1143 | 1132 | if($saved_image = $this->get_saved_image($url)){ |
| 1144 | 1133 | // $this->url_remap[ $url ] = wp_get_attachment_url( $saved_image ); |
| 1145 | 1134 | // $this->url_remap[ $this->remove_extension($url) ] = $this->remove_extension(wp_get_attachment_url( $saved_image )); |
| 1146 | - $upload_url = set_url_scheme( wp_get_attachment_url( $saved_image ) ); | |
| 1135 | + $upload_url = wp_get_attachment_url( $saved_image ); | |
| 1147 | 1136 | $this->set_url_map($url, $upload_url, true); |
| 1148 | 1137 | |
| 1149 | 1138 | if(!empty($post['original_attachment_url']) && !$this->get_saved_image($post['original_attachment_url'])){ |
| 1150 | 1139 | add_post_meta( $saved_image, '_elementor_source_image_hash', sha1( $post['original_attachment_url'] ) ); |
| @@ -1186,13 +1175,8 @@ | ||
| 1186 | 1175 | if ( null === $upload ) { |
| 1187 | 1176 | $upload = $this->fetch_remote_file( $url, $dest_file, $upload_dir ); |
| 1188 | 1177 | } |
| 1189 | 1178 | |
| 1190 | - // Normalize URL scheme to match the current site scheme (fixes HTTP URLs on HTTPS multisites). | |
| 1191 | - if ( ! is_wp_error( $upload ) && ! empty( $upload['url'] ) ) { | |
| 1192 | - $upload['url'] = set_url_scheme( $upload['url'] ); | |
| 1193 | - } | |
| 1194 | - | |
| 1195 | 1179 | $end = microtime(true); |
| 1196 | 1180 | $duration = $end - $start; |
| 1197 | 1181 | error_log('Duration: ' . $duration); |
| 1198 | 1182 | |
| @@ -1741,23 +1725,8 @@ | ||
| 1741 | 1725 | return $this->output; |
| 1742 | 1726 | } |
| 1743 | 1727 | |
| 1744 | 1728 | /** |
| 1745 | - * Register Templately with Jetpack Sync's known importers. | |
| 1746 | - * | |
| 1747 | - * This filter callback adds Templately to Jetpack's list of known importers, | |
| 1748 | - * ensuring that 'templately' is sent to WordPress.com instead of the full class name. | |
| 1749 | - * This provides cleaner analytics data and better tracking. | |
| 1750 | - * | |
| 1751 | - * @param array $known_importers Array of known importers with class names as keys and friendly names as values. | |
| 1752 | - * @return array Modified array of known importers. | |
| 1753 | - */ | |
| 1754 | - public function register_jetpack_importer( $known_importers ) { | |
| 1755 | - $known_importers[ __CLASS__ ] = 'templately'; | |
| 1756 | - return $known_importers; | |
| 1757 | - } | |
| 1758 | - | |
| 1759 | - /** | |
| 1760 | 1729 | * @param $file |
| 1761 | 1730 | * @param array $args |
| 1762 | 1731 | */ |
| 1763 | 1732 | public function __construct( $file, array $args = [] ) { |
| @@ -1801,9 +1770,6 @@ | ||
| 1801 | 1770 | |
| 1802 | 1771 | if ( ! empty( $this->args['terms_meta'] ) ) { |
| 1803 | 1772 | $this->terms_meta = $this->args['terms_meta']; |
| 1804 | 1773 | } |
| 1805 | - | |
| 1806 | - // Register with Jetpack Sync for better analytics tracking. | |
| 1807 | - add_filter( 'jetpack_sync_known_importers', [ $this, 'register_jetpack_importer' ] ); | |
| 1808 | 1774 | } |
| 1809 | 1775 | } |