Changeset 3337614
- Timestamp:
- 08/01/2025 07:08:42 AM (8 months ago)
- Location:
- themegrill-demo-importer
- Files:
-
- 8 edited
- 1 copied
-
tags/1.9.14 (copied) (copied from themegrill-demo-importer/trunk)
-
tags/1.9.14/includes/class-themegrill-demo-importer.php (modified) (1 diff)
-
tags/1.9.14/includes/importers/wordpress-importer/class-wxr-parser-simplexml.php (modified) (9 diffs)
-
tags/1.9.14/readme.txt (modified) (2 diffs)
-
tags/1.9.14/themegrill-demo-importer.php (modified) (4 diffs)
-
trunk/includes/class-themegrill-demo-importer.php (modified) (1 diff)
-
trunk/includes/importers/wordpress-importer/class-wxr-parser-simplexml.php (modified) (9 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/themegrill-demo-importer.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
themegrill-demo-importer/tags/1.9.14/includes/class-themegrill-demo-importer.php
r3319654 r3337614 21 21 * @var string 22 22 */ 23 public $version = '1.9.1 3';23 public $version = '1.9.14'; 24 24 25 25 /** -
themegrill-demo-importer/tags/1.9.14/includes/importers/wordpress-importer/class-wxr-parser-simplexml.php
r2345269 r3337614 14 14 $authors = $posts = $categories = $tags = $terms = array(); 15 15 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(); 19 19 $old_value = null; 20 if ( function_exists( 'libxml_disable_entity_loader' ) ) {20 if ( PHP_VERSION_ID < 80000 && function_exists( 'libxml_disable_entity_loader' ) ) { 21 21 $old_value = libxml_disable_entity_loader( true ); 22 22 } 23 23 $success = $dom->loadXML( file_get_contents( $file ) ); 24 if ( ! is_null( $old_value ) ) {24 if ( PHP_VERSION_ID < 80000 && ! is_null( $old_value ) ) { 25 25 libxml_disable_entity_loader( $old_value ); 26 26 } … … 34 34 35 35 // halt if loading produces an error 36 if ( ! $xml ) 36 if ( ! $xml ) { 37 37 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 ) { 41 42 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 } 42 44 43 45 $wxr_version = (string) trim( $wxr_version[0] ); 44 46 // 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 ) ) { 46 48 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' ); 49 52 $base_url = (string) trim( isset( $base_url[0] ) ? $base_url[0] : '' ); 50 53 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' ); 53 55 if ( $base_blog_url ) { 54 56 $base_blog_url = (string) trim( $base_blog_url[0] ); … … 58 60 59 61 $namespaces = $xml->getDocNamespaces(); 60 if ( ! isset( $namespaces['wp'] ) ) 62 if ( ! isset( $namespaces['wp'] ) ) { 61 63 $namespaces['wp'] = 'http://wordpress.org/export/1.1/'; 62 if ( ! isset( $namespaces['excerpt'] ) ) 64 } 65 if ( ! isset( $namespaces['excerpt'] ) ) { 63 66 $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/'; 67 } 64 68 65 69 // 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, 73 77 '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_name78 'author_first_name' => (string) $a->author_first_name, 79 'author_last_name' => (string) $a->author_last_name, 76 80 ); 77 81 } 78 82 79 83 // 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'] ); 82 86 $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, 88 92 ); 89 93 90 94 foreach ( $t->termmeta as $meta ) { 91 95 $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, 94 98 ); 95 99 } … … 98 102 } 99 103 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'] ); 102 106 $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, 107 111 ); 108 112 109 113 foreach ( $t->termmeta as $meta ) { 110 114 $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, 113 117 ); 114 118 } … … 117 121 } 118 122 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'] ); 121 125 $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, 128 132 ); 129 133 130 134 foreach ( $t->termmeta as $meta ) { 131 135 $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, 134 138 ); 135 139 } … … 142 146 $post = array( 143 147 '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/' ); 148 152 $post['post_author'] = (string) $dc->creator; 149 153 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'] ); 152 156 $post['post_content'] = (string) $content->encoded; 153 157 $post['post_excerpt'] = (string) $excerpt->encoded; 154 158 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; 159 163 $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 ) ) { 170 174 $post['attachment_url'] = (string) $wp->attachment_url; 175 } 171 176 172 177 foreach ( $item->category as $c ) { 173 178 $att = $c->attributes(); 174 if ( isset( $att['nicename'] ) ) 179 if ( isset( $att['nicename'] ) ) { 175 180 $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'], 179 184 ); 185 } 180 186 } 181 187 182 188 foreach ( $wp->postmeta as $meta ) { 183 189 $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, 186 192 ); 187 193 } … … 192 198 foreach ( $comment->commentmeta as $m ) { 193 199 $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, 196 202 ); 197 203 } … … 199 205 200 206 $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, 203 209 '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, 214 220 ); 215 221 } … … 219 225 220 226 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, 227 233 'base_blog_url' => $base_blog_url, 228 'version' => $wxr_version234 'version' => $wxr_version, 229 235 ); 230 236 } -
themegrill-demo-importer/tags/1.9.14/readme.txt
r3319654 r3337614 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.9.1 37 Stable tag: 1.9.14 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 78 78 79 79 == Changelog == 80 = 1.9.14 - 01-08-2025 = 81 * Fix - PHP 8.0+ compatibility issue with deprecated libxml_disable_entity_loader() function 82 80 83 = 1.9.13 - 30-06-2025 = 81 84 * Fix - Spacious widget import issue -
themegrill-demo-importer/tags/1.9.14/themegrill-demo-importer.php
r3319654 r3337614 4 4 * Plugin URI: https://themegrill.com/demo-importer/ 5 5 * Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click. 6 * Version: 1.9.1 36 * Version: 1.9.14 7 7 * Author: ThemeGrill 8 8 * Author URI: https://themegrill.com … … 110 110 if ( ! empty( $widget_spacious_service_widget ) ) { 111 111 foreach ( $widget_spacious_service_widget as $index => $widget ) { 112 if ( ! empty( $widget ) ) {112 if ( ! empty( $widget ) && is_array( $widget ) ) { 113 113 $keys = array( 'page_id0', 'page_id1', 'page_id2', 'page_id3', 'page_id4', 'page_id5' ); 114 114 foreach ( $widget as $key => $value ) { … … 126 126 if ( ! empty( $widget_spacious_recent_work_widget ) ) { 127 127 foreach ( $widget_spacious_recent_work_widget as $index => $widget ) { 128 if ( ! empty( $widget ) ) {128 if ( ! empty( $widget ) && is_array( $widget ) ) { 129 129 $keys = array( 'page_id0', 'page_id1', 'page_id2' ); 130 130 foreach ( $widget as $key => $value ) { … … 142 142 if ( ! empty( $widget_spacious_featured_single_page_widget ) ) { 143 143 foreach ( $widget_spacious_featured_single_page_widget as $index => $widget ) { 144 if ( ! empty( $widget ) ) {144 if ( ! empty( $widget ) && is_array( $widget ) ) { 145 145 foreach ( $widget as $key => $value ) { 146 146 if ( 'page_id' === $key && isset( $post_id_map[ $value ] ) ) { -
themegrill-demo-importer/trunk/includes/class-themegrill-demo-importer.php
r3319654 r3337614 21 21 * @var string 22 22 */ 23 public $version = '1.9.1 3';23 public $version = '1.9.14'; 24 24 25 25 /** -
themegrill-demo-importer/trunk/includes/importers/wordpress-importer/class-wxr-parser-simplexml.php
r2345269 r3337614 14 14 $authors = $posts = $categories = $tags = $terms = array(); 15 15 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(); 19 19 $old_value = null; 20 if ( function_exists( 'libxml_disable_entity_loader' ) ) {20 if ( PHP_VERSION_ID < 80000 && function_exists( 'libxml_disable_entity_loader' ) ) { 21 21 $old_value = libxml_disable_entity_loader( true ); 22 22 } 23 23 $success = $dom->loadXML( file_get_contents( $file ) ); 24 if ( ! is_null( $old_value ) ) {24 if ( PHP_VERSION_ID < 80000 && ! is_null( $old_value ) ) { 25 25 libxml_disable_entity_loader( $old_value ); 26 26 } … … 34 34 35 35 // halt if loading produces an error 36 if ( ! $xml ) 36 if ( ! $xml ) { 37 37 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 ) { 41 42 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 } 42 44 43 45 $wxr_version = (string) trim( $wxr_version[0] ); 44 46 // 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 ) ) { 46 48 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' ); 49 52 $base_url = (string) trim( isset( $base_url[0] ) ? $base_url[0] : '' ); 50 53 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' ); 53 55 if ( $base_blog_url ) { 54 56 $base_blog_url = (string) trim( $base_blog_url[0] ); … … 58 60 59 61 $namespaces = $xml->getDocNamespaces(); 60 if ( ! isset( $namespaces['wp'] ) ) 62 if ( ! isset( $namespaces['wp'] ) ) { 61 63 $namespaces['wp'] = 'http://wordpress.org/export/1.1/'; 62 if ( ! isset( $namespaces['excerpt'] ) ) 64 } 65 if ( ! isset( $namespaces['excerpt'] ) ) { 63 66 $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/'; 67 } 64 68 65 69 // 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, 73 77 '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_name78 'author_first_name' => (string) $a->author_first_name, 79 'author_last_name' => (string) $a->author_last_name, 76 80 ); 77 81 } 78 82 79 83 // 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'] ); 82 86 $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, 88 92 ); 89 93 90 94 foreach ( $t->termmeta as $meta ) { 91 95 $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, 94 98 ); 95 99 } … … 98 102 } 99 103 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'] ); 102 106 $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, 107 111 ); 108 112 109 113 foreach ( $t->termmeta as $meta ) { 110 114 $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, 113 117 ); 114 118 } … … 117 121 } 118 122 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'] ); 121 125 $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, 128 132 ); 129 133 130 134 foreach ( $t->termmeta as $meta ) { 131 135 $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, 134 138 ); 135 139 } … … 142 146 $post = array( 143 147 '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/' ); 148 152 $post['post_author'] = (string) $dc->creator; 149 153 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'] ); 152 156 $post['post_content'] = (string) $content->encoded; 153 157 $post['post_excerpt'] = (string) $excerpt->encoded; 154 158 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; 159 163 $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 ) ) { 170 174 $post['attachment_url'] = (string) $wp->attachment_url; 175 } 171 176 172 177 foreach ( $item->category as $c ) { 173 178 $att = $c->attributes(); 174 if ( isset( $att['nicename'] ) ) 179 if ( isset( $att['nicename'] ) ) { 175 180 $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'], 179 184 ); 185 } 180 186 } 181 187 182 188 foreach ( $wp->postmeta as $meta ) { 183 189 $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, 186 192 ); 187 193 } … … 192 198 foreach ( $comment->commentmeta as $m ) { 193 199 $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, 196 202 ); 197 203 } … … 199 205 200 206 $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, 203 209 '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, 214 220 ); 215 221 } … … 219 225 220 226 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, 227 233 'base_blog_url' => $base_blog_url, 228 'version' => $wxr_version234 'version' => $wxr_version, 229 235 ); 230 236 } -
themegrill-demo-importer/trunk/readme.txt
r3319654 r3337614 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.9.1 37 Stable tag: 1.9.14 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 78 78 79 79 == Changelog == 80 = 1.9.14 - 01-08-2025 = 81 * Fix - PHP 8.0+ compatibility issue with deprecated libxml_disable_entity_loader() function 82 80 83 = 1.9.13 - 30-06-2025 = 81 84 * Fix - Spacious widget import issue -
themegrill-demo-importer/trunk/themegrill-demo-importer.php
r3319654 r3337614 4 4 * Plugin URI: https://themegrill.com/demo-importer/ 5 5 * Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click. 6 * Version: 1.9.1 36 * Version: 1.9.14 7 7 * Author: ThemeGrill 8 8 * Author URI: https://themegrill.com … … 110 110 if ( ! empty( $widget_spacious_service_widget ) ) { 111 111 foreach ( $widget_spacious_service_widget as $index => $widget ) { 112 if ( ! empty( $widget ) ) {112 if ( ! empty( $widget ) && is_array( $widget ) ) { 113 113 $keys = array( 'page_id0', 'page_id1', 'page_id2', 'page_id3', 'page_id4', 'page_id5' ); 114 114 foreach ( $widget as $key => $value ) { … … 126 126 if ( ! empty( $widget_spacious_recent_work_widget ) ) { 127 127 foreach ( $widget_spacious_recent_work_widget as $index => $widget ) { 128 if ( ! empty( $widget ) ) {128 if ( ! empty( $widget ) && is_array( $widget ) ) { 129 129 $keys = array( 'page_id0', 'page_id1', 'page_id2' ); 130 130 foreach ( $widget as $key => $value ) { … … 142 142 if ( ! empty( $widget_spacious_featured_single_page_widget ) ) { 143 143 foreach ( $widget_spacious_featured_single_page_widget as $index => $widget ) { 144 if ( ! empty( $widget ) ) {144 if ( ! empty( $widget ) && is_array( $widget ) ) { 145 145 foreach ( $widget as $key => $value ) { 146 146 if ( 'page_id' === $key && isset( $post_id_map[ $value ] ) ) {
Note: See TracChangeset
for help on using the changeset viewer.