PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / trunk
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! vtrunk
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
templately / modules / full-site-import / Concerns / TracksRevert.php

TracksRevert.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! trunk, at modules/full-site-import/Concerns/TracksRevert.php

66 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Templately\Modules\FullSiteImport\Concerns;
4
5 use Elementor\Plugin;
6 use Error;
7 use Exception;
8 use Templately\Modules\FullSiteImport\Exception\FatalErrorException;
9 use Templately\Modules\FullSiteImport\Exception\RetryableErrorException;
10 use Templately\Modules\FullSiteImport\Exception\UnknownErrorException;
11 use Templately\Modules\FullSiteImport\Runners\Finalizer;
12 use Templately\Modules\FullSiteImport\Utils\LogHandler;
13 use Templately\Modules\FullSiteImport\Utils\Utils;
14 use Templately\Modules\FullSiteImport\Utils\SessionData;
15 use Templately\Modules\FullSiteImport\Utils\AIUtils;
16 use Templately\Utils\Helper;
17 use Templately\Utils\Options;
18
19 /**
20 * TracksRevert — extracted verbatim from FullSiteImport (behavior-preserving).
21 * Composed back into FullSiteImport via `use`; $this and method resolution unchanged.
22 */
23 trait TracksRevert {
24 // === DEPRECATED / UNUSED (kept intentionally) ===
25 public function redirect_for_archives($link, $post_id) {
26 $archive_settings = get_option('templately_post_archive');
27 if (!empty($archive_settings) && intval($archive_settings['post_id']) === intval($post_id)) {
28 $link = str_replace($post_id, $archive_settings['archive_id'], $link);
29 }
30
31 return $link;
32 }
33
34 public function update_imported_list($type, $id) {
35 $imported_list = get_option('templately_fsi_imported_list', []);
36 if(!in_array($id, $imported_list[$type] ?? [])){
37 $imported_list[$type][] = $id;
38 update_option('templately_fsi_imported_list', $imported_list, false);
39 }
40 }
41
42 /**
43 *
44 *
45 * @return void
46 */
47 protected function add_revert_hooks() {
48 add_action('wp_insert_post', function ($post_id) {
49 $this->update_imported_list('posts', $post_id);
50 });
51 add_action('add_attachment', function ($post_id) {
52 $this->update_imported_list('attachment', $post_id);
53 });
54 add_action('created_term', function ($term_id, $tt_id, $taxonomy, $args) {
55 $this->update_imported_list('term', [$term_id, $taxonomy]);
56 }, 10, 4);
57 add_action('registered_taxonomy', function ($taxonomy, $object_type, $taxonomy_object) {
58 $this->update_imported_list('taxonomy', $taxonomy);
59 }, 10, 3);
60 add_action('fluentform/form_imported', function ($formId){
61 $this->update_imported_list('fluentform', $formId);
62 }, 10, 1);
63 }
64
65 }
66