PluginProbe ʕ •ᴥ•ʔ
Post Grid, Slider & Carousel Ultimate – with Shortcode, Gutenberg Block & Elementor Widget / 1.8.1
Post Grid, Slider & Carousel Ultimate – with Shortcode, Gutenberg Block & Elementor Widget v1.8.1
1.8.1 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.7 1.3.8 1.4.0 1.4.1 1.4.2 1.4.3 1.6.0 1.6.1 1.6.10 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7 1.8
post-grid-carousel-ultimate / includes / classes / migration.php
post-grid-carousel-ultimate / includes / classes Last commit date
ajax.php 2 months ago custom-post.php 3 years ago metabox.php 2 years ago migration.php 2 years ago resize.php 3 years ago settings.php 4 years ago shortcode.php 1 year ago widget.php 4 years ago
migration.php
63 lines
1 <?php
2 defined('ABSPATH') || die('Direct access is not allow');
3
4 class PGCU_Migration
5 {
6 public function __construct ()
7 {
8 // add_action( 'admin_init', array( $this, 'migrate_custom_post' ) );
9 }
10
11 public function migrate_custom_post() {
12
13 $old_posts = get_posts( array( 'post_type' => 'adl-shortcode' ) );
14 $migration = get_option( 'pgcu_migration' );
15
16 if( empty( $migration ) && ! empty( $old_posts ) ) {
17
18 foreach( $old_posts as $old_post ) {
19
20 $get_meta = get_post_meta( $old_post->ID, 'gc', true );
21 $new_meta = $get_meta;
22 if( ! empty( $get_meta['g_theme'] ) ) {
23
24 $grid_theme_number = trim( $get_meta['g_theme'], 'theme_' );
25 $carousel_theme_number = trim( $get_meta['c_theme'], 'theme_' );
26
27 if( 'grid' == $get_meta['layout'] ) {
28 $new_meta['theme'] = 'theme-' . $grid_theme_number;
29 }elseif( 'carousel' == $get_meta['layout'] ) {
30 $new_meta['theme'] = 'theme-' . $carousel_theme_number;
31 }
32
33 }
34
35 $new_meta['display_title'] = empty( $get_meta['post_title'] ) ? 'yes' : 'no';
36 $new_meta['display_content'] = empty( $get_meta['post_content'] ) ? 'yes' : 'no';
37 $new_meta['display_author'] = empty( $get_meta['post_author_name'] ) ? 'yes' : 'no';
38 $new_meta['display_date'] = empty( $get_meta['post_date'] ) ? 'yes' : 'no';
39 $new_meta['display_term'] = empty( $get_meta['post_category'] ) ? 'yes' : 'no';
40 $new_meta['display_read_more'] = empty( $get_meta['read_more'] ) ? 'yes' : 'no';
41 $new_meta['sortable_menu_text_color'] = ! empty( $get_meta['grid_menu_text'] ) ? $get_meta['grid_menu_text'] : '';
42 $new_meta['sortable_menu_active_back_color'] = ! empty( $get_meta['grid_active_back'] ) ? $get_meta['grid_active_back'] : '';
43 $new_meta['sortable_menu_active__text_color'] = ! empty( $get_meta['grid_active_text'] ) ? $get_meta['grid_active_text'] : '';
44 $new_meta['display_pagination'] = empty( $get_meta['pagi_hide'] ) ? 'yes' : 'no';
45 $new_meta['pagi_color'] = ! empty( $get_meta['pagi_text_color'] ) ? $get_meta['pagi_text_color'] : '';
46 $new_meta['pagi_hover_color'] = ! empty( $get_meta['pagi_text_hover_color'] ) ? $get_meta['pagi_text_hover_color'] : '';
47 $new_meta['pagi_active_color'] = ! empty( $get_meta['pagi_text_active_color'] ) ? $get_meta['pagi_text_active_color'] : '';
48 $new_meta['pagi_active_back_color'] = ! empty( $get_meta['pagi_active_back_color'] ) ? $get_meta['pagi_active_back_color'] : '';
49
50 update_post_meta( $old_post->ID, 'gc', post_grid_and_carousel_ultimate::json_encoded( $new_meta ) );
51
52
53 }
54
55
56 }
57
58 update_option( 'pgcu_migration', true );
59
60 }
61
62
63 }