Plugin Directory

Changeset 3337614


Ignore:
Timestamp:
08/01/2025 07:08:42 AM (8 months ago)
Author:
ThemeGrill
Message:

Update to version 1.9.14 from GitHub

Location:
themegrill-demo-importer
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • themegrill-demo-importer/tags/1.9.14/includes/class-themegrill-demo-importer.php

    r3319654 r3337614  
    2121     * @var string
    2222     */
    23     public $version = '1.9.13';
     23    public $version = '1.9.14';
    2424
    2525    /**
  • themegrill-demo-importer/tags/1.9.14/includes/importers/wordpress-importer/class-wxr-parser-simplexml.php

    r2345269 r3337614  
    1414        $authors = $posts = $categories = $tags = $terms = array();
    1515
    16         $internal_errors = libxml_use_internal_errors(true);
    17 
    18         $dom = new DOMDocument;
     16        $internal_errors = libxml_use_internal_errors( true );
     17
     18        $dom       = new DOMDocument();
    1919        $old_value = null;
    20         if ( function_exists( 'libxml_disable_entity_loader' ) ) {
     20        if ( PHP_VERSION_ID < 80000 && function_exists( 'libxml_disable_entity_loader' ) ) {
    2121            $old_value = libxml_disable_entity_loader( true );
    2222        }
    2323        $success = $dom->loadXML( file_get_contents( $file ) );
    24         if ( ! is_null( $old_value ) ) {
     24        if ( PHP_VERSION_ID < 80000 && ! is_null( $old_value ) ) {
    2525            libxml_disable_entity_loader( $old_value );
    2626        }
     
    3434
    3535        // halt if loading produces an error
    36         if ( ! $xml )
     36        if ( ! $xml ) {
    3737            return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'themegrill-demo-importer' ), libxml_get_errors() );
    38 
    39         $wxr_version = $xml->xpath('/rss/channel/wp:wxr_version');
    40         if ( ! $wxr_version )
     38        }
     39
     40        $wxr_version = $xml->xpath( '/rss/channel/wp:wxr_version' );
     41        if ( ! $wxr_version ) {
    4142            return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'themegrill-demo-importer' ) );
     43        }
    4244
    4345        $wxr_version = (string) trim( $wxr_version[0] );
    4446        // confirm that we are dealing with the correct file format
    45         if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) )
     47        if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) ) {
    4648            return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'themegrill-demo-importer' ) );
    47 
    48         $base_url = $xml->xpath('/rss/channel/wp:base_site_url');
     49        }
     50
     51        $base_url = $xml->xpath( '/rss/channel/wp:base_site_url' );
    4952        $base_url = (string) trim( isset( $base_url[0] ) ? $base_url[0] : '' );
    5053
    51 
    52         $base_blog_url = $xml->xpath('/rss/channel/wp:base_blog_url');
     54        $base_blog_url = $xml->xpath( '/rss/channel/wp:base_blog_url' );
    5355        if ( $base_blog_url ) {
    5456            $base_blog_url = (string) trim( $base_blog_url[0] );
     
    5860
    5961        $namespaces = $xml->getDocNamespaces();
    60         if ( ! isset( $namespaces['wp'] ) )
     62        if ( ! isset( $namespaces['wp'] ) ) {
    6163            $namespaces['wp'] = 'http://wordpress.org/export/1.1/';
    62         if ( ! isset( $namespaces['excerpt'] ) )
     64        }
     65        if ( ! isset( $namespaces['excerpt'] ) ) {
    6366            $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/';
     67        }
    6468
    6569        // grab authors
    66         foreach ( $xml->xpath('/rss/channel/wp:author') as $author_arr ) {
    67             $a = $author_arr->children( $namespaces['wp'] );
    68             $login = (string) $a->author_login;
    69             $authors[$login] = array(
    70                 'author_id' => (int) $a->author_id,
    71                 'author_login' => $login,
    72                 'author_email' => (string) $a->author_email,
     70        foreach ( $xml->xpath( '/rss/channel/wp:author' ) as $author_arr ) {
     71            $a                 = $author_arr->children( $namespaces['wp'] );
     72            $login             = (string) $a->author_login;
     73            $authors[ $login ] = array(
     74                'author_id'           => (int) $a->author_id,
     75                'author_login'        => $login,
     76                'author_email'        => (string) $a->author_email,
    7377                'author_display_name' => (string) $a->author_display_name,
    74                 'author_first_name' => (string) $a->author_first_name,
    75                 'author_last_name' => (string) $a->author_last_name
     78                'author_first_name'   => (string) $a->author_first_name,
     79                'author_last_name'    => (string) $a->author_last_name,
    7680            );
    7781        }
    7882
    7983        // grab cats, tags and terms
    80         foreach ( $xml->xpath('/rss/channel/wp:category') as $term_arr ) {
    81             $t = $term_arr->children( $namespaces['wp'] );
     84        foreach ( $xml->xpath( '/rss/channel/wp:category' ) as $term_arr ) {
     85            $t        = $term_arr->children( $namespaces['wp'] );
    8286            $category = array(
    83                 'term_id' => (int) $t->term_id,
    84                 'category_nicename' => (string) $t->category_nicename,
    85                 'category_parent' => (string) $t->category_parent,
    86                 'cat_name' => (string) $t->cat_name,
    87                 'category_description' => (string) $t->category_description
     87                'term_id'              => (int) $t->term_id,
     88                'category_nicename'    => (string) $t->category_nicename,
     89                'category_parent'      => (string) $t->category_parent,
     90                'cat_name'             => (string) $t->cat_name,
     91                'category_description' => (string) $t->category_description,
    8892            );
    8993
    9094            foreach ( $t->termmeta as $meta ) {
    9195                $category['termmeta'][] = array(
    92                     'key' => (string) $meta->meta_key,
    93                     'value' => (string) $meta->meta_value
     96                    'key'   => (string) $meta->meta_key,
     97                    'value' => (string) $meta->meta_value,
    9498                );
    9599            }
     
    98102        }
    99103
    100         foreach ( $xml->xpath('/rss/channel/wp:tag') as $term_arr ) {
    101             $t = $term_arr->children( $namespaces['wp'] );
     104        foreach ( $xml->xpath( '/rss/channel/wp:tag' ) as $term_arr ) {
     105            $t   = $term_arr->children( $namespaces['wp'] );
    102106            $tag = array(
    103                 'term_id' => (int) $t->term_id,
    104                 'tag_slug' => (string) $t->tag_slug,
    105                 'tag_name' => (string) $t->tag_name,
    106                 'tag_description' => (string) $t->tag_description
     107                'term_id'         => (int) $t->term_id,
     108                'tag_slug'        => (string) $t->tag_slug,
     109                'tag_name'        => (string) $t->tag_name,
     110                'tag_description' => (string) $t->tag_description,
    107111            );
    108112
    109113            foreach ( $t->termmeta as $meta ) {
    110114                $tag['termmeta'][] = array(
    111                     'key' => (string) $meta->meta_key,
    112                     'value' => (string) $meta->meta_value
     115                    'key'   => (string) $meta->meta_key,
     116                    'value' => (string) $meta->meta_value,
    113117                );
    114118            }
     
    117121        }
    118122
    119         foreach ( $xml->xpath('/rss/channel/wp:term') as $term_arr ) {
    120             $t = $term_arr->children( $namespaces['wp'] );
     123        foreach ( $xml->xpath( '/rss/channel/wp:term' ) as $term_arr ) {
     124            $t    = $term_arr->children( $namespaces['wp'] );
    121125            $term = array(
    122                 'term_id' => (int) $t->term_id,
    123                 'term_taxonomy' => (string) $t->term_taxonomy,
    124                 'slug' => (string) $t->term_slug,
    125                 'term_parent' => (string) $t->term_parent,
    126                 'term_name' => (string) $t->term_name,
    127                 'term_description' => (string) $t->term_description
     126                'term_id'          => (int) $t->term_id,
     127                'term_taxonomy'    => (string) $t->term_taxonomy,
     128                'slug'             => (string) $t->term_slug,
     129                'term_parent'      => (string) $t->term_parent,
     130                'term_name'        => (string) $t->term_name,
     131                'term_description' => (string) $t->term_description,
    128132            );
    129133
    130134            foreach ( $t->termmeta as $meta ) {
    131135                $term['termmeta'][] = array(
    132                     'key' => (string) $meta->meta_key,
    133                     'value' => (string) $meta->meta_value
     136                    'key'   => (string) $meta->meta_key,
     137                    'value' => (string) $meta->meta_value,
    134138                );
    135139            }
     
    142146            $post = array(
    143147                'post_title' => (string) $item->title,
    144                 'guid' => (string) $item->guid,
    145             );
    146 
    147             $dc = $item->children( 'http://purl.org/dc/elements/1.1/' );
     148                'guid'       => (string) $item->guid,
     149            );
     150
     151            $dc                  = $item->children( 'http://purl.org/dc/elements/1.1/' );
    148152            $post['post_author'] = (string) $dc->creator;
    149153
    150             $content = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
    151             $excerpt = $item->children( $namespaces['excerpt'] );
     154            $content              = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
     155            $excerpt              = $item->children( $namespaces['excerpt'] );
    152156            $post['post_content'] = (string) $content->encoded;
    153157            $post['post_excerpt'] = (string) $excerpt->encoded;
    154158
    155             $wp = $item->children( $namespaces['wp'] );
    156             $post['post_id'] = (int) $wp->post_id;
    157             $post['post_date'] = (string) $wp->post_date;
    158             $post['post_date_gmt'] = (string) $wp->post_date_gmt;
     159            $wp                     = $item->children( $namespaces['wp'] );
     160            $post['post_id']        = (int) $wp->post_id;
     161            $post['post_date']      = (string) $wp->post_date;
     162            $post['post_date_gmt']  = (string) $wp->post_date_gmt;
    159163            $post['comment_status'] = (string) $wp->comment_status;
    160             $post['ping_status'] = (string) $wp->ping_status;
    161             $post['post_name'] = (string) $wp->post_name;
    162             $post['status'] = (string) $wp->status;
    163             $post['post_parent'] = (int) $wp->post_parent;
    164             $post['menu_order'] = (int) $wp->menu_order;
    165             $post['post_type'] = (string) $wp->post_type;
    166             $post['post_password'] = (string) $wp->post_password;
    167             $post['is_sticky'] = (int) $wp->is_sticky;
    168 
    169             if ( isset($wp->attachment_url) )
     164            $post['ping_status']    = (string) $wp->ping_status;
     165            $post['post_name']      = (string) $wp->post_name;
     166            $post['status']         = (string) $wp->status;
     167            $post['post_parent']    = (int) $wp->post_parent;
     168            $post['menu_order']     = (int) $wp->menu_order;
     169            $post['post_type']      = (string) $wp->post_type;
     170            $post['post_password']  = (string) $wp->post_password;
     171            $post['is_sticky']      = (int) $wp->is_sticky;
     172
     173            if ( isset( $wp->attachment_url ) ) {
    170174                $post['attachment_url'] = (string) $wp->attachment_url;
     175            }
    171176
    172177            foreach ( $item->category as $c ) {
    173178                $att = $c->attributes();
    174                 if ( isset( $att['nicename'] ) )
     179                if ( isset( $att['nicename'] ) ) {
    175180                    $post['terms'][] = array(
    176                         'name' => (string) $c,
    177                         'slug' => (string) $att['nicename'],
    178                         'domain' => (string) $att['domain']
     181                        'name'   => (string) $c,
     182                        'slug'   => (string) $att['nicename'],
     183                        'domain' => (string) $att['domain'],
    179184                    );
     185                }
    180186            }
    181187
    182188            foreach ( $wp->postmeta as $meta ) {
    183189                $post['postmeta'][] = array(
    184                     'key' => (string) $meta->meta_key,
    185                     'value' => (string) $meta->meta_value
     190                    'key'   => (string) $meta->meta_key,
     191                    'value' => (string) $meta->meta_value,
    186192                );
    187193            }
     
    192198                    foreach ( $comment->commentmeta as $m ) {
    193199                        $meta[] = array(
    194                             'key' => (string) $m->meta_key,
    195                             'value' => (string) $m->meta_value
     200                            'key'   => (string) $m->meta_key,
     201                            'value' => (string) $m->meta_value,
    196202                        );
    197203                    }
     
    199205
    200206                $post['comments'][] = array(
    201                     'comment_id' => (int) $comment->comment_id,
    202                     'comment_author' => (string) $comment->comment_author,
     207                    'comment_id'           => (int) $comment->comment_id,
     208                    'comment_author'       => (string) $comment->comment_author,
    203209                    'comment_author_email' => (string) $comment->comment_author_email,
    204                     'comment_author_IP' => (string) $comment->comment_author_IP,
    205                     'comment_author_url' => (string) $comment->comment_author_url,
    206                     'comment_date' => (string) $comment->comment_date,
    207                     'comment_date_gmt' => (string) $comment->comment_date_gmt,
    208                     'comment_content' => (string) $comment->comment_content,
    209                     'comment_approved' => (string) $comment->comment_approved,
    210                     'comment_type' => (string) $comment->comment_type,
    211                     'comment_parent' => (string) $comment->comment_parent,
    212                     'comment_user_id' => (int) $comment->comment_user_id,
    213                     'commentmeta' => $meta,
     210                    'comment_author_IP'    => (string) $comment->comment_author_IP,
     211                    'comment_author_url'   => (string) $comment->comment_author_url,
     212                    'comment_date'         => (string) $comment->comment_date,
     213                    'comment_date_gmt'     => (string) $comment->comment_date_gmt,
     214                    'comment_content'      => (string) $comment->comment_content,
     215                    'comment_approved'     => (string) $comment->comment_approved,
     216                    'comment_type'         => (string) $comment->comment_type,
     217                    'comment_parent'       => (string) $comment->comment_parent,
     218                    'comment_user_id'      => (int) $comment->comment_user_id,
     219                    'commentmeta'          => $meta,
    214220                );
    215221            }
     
    219225
    220226        return array(
    221             'authors' => $authors,
    222             'posts' => $posts,
    223             'categories' => $categories,
    224             'tags' => $tags,
    225             'terms' => $terms,
    226             'base_url' => $base_url,
     227            'authors'       => $authors,
     228            'posts'         => $posts,
     229            'categories'    => $categories,
     230            'tags'          => $tags,
     231            'terms'         => $terms,
     232            'base_url'      => $base_url,
    227233            'base_blog_url' => $base_blog_url,
    228             'version' => $wxr_version
     234            'version'       => $wxr_version,
    229235        );
    230236    }
  • themegrill-demo-importer/tags/1.9.14/readme.txt

    r3319654 r3337614  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.9.13
     7Stable tag: 1.9.14
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    7878
    7979== Changelog ==
     80= 1.9.14 - 01-08-2025 =
     81* Fix   - PHP 8.0+ compatibility issue with deprecated libxml_disable_entity_loader() function
     82
    8083= 1.9.13 - 30-06-2025 =
    8184* Fix   - Spacious widget import issue
  • themegrill-demo-importer/tags/1.9.14/themegrill-demo-importer.php

    r3319654 r3337614  
    44 * Plugin URI: https://themegrill.com/demo-importer/
    55 * Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click.
    6  * Version: 1.9.13
     6 * Version: 1.9.14
    77 * Author: ThemeGrill
    88 * Author URI: https://themegrill.com
     
    110110        if ( ! empty( $widget_spacious_service_widget ) ) {
    111111            foreach ( $widget_spacious_service_widget as $index => $widget ) {
    112                 if ( ! empty( $widget ) ) {
     112                if ( ! empty( $widget ) && is_array( $widget ) ) {
    113113                    $keys = array( 'page_id0', 'page_id1', 'page_id2', 'page_id3', 'page_id4', 'page_id5' );
    114114                    foreach ( $widget as $key => $value ) {
     
    126126        if ( ! empty( $widget_spacious_recent_work_widget ) ) {
    127127            foreach ( $widget_spacious_recent_work_widget as $index => $widget ) {
    128                 if ( ! empty( $widget ) ) {
     128                if ( ! empty( $widget ) && is_array( $widget ) ) {
    129129                    $keys = array( 'page_id0', 'page_id1', 'page_id2' );
    130130                    foreach ( $widget as $key => $value ) {
     
    142142        if ( ! empty( $widget_spacious_featured_single_page_widget ) ) {
    143143            foreach ( $widget_spacious_featured_single_page_widget as $index => $widget ) {
    144                 if ( ! empty( $widget ) ) {
     144                if ( ! empty( $widget ) && is_array( $widget ) ) {
    145145                    foreach ( $widget as $key => $value ) {
    146146                        if ( 'page_id' === $key && isset( $post_id_map[ $value ] ) ) {
  • themegrill-demo-importer/trunk/includes/class-themegrill-demo-importer.php

    r3319654 r3337614  
    2121     * @var string
    2222     */
    23     public $version = '1.9.13';
     23    public $version = '1.9.14';
    2424
    2525    /**
  • themegrill-demo-importer/trunk/includes/importers/wordpress-importer/class-wxr-parser-simplexml.php

    r2345269 r3337614  
    1414        $authors = $posts = $categories = $tags = $terms = array();
    1515
    16         $internal_errors = libxml_use_internal_errors(true);
    17 
    18         $dom = new DOMDocument;
     16        $internal_errors = libxml_use_internal_errors( true );
     17
     18        $dom       = new DOMDocument();
    1919        $old_value = null;
    20         if ( function_exists( 'libxml_disable_entity_loader' ) ) {
     20        if ( PHP_VERSION_ID < 80000 && function_exists( 'libxml_disable_entity_loader' ) ) {
    2121            $old_value = libxml_disable_entity_loader( true );
    2222        }
    2323        $success = $dom->loadXML( file_get_contents( $file ) );
    24         if ( ! is_null( $old_value ) ) {
     24        if ( PHP_VERSION_ID < 80000 && ! is_null( $old_value ) ) {
    2525            libxml_disable_entity_loader( $old_value );
    2626        }
     
    3434
    3535        // halt if loading produces an error
    36         if ( ! $xml )
     36        if ( ! $xml ) {
    3737            return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'themegrill-demo-importer' ), libxml_get_errors() );
    38 
    39         $wxr_version = $xml->xpath('/rss/channel/wp:wxr_version');
    40         if ( ! $wxr_version )
     38        }
     39
     40        $wxr_version = $xml->xpath( '/rss/channel/wp:wxr_version' );
     41        if ( ! $wxr_version ) {
    4142            return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'themegrill-demo-importer' ) );
     43        }
    4244
    4345        $wxr_version = (string) trim( $wxr_version[0] );
    4446        // confirm that we are dealing with the correct file format
    45         if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) )
     47        if ( ! preg_match( '/^\d+\.\d+$/', $wxr_version ) ) {
    4648            return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'themegrill-demo-importer' ) );
    47 
    48         $base_url = $xml->xpath('/rss/channel/wp:base_site_url');
     49        }
     50
     51        $base_url = $xml->xpath( '/rss/channel/wp:base_site_url' );
    4952        $base_url = (string) trim( isset( $base_url[0] ) ? $base_url[0] : '' );
    5053
    51 
    52         $base_blog_url = $xml->xpath('/rss/channel/wp:base_blog_url');
     54        $base_blog_url = $xml->xpath( '/rss/channel/wp:base_blog_url' );
    5355        if ( $base_blog_url ) {
    5456            $base_blog_url = (string) trim( $base_blog_url[0] );
     
    5860
    5961        $namespaces = $xml->getDocNamespaces();
    60         if ( ! isset( $namespaces['wp'] ) )
     62        if ( ! isset( $namespaces['wp'] ) ) {
    6163            $namespaces['wp'] = 'http://wordpress.org/export/1.1/';
    62         if ( ! isset( $namespaces['excerpt'] ) )
     64        }
     65        if ( ! isset( $namespaces['excerpt'] ) ) {
    6366            $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/';
     67        }
    6468
    6569        // grab authors
    66         foreach ( $xml->xpath('/rss/channel/wp:author') as $author_arr ) {
    67             $a = $author_arr->children( $namespaces['wp'] );
    68             $login = (string) $a->author_login;
    69             $authors[$login] = array(
    70                 'author_id' => (int) $a->author_id,
    71                 'author_login' => $login,
    72                 'author_email' => (string) $a->author_email,
     70        foreach ( $xml->xpath( '/rss/channel/wp:author' ) as $author_arr ) {
     71            $a                 = $author_arr->children( $namespaces['wp'] );
     72            $login             = (string) $a->author_login;
     73            $authors[ $login ] = array(
     74                'author_id'           => (int) $a->author_id,
     75                'author_login'        => $login,
     76                'author_email'        => (string) $a->author_email,
    7377                'author_display_name' => (string) $a->author_display_name,
    74                 'author_first_name' => (string) $a->author_first_name,
    75                 'author_last_name' => (string) $a->author_last_name
     78                'author_first_name'   => (string) $a->author_first_name,
     79                'author_last_name'    => (string) $a->author_last_name,
    7680            );
    7781        }
    7882
    7983        // grab cats, tags and terms
    80         foreach ( $xml->xpath('/rss/channel/wp:category') as $term_arr ) {
    81             $t = $term_arr->children( $namespaces['wp'] );
     84        foreach ( $xml->xpath( '/rss/channel/wp:category' ) as $term_arr ) {
     85            $t        = $term_arr->children( $namespaces['wp'] );
    8286            $category = array(
    83                 'term_id' => (int) $t->term_id,
    84                 'category_nicename' => (string) $t->category_nicename,
    85                 'category_parent' => (string) $t->category_parent,
    86                 'cat_name' => (string) $t->cat_name,
    87                 'category_description' => (string) $t->category_description
     87                'term_id'              => (int) $t->term_id,
     88                'category_nicename'    => (string) $t->category_nicename,
     89                'category_parent'      => (string) $t->category_parent,
     90                'cat_name'             => (string) $t->cat_name,
     91                'category_description' => (string) $t->category_description,
    8892            );
    8993
    9094            foreach ( $t->termmeta as $meta ) {
    9195                $category['termmeta'][] = array(
    92                     'key' => (string) $meta->meta_key,
    93                     'value' => (string) $meta->meta_value
     96                    'key'   => (string) $meta->meta_key,
     97                    'value' => (string) $meta->meta_value,
    9498                );
    9599            }
     
    98102        }
    99103
    100         foreach ( $xml->xpath('/rss/channel/wp:tag') as $term_arr ) {
    101             $t = $term_arr->children( $namespaces['wp'] );
     104        foreach ( $xml->xpath( '/rss/channel/wp:tag' ) as $term_arr ) {
     105            $t   = $term_arr->children( $namespaces['wp'] );
    102106            $tag = array(
    103                 'term_id' => (int) $t->term_id,
    104                 'tag_slug' => (string) $t->tag_slug,
    105                 'tag_name' => (string) $t->tag_name,
    106                 'tag_description' => (string) $t->tag_description
     107                'term_id'         => (int) $t->term_id,
     108                'tag_slug'        => (string) $t->tag_slug,
     109                'tag_name'        => (string) $t->tag_name,
     110                'tag_description' => (string) $t->tag_description,
    107111            );
    108112
    109113            foreach ( $t->termmeta as $meta ) {
    110114                $tag['termmeta'][] = array(
    111                     'key' => (string) $meta->meta_key,
    112                     'value' => (string) $meta->meta_value
     115                    'key'   => (string) $meta->meta_key,
     116                    'value' => (string) $meta->meta_value,
    113117                );
    114118            }
     
    117121        }
    118122
    119         foreach ( $xml->xpath('/rss/channel/wp:term') as $term_arr ) {
    120             $t = $term_arr->children( $namespaces['wp'] );
     123        foreach ( $xml->xpath( '/rss/channel/wp:term' ) as $term_arr ) {
     124            $t    = $term_arr->children( $namespaces['wp'] );
    121125            $term = array(
    122                 'term_id' => (int) $t->term_id,
    123                 'term_taxonomy' => (string) $t->term_taxonomy,
    124                 'slug' => (string) $t->term_slug,
    125                 'term_parent' => (string) $t->term_parent,
    126                 'term_name' => (string) $t->term_name,
    127                 'term_description' => (string) $t->term_description
     126                'term_id'          => (int) $t->term_id,
     127                'term_taxonomy'    => (string) $t->term_taxonomy,
     128                'slug'             => (string) $t->term_slug,
     129                'term_parent'      => (string) $t->term_parent,
     130                'term_name'        => (string) $t->term_name,
     131                'term_description' => (string) $t->term_description,
    128132            );
    129133
    130134            foreach ( $t->termmeta as $meta ) {
    131135                $term['termmeta'][] = array(
    132                     'key' => (string) $meta->meta_key,
    133                     'value' => (string) $meta->meta_value
     136                    'key'   => (string) $meta->meta_key,
     137                    'value' => (string) $meta->meta_value,
    134138                );
    135139            }
     
    142146            $post = array(
    143147                'post_title' => (string) $item->title,
    144                 'guid' => (string) $item->guid,
    145             );
    146 
    147             $dc = $item->children( 'http://purl.org/dc/elements/1.1/' );
     148                'guid'       => (string) $item->guid,
     149            );
     150
     151            $dc                  = $item->children( 'http://purl.org/dc/elements/1.1/' );
    148152            $post['post_author'] = (string) $dc->creator;
    149153
    150             $content = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
    151             $excerpt = $item->children( $namespaces['excerpt'] );
     154            $content              = $item->children( 'http://purl.org/rss/1.0/modules/content/' );
     155            $excerpt              = $item->children( $namespaces['excerpt'] );
    152156            $post['post_content'] = (string) $content->encoded;
    153157            $post['post_excerpt'] = (string) $excerpt->encoded;
    154158
    155             $wp = $item->children( $namespaces['wp'] );
    156             $post['post_id'] = (int) $wp->post_id;
    157             $post['post_date'] = (string) $wp->post_date;
    158             $post['post_date_gmt'] = (string) $wp->post_date_gmt;
     159            $wp                     = $item->children( $namespaces['wp'] );
     160            $post['post_id']        = (int) $wp->post_id;
     161            $post['post_date']      = (string) $wp->post_date;
     162            $post['post_date_gmt']  = (string) $wp->post_date_gmt;
    159163            $post['comment_status'] = (string) $wp->comment_status;
    160             $post['ping_status'] = (string) $wp->ping_status;
    161             $post['post_name'] = (string) $wp->post_name;
    162             $post['status'] = (string) $wp->status;
    163             $post['post_parent'] = (int) $wp->post_parent;
    164             $post['menu_order'] = (int) $wp->menu_order;
    165             $post['post_type'] = (string) $wp->post_type;
    166             $post['post_password'] = (string) $wp->post_password;
    167             $post['is_sticky'] = (int) $wp->is_sticky;
    168 
    169             if ( isset($wp->attachment_url) )
     164            $post['ping_status']    = (string) $wp->ping_status;
     165            $post['post_name']      = (string) $wp->post_name;
     166            $post['status']         = (string) $wp->status;
     167            $post['post_parent']    = (int) $wp->post_parent;
     168            $post['menu_order']     = (int) $wp->menu_order;
     169            $post['post_type']      = (string) $wp->post_type;
     170            $post['post_password']  = (string) $wp->post_password;
     171            $post['is_sticky']      = (int) $wp->is_sticky;
     172
     173            if ( isset( $wp->attachment_url ) ) {
    170174                $post['attachment_url'] = (string) $wp->attachment_url;
     175            }
    171176
    172177            foreach ( $item->category as $c ) {
    173178                $att = $c->attributes();
    174                 if ( isset( $att['nicename'] ) )
     179                if ( isset( $att['nicename'] ) ) {
    175180                    $post['terms'][] = array(
    176                         'name' => (string) $c,
    177                         'slug' => (string) $att['nicename'],
    178                         'domain' => (string) $att['domain']
     181                        'name'   => (string) $c,
     182                        'slug'   => (string) $att['nicename'],
     183                        'domain' => (string) $att['domain'],
    179184                    );
     185                }
    180186            }
    181187
    182188            foreach ( $wp->postmeta as $meta ) {
    183189                $post['postmeta'][] = array(
    184                     'key' => (string) $meta->meta_key,
    185                     'value' => (string) $meta->meta_value
     190                    'key'   => (string) $meta->meta_key,
     191                    'value' => (string) $meta->meta_value,
    186192                );
    187193            }
     
    192198                    foreach ( $comment->commentmeta as $m ) {
    193199                        $meta[] = array(
    194                             'key' => (string) $m->meta_key,
    195                             'value' => (string) $m->meta_value
     200                            'key'   => (string) $m->meta_key,
     201                            'value' => (string) $m->meta_value,
    196202                        );
    197203                    }
     
    199205
    200206                $post['comments'][] = array(
    201                     'comment_id' => (int) $comment->comment_id,
    202                     'comment_author' => (string) $comment->comment_author,
     207                    'comment_id'           => (int) $comment->comment_id,
     208                    'comment_author'       => (string) $comment->comment_author,
    203209                    'comment_author_email' => (string) $comment->comment_author_email,
    204                     'comment_author_IP' => (string) $comment->comment_author_IP,
    205                     'comment_author_url' => (string) $comment->comment_author_url,
    206                     'comment_date' => (string) $comment->comment_date,
    207                     'comment_date_gmt' => (string) $comment->comment_date_gmt,
    208                     'comment_content' => (string) $comment->comment_content,
    209                     'comment_approved' => (string) $comment->comment_approved,
    210                     'comment_type' => (string) $comment->comment_type,
    211                     'comment_parent' => (string) $comment->comment_parent,
    212                     'comment_user_id' => (int) $comment->comment_user_id,
    213                     'commentmeta' => $meta,
     210                    'comment_author_IP'    => (string) $comment->comment_author_IP,
     211                    'comment_author_url'   => (string) $comment->comment_author_url,
     212                    'comment_date'         => (string) $comment->comment_date,
     213                    'comment_date_gmt'     => (string) $comment->comment_date_gmt,
     214                    'comment_content'      => (string) $comment->comment_content,
     215                    'comment_approved'     => (string) $comment->comment_approved,
     216                    'comment_type'         => (string) $comment->comment_type,
     217                    'comment_parent'       => (string) $comment->comment_parent,
     218                    'comment_user_id'      => (int) $comment->comment_user_id,
     219                    'commentmeta'          => $meta,
    214220                );
    215221            }
     
    219225
    220226        return array(
    221             'authors' => $authors,
    222             'posts' => $posts,
    223             'categories' => $categories,
    224             'tags' => $tags,
    225             'terms' => $terms,
    226             'base_url' => $base_url,
     227            'authors'       => $authors,
     228            'posts'         => $posts,
     229            'categories'    => $categories,
     230            'tags'          => $tags,
     231            'terms'         => $terms,
     232            'base_url'      => $base_url,
    227233            'base_blog_url' => $base_blog_url,
    228             'version' => $wxr_version
     234            'version'       => $wxr_version,
    229235        );
    230236    }
  • themegrill-demo-importer/trunk/readme.txt

    r3319654 r3337614  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.9.13
     7Stable tag: 1.9.14
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    7878
    7979== Changelog ==
     80= 1.9.14 - 01-08-2025 =
     81* Fix   - PHP 8.0+ compatibility issue with deprecated libxml_disable_entity_loader() function
     82
    8083= 1.9.13 - 30-06-2025 =
    8184* Fix   - Spacious widget import issue
  • themegrill-demo-importer/trunk/themegrill-demo-importer.php

    r3319654 r3337614  
    44 * Plugin URI: https://themegrill.com/demo-importer/
    55 * Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click.
    6  * Version: 1.9.13
     6 * Version: 1.9.14
    77 * Author: ThemeGrill
    88 * Author URI: https://themegrill.com
     
    110110        if ( ! empty( $widget_spacious_service_widget ) ) {
    111111            foreach ( $widget_spacious_service_widget as $index => $widget ) {
    112                 if ( ! empty( $widget ) ) {
     112                if ( ! empty( $widget ) && is_array( $widget ) ) {
    113113                    $keys = array( 'page_id0', 'page_id1', 'page_id2', 'page_id3', 'page_id4', 'page_id5' );
    114114                    foreach ( $widget as $key => $value ) {
     
    126126        if ( ! empty( $widget_spacious_recent_work_widget ) ) {
    127127            foreach ( $widget_spacious_recent_work_widget as $index => $widget ) {
    128                 if ( ! empty( $widget ) ) {
     128                if ( ! empty( $widget ) && is_array( $widget ) ) {
    129129                    $keys = array( 'page_id0', 'page_id1', 'page_id2' );
    130130                    foreach ( $widget as $key => $value ) {
     
    142142        if ( ! empty( $widget_spacious_featured_single_page_widget ) ) {
    143143            foreach ( $widget_spacious_featured_single_page_widget as $index => $widget ) {
    144                 if ( ! empty( $widget ) ) {
     144                if ( ! empty( $widget ) && is_array( $widget ) ) {
    145145                    foreach ( $widget as $key => $value ) {
    146146                        if ( 'page_id' === $key && isset( $post_id_map[ $value ] ) ) {
Note: See TracChangeset for help on using the changeset viewer.