Version Description
Release Date - 12 June 2016
- An 'import notice' field has been added to the predefined demo import settings. This notice is displayed above the import button (it also accepts HTML),
- Now displays proper error message, if the file-system method is not set to "direct",
- This plugin is now compatible with the new Humanmade content importer plugin,
- Added a filter to the plugin page creation, so that theme authors can now change the location of the plugin page (Demo data import) and some other parameters as well,
Download this release
Release Info
Developer | capuderg |
Plugin | One Click Demo Import |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- assets/js/main.js +5 -0
- inc/class-ocdi-helpers.php +24 -34
- inc/class-ocdi-logger.php +7 -3
- inc/class-ocdi-wxr-importer.php +4 -236
- languages/pt-ocdi.pot +55 -78
- one-click-demo-import.php +23 -6
- readme.txt +40 -1
- vendor/humanmade/WordPress-Importer/class-wxr-importer.php +7 -7
assets/js/main.js
CHANGED
@@ -58,6 +58,7 @@ jQuery( function ( $ ) {
|
|
58 |
}
|
59 |
|
60 |
// Switch preview images on select change event, but only if the img element .js-ocdi-preview-image exists.
|
|
|
61 |
$( '#ocdi__demo-import-files' ).on( 'change', function(){
|
62 |
if ( $( '.js-ocdi-preview-image' ).length ) {
|
63 |
|
@@ -70,6 +71,10 @@ jQuery( function ( $ ) {
|
|
70 |
$( '.js-ocdi-preview-image-message' ).html( ocdi.texts.missing_preview_image );
|
71 |
}
|
72 |
}
|
|
|
|
|
|
|
|
|
73 |
});
|
74 |
|
75 |
});
|
58 |
}
|
59 |
|
60 |
// Switch preview images on select change event, but only if the img element .js-ocdi-preview-image exists.
|
61 |
+
// Also switch the import notice (if it exists).
|
62 |
$( '#ocdi__demo-import-files' ).on( 'change', function(){
|
63 |
if ( $( '.js-ocdi-preview-image' ).length ) {
|
64 |
|
71 |
$( '.js-ocdi-preview-image-message' ).html( ocdi.texts.missing_preview_image );
|
72 |
}
|
73 |
}
|
74 |
+
|
75 |
+
// Update import notice.
|
76 |
+
var currentImportNotice = ocdi.import_files[ this.value ]['import_notice'] || '';
|
77 |
+
$( '.js-ocdi-demo-import-notice' ).html( currentImportNotice );
|
78 |
});
|
79 |
|
80 |
});
|
inc/class-ocdi-helpers.php
CHANGED
@@ -188,11 +188,6 @@ class OCDI_Helpers {
|
|
188 |
*/
|
189 |
public static function write_to_file( $content, $file_path ) {
|
190 |
|
191 |
-
// Check if the file-system method is 'direct', if not display an error.
|
192 |
-
if ( ! 'direct' === get_filesystem_method() ) {
|
193 |
-
return self::return_direct_filesystem_error();
|
194 |
-
}
|
195 |
-
|
196 |
// Verify WP file-system credentials.
|
197 |
$verified_credentials = self::check_wp_filesystem_credentials();
|
198 |
|
@@ -229,11 +224,6 @@ class OCDI_Helpers {
|
|
229 |
*/
|
230 |
public static function append_to_file( $content, $file_path, $separator_text = '' ) {
|
231 |
|
232 |
-
// Check if the file-system method is 'direct', if not display an error.
|
233 |
-
if ( ! 'direct' === get_filesystem_method() ) {
|
234 |
-
return self::return_direct_filesystem_error();
|
235 |
-
}
|
236 |
-
|
237 |
// Verify WP file-system credentials.
|
238 |
$verified_credentials = self::check_wp_filesystem_credentials();
|
239 |
|
@@ -275,11 +265,6 @@ class OCDI_Helpers {
|
|
275 |
*/
|
276 |
public static function data_from_file( $file_path ) {
|
277 |
|
278 |
-
// Check if the file-system method is 'direct', if not display an error.
|
279 |
-
if ( ! 'direct' === get_filesystem_method() ) {
|
280 |
-
return self::return_direct_filesystem_error();
|
281 |
-
}
|
282 |
-
|
283 |
// Verify WP file-system credentials.
|
284 |
$verified_credentials = self::check_wp_filesystem_credentials();
|
285 |
|
@@ -315,8 +300,31 @@ class OCDI_Helpers {
|
|
315 |
*/
|
316 |
private static function check_wp_filesystem_credentials() {
|
317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
// Get user credentials for WP file-system API.
|
319 |
-
$demo_import_page_url = wp_nonce_url( '
|
320 |
|
321 |
if ( false === ( $creds = request_filesystem_credentials( $demo_import_page_url, '', false, false, null ) ) ) {
|
322 |
return new WP_error(
|
@@ -337,24 +345,6 @@ class OCDI_Helpers {
|
|
337 |
}
|
338 |
|
339 |
|
340 |
-
/**
|
341 |
-
* Helper function: return the "no direct access file-system" error.
|
342 |
-
*
|
343 |
-
* @return WP_Error
|
344 |
-
*/
|
345 |
-
private static function return_direct_filesystem_error() {
|
346 |
-
return new WP_Error(
|
347 |
-
'no_direct_file_access',
|
348 |
-
sprintf(
|
349 |
-
__( 'This WordPress page does not have %sdirect%s write file access. This plugin needs it in order to save the demo import xml file to the upload directory of your site. You can change this setting with these instructions: %s.', 'pt-ocdi' ),
|
350 |
-
'<strong>',
|
351 |
-
'</strong>',
|
352 |
-
'<a href="http://gregorcapuder.com/wordpress-how-to-set-direct-filesystem-method/" target="_blank">How to set <strong>direct</strong> filesystem method</a>'
|
353 |
-
)
|
354 |
-
);
|
355 |
-
}
|
356 |
-
|
357 |
-
|
358 |
/**
|
359 |
* Helper function: get the right format of response errors
|
360 |
*
|
188 |
*/
|
189 |
public static function write_to_file( $content, $file_path ) {
|
190 |
|
|
|
|
|
|
|
|
|
|
|
191 |
// Verify WP file-system credentials.
|
192 |
$verified_credentials = self::check_wp_filesystem_credentials();
|
193 |
|
224 |
*/
|
225 |
public static function append_to_file( $content, $file_path, $separator_text = '' ) {
|
226 |
|
|
|
|
|
|
|
|
|
|
|
227 |
// Verify WP file-system credentials.
|
228 |
$verified_credentials = self::check_wp_filesystem_credentials();
|
229 |
|
265 |
*/
|
266 |
public static function data_from_file( $file_path ) {
|
267 |
|
|
|
|
|
|
|
|
|
|
|
268 |
// Verify WP file-system credentials.
|
269 |
$verified_credentials = self::check_wp_filesystem_credentials();
|
270 |
|
300 |
*/
|
301 |
private static function check_wp_filesystem_credentials() {
|
302 |
|
303 |
+
// Check if the file-system method is 'direct', if not display an error.
|
304 |
+
if ( ! ( 'direct' === get_filesystem_method() ) ) {
|
305 |
+
return new WP_Error(
|
306 |
+
'no_direct_file_access',
|
307 |
+
sprintf(
|
308 |
+
__( 'This WordPress page does not have %sdirect%s write file access. This plugin needs it in order to save the demo import xml file to the upload directory of your site. You can change this setting with these instructions: %s.', 'pt-ocdi' ),
|
309 |
+
'<strong>',
|
310 |
+
'</strong>',
|
311 |
+
'<a href="http://gregorcapuder.com/wordpress-how-to-set-direct-filesystem-method/" target="_blank">How to set <strong>direct</strong> filesystem method</a>'
|
312 |
+
)
|
313 |
+
);
|
314 |
+
}
|
315 |
+
|
316 |
+
// Get plugin page settings.
|
317 |
+
$plugin_page_setup = apply_filters( 'pt-ocdi/plugin-page-setup', array(
|
318 |
+
'parent_slug' => 'themes.php',
|
319 |
+
'page_title' => esc_html__( 'One Click Demo Import' , 'pt-ocdi' ),
|
320 |
+
'menu_title' => esc_html__( 'Import Demo Data' , 'pt-ocdi' ),
|
321 |
+
'capability' => 'import',
|
322 |
+
'menu_slug' => 'pt-one-click-demo-import',
|
323 |
+
)
|
324 |
+
);
|
325 |
+
|
326 |
// Get user credentials for WP file-system API.
|
327 |
+
$demo_import_page_url = wp_nonce_url( $plugin_page_setup['parent_slug'] . '?page=' . $plugin_page_setup['menu_slug'], $plugin_page_setup['menu_slug'] );
|
328 |
|
329 |
if ( false === ( $creds = request_filesystem_credentials( $demo_import_page_url, '', false, false, null ) ) ) {
|
330 |
return new WP_error(
|
345 |
}
|
346 |
|
347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
/**
|
349 |
* Helper function: get the right format of response errors
|
350 |
*
|
inc/class-ocdi-logger.php
CHANGED
@@ -5,9 +5,13 @@
|
|
5 |
* @package ocdi
|
6 |
*/
|
7 |
|
8 |
-
// Include required files.
|
9 |
-
|
10 |
-
require PT_OCDI_PATH . 'vendor/humanmade/WordPress-Importer/class-logger
|
|
|
|
|
|
|
|
|
11 |
|
12 |
class OCDI_Logger extends WP_Importer_Logger_CLI {
|
13 |
|
5 |
* @package ocdi
|
6 |
*/
|
7 |
|
8 |
+
// Include required files, if not already present (via separate plugin).
|
9 |
+
if ( ! class_exists( 'WP_Importer_Logger' ) ) {
|
10 |
+
require PT_OCDI_PATH . 'vendor/humanmade/WordPress-Importer/class-logger.php';
|
11 |
+
}
|
12 |
+
if ( ! class_exists( 'WP_Importer_Logger_CLI' ) ) {
|
13 |
+
require PT_OCDI_PATH . 'vendor/humanmade/WordPress-Importer/class-logger-cli.php';
|
14 |
+
}
|
15 |
|
16 |
class OCDI_Logger extends WP_Importer_Logger_CLI {
|
17 |
|
inc/class-ocdi-wxr-importer.php
CHANGED
@@ -4,14 +4,13 @@
|
|
4 |
* Needed to extend the WXR_Importer class to get/set the importer protected variables,
|
5 |
* for use in the multiple AJAX calls.
|
6 |
*
|
7 |
-
* Overwritten process_post method to fix the menu items/tags import issue. This
|
8 |
-
* should be removed when it is fixed in the original importer.
|
9 |
-
*
|
10 |
* @package ocdi
|
11 |
*/
|
12 |
|
13 |
-
// Include required files.
|
14 |
-
|
|
|
|
|
15 |
|
16 |
class OCDI_WXR_Importer extends WXR_Importer {
|
17 |
|
@@ -42,235 +41,4 @@ class OCDI_WXR_Importer extends WXR_Importer {
|
|
42 |
$this->url_remap = empty( $data['url_remap'] ) ? array() : $data['url_remap'];
|
43 |
$this->featured_images = empty( $data['featured_images'] ) ? array() : $data['featured_images'];
|
44 |
}
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Create new posts based on import information
|
50 |
-
*
|
51 |
-
* Posts marked as having a parent which doesn't exist will become top level items.
|
52 |
-
* Doesn't create a new post if: the post type doesn't exist, the given post ID
|
53 |
-
* is already noted as imported or a post with the same title and date already exists.
|
54 |
-
* Note that new/updated terms, comments and meta are imported for the last of the above.
|
55 |
-
*
|
56 |
-
*
|
57 |
-
* The only thing that is changed in this function is a typecesting to int!!!
|
58 |
-
* It is marked with a couple of lines of comments -> !!!OCDI:
|
59 |
-
*
|
60 |
-
*/
|
61 |
-
protected function process_post( $data, $meta, $comments, $terms ) {
|
62 |
-
/**
|
63 |
-
* Pre-process post data.
|
64 |
-
*
|
65 |
-
* @param array $data Post data. (Return empty to skip.)
|
66 |
-
* @param array $meta Meta data.
|
67 |
-
* @param array $comments Comments on the post.
|
68 |
-
* @param array $terms Terms on the post.
|
69 |
-
*/
|
70 |
-
$data = apply_filters( 'wxr_importer.pre_process.post', $data, $meta, $comments, $terms );
|
71 |
-
if ( empty( $data ) ) {
|
72 |
-
return false;
|
73 |
-
}
|
74 |
-
|
75 |
-
$original_id = isset( $data['post_id'] ) ? (int) $data['post_id'] : 0;
|
76 |
-
$parent_id = isset( $data['post_parent'] ) ? (int) $data['post_parent'] : 0;
|
77 |
-
$author_id = isset( $data['post_author'] ) ? (int) $data['post_author'] : 0;
|
78 |
-
|
79 |
-
// Have we already processed this?
|
80 |
-
if ( isset( $this->mapping['post'][ $original_id ] ) ) {
|
81 |
-
return;
|
82 |
-
}
|
83 |
-
|
84 |
-
$post_type_object = get_post_type_object( $data['post_type'] );
|
85 |
-
|
86 |
-
// Is this type even valid?
|
87 |
-
if ( ! $post_type_object ) {
|
88 |
-
$this->logger->warning( sprintf(
|
89 |
-
__( 'Failed to import "%s": Invalid post type %s', 'pt-ocdi' ),
|
90 |
-
$data['post_title'],
|
91 |
-
$data['post_type']
|
92 |
-
) );
|
93 |
-
return false;
|
94 |
-
}
|
95 |
-
|
96 |
-
$post_exists = $this->post_exists( $data );
|
97 |
-
if ( $post_exists ) {
|
98 |
-
$this->logger->info( sprintf(
|
99 |
-
__('%s "%s" already exists.', 'pt-ocdi'),
|
100 |
-
$post_type_object->labels->singular_name,
|
101 |
-
$data['post_title']
|
102 |
-
) );
|
103 |
-
|
104 |
-
return false;
|
105 |
-
}
|
106 |
-
|
107 |
-
// Map the parent post, or mark it as one we need to fix
|
108 |
-
$requires_remapping = false;
|
109 |
-
if ( $parent_id ) {
|
110 |
-
if ( isset( $this->mapping['post'][ $parent_id ] ) ) {
|
111 |
-
$data['post_parent'] = $this->mapping['post'][ $parent_id ];
|
112 |
-
} else {
|
113 |
-
$meta[] = array( 'key' => '_wxr_import_parent', 'value' => $parent_id );
|
114 |
-
$requires_remapping = true;
|
115 |
-
|
116 |
-
$data['post_parent'] = 0;
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
// Map the author, or mark it as one we need to fix
|
121 |
-
$author = sanitize_user( $data['post_author'], true );
|
122 |
-
if ( empty( $author ) ) {
|
123 |
-
// Missing or invalid author, use default if available.
|
124 |
-
$data['post_author'] = $this->options['default_author'];
|
125 |
-
} elseif ( isset( $this->mapping['user_slug'][ $author ] ) ) {
|
126 |
-
$data['post_author'] = $this->mapping['user_slug'][ $author ];
|
127 |
-
}
|
128 |
-
else {
|
129 |
-
$meta[] = array( 'key' => '_wxr_import_user_slug', 'value' => $author );
|
130 |
-
$requires_remapping = true;
|
131 |
-
|
132 |
-
$data['post_author'] = (int) get_current_user_id();
|
133 |
-
}
|
134 |
-
|
135 |
-
// Does the post look like it contains attachment images?
|
136 |
-
if ( preg_match( self::REGEX_HAS_ATTACHMENT_REFS, $data['post_content'] ) ) {
|
137 |
-
$meta[] = array( 'key' => '_wxr_import_has_attachment_refs', 'value' => true );
|
138 |
-
$requires_remapping = true;
|
139 |
-
}
|
140 |
-
|
141 |
-
// Whitelist to just the keys we allow
|
142 |
-
$postdata = array(
|
143 |
-
'import_id' => $data['post_id'],
|
144 |
-
);
|
145 |
-
$allowed = array(
|
146 |
-
'post_author' => true,
|
147 |
-
'post_date' => true,
|
148 |
-
'post_date_gmt' => true,
|
149 |
-
'post_content' => true,
|
150 |
-
'post_excerpt' => true,
|
151 |
-
'post_title' => true,
|
152 |
-
'post_status' => true,
|
153 |
-
'post_name' => true,
|
154 |
-
'comment_status' => true,
|
155 |
-
'ping_status' => true,
|
156 |
-
'guid' => true,
|
157 |
-
'post_parent' => true,
|
158 |
-
'menu_order' => true,
|
159 |
-
'post_type' => true,
|
160 |
-
'post_password' => true,
|
161 |
-
);
|
162 |
-
foreach ( $data as $key => $value ) {
|
163 |
-
if ( ! isset( $allowed[ $key ] ) ) {
|
164 |
-
continue;
|
165 |
-
}
|
166 |
-
|
167 |
-
$postdata[ $key ] = $data[ $key ];
|
168 |
-
}
|
169 |
-
|
170 |
-
$postdata = apply_filters( 'wp_import_post_data_processed', $postdata, $data );
|
171 |
-
|
172 |
-
if ( 'attachment' === $postdata['post_type'] ) {
|
173 |
-
if ( ! $this->options['fetch_attachments'] ) {
|
174 |
-
$this->logger->notice( sprintf(
|
175 |
-
__( 'Skipping attachment "%s", fetching attachments disabled', 'pt-ocdi' ),
|
176 |
-
$data['post_title']
|
177 |
-
) );
|
178 |
-
return false;
|
179 |
-
}
|
180 |
-
$remote_url = ! empty($data['attachment_url']) ? $data['attachment_url'] : $data['guid'];
|
181 |
-
$post_id = $this->process_attachment( $postdata, $meta, $remote_url );
|
182 |
-
} else {
|
183 |
-
$post_id = wp_insert_post( $postdata, true );
|
184 |
-
do_action( 'wp_import_insert_post', $post_id, $original_id, $postdata, $data );
|
185 |
-
}
|
186 |
-
|
187 |
-
if ( is_wp_error( $post_id ) ) {
|
188 |
-
$this->logger->error( sprintf(
|
189 |
-
__( 'Failed to import "%s" (%s)', 'pt-ocdi' ),
|
190 |
-
$data['post_title'],
|
191 |
-
$post_type_object->labels->singular_name
|
192 |
-
) );
|
193 |
-
$this->logger->debug( $post_id->get_error_message() );
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Post processing failed.
|
197 |
-
*
|
198 |
-
* @param WP_Error $post_id Error object.
|
199 |
-
* @param array $data Raw data imported for the post.
|
200 |
-
* @param array $meta Raw meta data, already processed by {@see process_post_meta}.
|
201 |
-
* @param array $comments Raw comment data, already processed by {@see process_comments}.
|
202 |
-
* @param array $terms Raw term data, already processed.
|
203 |
-
*/
|
204 |
-
do_action( 'wxr_importer.process_failed.post', $post_id, $data, $meta, $comments, $terms );
|
205 |
-
return false;
|
206 |
-
}
|
207 |
-
|
208 |
-
// Ensure stickiness is handled correctly too
|
209 |
-
if ( $data['is_sticky'] == 1 ) {
|
210 |
-
stick_post( $post_id );
|
211 |
-
}
|
212 |
-
|
213 |
-
// map pre-import ID to local ID
|
214 |
-
$this->mapping['post'][ $original_id ] = (int) $post_id;
|
215 |
-
if ( $requires_remapping ) {
|
216 |
-
$this->requires_remapping['post'][ $post_id ] = true;
|
217 |
-
}
|
218 |
-
$this->mark_post_exists( $data, $post_id );
|
219 |
-
|
220 |
-
$this->logger->info( sprintf(
|
221 |
-
__( 'Imported "%s" (%s)', 'pt-ocdi' ),
|
222 |
-
$data['post_title'],
|
223 |
-
$post_type_object->labels->singular_name
|
224 |
-
) );
|
225 |
-
$this->logger->debug( sprintf(
|
226 |
-
__( 'Post %d remapped to %d', 'pt-ocdi' ),
|
227 |
-
$original_id,
|
228 |
-
$post_id
|
229 |
-
) );
|
230 |
-
|
231 |
-
// Handle the terms too
|
232 |
-
$terms = apply_filters( 'wp_import_post_terms', $terms, $post_id, $data );
|
233 |
-
|
234 |
-
if ( ! empty( $terms ) ) {
|
235 |
-
$term_ids = array();
|
236 |
-
foreach ( $terms as $term ) {
|
237 |
-
$taxonomy = $term['taxonomy'];
|
238 |
-
$key = sha1( $taxonomy . ':' . $term['slug'] );
|
239 |
-
|
240 |
-
if ( isset( $this->mapping['term'][ $key ] ) ) {
|
241 |
-
// !!!OCDI: The only change from the original importer code is this typecasting (int) bellow.
|
242 |
-
// !!!OCDI: The only change from the original importer code is this typecasting (int) bellow.
|
243 |
-
// !!!OCDI: The only change from the original importer code is this typecasting (int) bellow.
|
244 |
-
$term_ids[ $taxonomy ][] = (int) $this->mapping['term'][ $key ];
|
245 |
-
}
|
246 |
-
else {
|
247 |
-
$meta[] = array( 'key' => '_wxr_import_term', 'value' => $term );
|
248 |
-
$requires_remapping = true;
|
249 |
-
}
|
250 |
-
}
|
251 |
-
|
252 |
-
foreach ( $term_ids as $tax => $ids ) {
|
253 |
-
$tt_ids = wp_set_post_terms( $post_id, $ids, $tax );
|
254 |
-
do_action( 'wp_import_set_post_terms', $tt_ids, $ids, $tax, $post_id, $data );
|
255 |
-
}
|
256 |
-
}
|
257 |
-
|
258 |
-
$this->process_comments( $comments, $post_id, $data );
|
259 |
-
$this->process_post_meta( $meta, $post_id, $data );
|
260 |
-
|
261 |
-
if ( 'nav_menu_item' === $data['post_type'] ) {
|
262 |
-
$this->process_menu_item_meta( $post_id, $data, $meta );
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Post processing completed.
|
267 |
-
*
|
268 |
-
* @param int $post_id New post ID.
|
269 |
-
* @param array $data Raw data imported for the post.
|
270 |
-
* @param array $meta Raw meta data, already processed by {@see process_post_meta}.
|
271 |
-
* @param array $comments Raw comment data, already processed by {@see process_comments}.
|
272 |
-
* @param array $terms Raw term data, already processed.
|
273 |
-
*/
|
274 |
-
do_action( 'wxr_importer.processed.post', $post_id, $data, $meta, $comments, $terms );
|
275 |
-
}
|
276 |
}
|
4 |
* Needed to extend the WXR_Importer class to get/set the importer protected variables,
|
5 |
* for use in the multiple AJAX calls.
|
6 |
*
|
|
|
|
|
|
|
7 |
* @package ocdi
|
8 |
*/
|
9 |
|
10 |
+
// Include required files, if not already present (via separate plugin).
|
11 |
+
if ( ! class_exists( 'WXR_Importer' ) ) {
|
12 |
+
require PT_OCDI_PATH . 'vendor/humanmade/WordPress-Importer/class-wxr-importer.php';
|
13 |
+
}
|
14 |
|
15 |
class OCDI_WXR_Importer extends WXR_Importer {
|
16 |
|
41 |
$this->url_remap = empty( $data['url_remap'] ) ? array() : $data['url_remap'];
|
42 |
$this->featured_images = empty( $data['featured_images'] ) ? array() : $data['featured_images'];
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
languages/pt-ocdi.pot
CHANGED
@@ -50,75 +50,84 @@ msgid ""
|
|
50 |
"%s."
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: inc/class-ocdi-helpers.php:
|
54 |
msgid ""
|
55 |
"An error occurred while writing file to your server! Tried to write a file "
|
56 |
"to: %s%s."
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: inc/class-ocdi-helpers.php:
|
60 |
msgid ""
|
61 |
"An error occurred while reading a file from your server! Tried reading file "
|
62 |
"from path: %s%s."
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: inc/class-ocdi-helpers.php:
|
66 |
msgid ""
|
67 |
-
"
|
68 |
-
"
|
|
|
69 |
msgstr ""
|
70 |
|
71 |
-
|
72 |
-
msgid "
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: inc/class-ocdi-helpers.php:
|
|
|
|
|
|
|
|
|
|
|
76 |
msgid ""
|
77 |
-
"
|
78 |
-
"
|
79 |
-
|
|
|
|
|
|
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: inc/class-ocdi-helpers.php:
|
83 |
msgid ""
|
84 |
"%sYour user role isn't high enough. You don't have permission to import "
|
85 |
"demo data.%s"
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: inc/class-ocdi-helpers.php:
|
89 |
msgid ""
|
90 |
"Please upload XML file for content import. If you want to import widgets "
|
91 |
"only, please use Widget Importer & Exporter plugin."
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: inc/class-ocdi-helpers.php:
|
95 |
-
#: inc/class-ocdi-helpers.php:
|
96 |
msgid "Upload files"
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: inc/class-ocdi-helpers.php:
|
100 |
msgid "Widget file was not uploaded. Error: %s"
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: inc/class-ocdi-helpers.php:
|
104 |
msgid "Customizer file was not uploaded. Error: %s"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: inc/class-ocdi-helpers.php:
|
108 |
msgid "The import files were successfully uploaded!"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: inc/class-ocdi-helpers.php:
|
112 |
msgid "MAX EXECUTION TIME = %s"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: inc/class-ocdi-helpers.php:
|
116 |
msgid ""
|
117 |
"Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = "
|
118 |
"%4$s%1$sCustomizer file = %5$s"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: inc/class-ocdi-helpers.php:
|
122 |
msgid "not defined!"
|
123 |
msgstr ""
|
124 |
|
@@ -158,41 +167,13 @@ msgstr ""
|
|
158 |
msgid "No results for widget import!"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#:
|
162 |
-
msgid "Failed to import \"%s\": Invalid post type %s"
|
163 |
-
msgstr ""
|
164 |
-
|
165 |
-
#: inc/class-ocdi-wxr-importer.php:99
|
166 |
-
msgid "%s \"%s\" already exists."
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
-
#: inc/class-ocdi-wxr-importer.php:175
|
170 |
-
msgid "Skipping attachment \"%s\", fetching attachments disabled"
|
171 |
-
msgstr ""
|
172 |
-
|
173 |
-
#: inc/class-ocdi-wxr-importer.php:189
|
174 |
-
msgid "Failed to import \"%s\" (%s)"
|
175 |
-
msgstr ""
|
176 |
-
|
177 |
-
#: inc/class-ocdi-wxr-importer.php:221
|
178 |
-
msgid "Imported \"%s\" (%s)"
|
179 |
-
msgstr ""
|
180 |
-
|
181 |
-
#: inc/class-ocdi-wxr-importer.php:226
|
182 |
-
msgid "Post %d remapped to %d"
|
183 |
-
msgstr ""
|
184 |
-
|
185 |
-
#. Plugin Name of the plugin/theme
|
186 |
-
msgid "One Click Demo Import"
|
187 |
-
msgstr ""
|
188 |
-
|
189 |
-
#: one-click-demo-import.php:116
|
190 |
msgid ""
|
191 |
"%sWarning: your server is using %sPHP safe mode%s. This means that you "
|
192 |
"might experience server timeout errors.%s"
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: one-click-demo-import.php:
|
196 |
msgid ""
|
197 |
"Importing demo data (post, pages, images, theme settings, ...) is the "
|
198 |
"easiest way to setup your theme. It will allow you to quickly edit "
|
@@ -200,81 +181,77 @@ msgid ""
|
|
200 |
"data, the following things might happen:"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: one-click-demo-import.php:
|
204 |
msgid ""
|
205 |
"No existing posts, pages, categories, images, custom post types or any "
|
206 |
"other data will be deleted or modified."
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: one-click-demo-import.php:
|
210 |
msgid "Posts, pages, images, widgets and menus will get imported."
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: one-click-demo-import.php:
|
214 |
msgid ""
|
215 |
"Please click \"Import Demo Data\" button only once and wait, it can take a "
|
216 |
"couple of minutes."
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: one-click-demo-import.php:
|
220 |
msgid "Before you begin, make sure all the required plugins are activated."
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: one-click-demo-import.php:
|
224 |
msgid ""
|
225 |
"There are no predefined import files available in this theme. Please upload "
|
226 |
"the import files manually!"
|
227 |
msgstr ""
|
228 |
|
229 |
-
#: one-click-demo-import.php:
|
230 |
msgid "Choose a XML file for content import:"
|
231 |
msgstr ""
|
232 |
|
233 |
-
#: one-click-demo-import.php:
|
234 |
msgid "optional"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: one-click-demo-import.php:
|
238 |
msgid "Choose a WIE or JSON file for widget import:"
|
239 |
msgstr ""
|
240 |
|
241 |
-
#: one-click-demo-import.php:
|
242 |
msgid "Choose a DAT file for customizer import:"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: one-click-demo-import.php:
|
246 |
msgid "Import preview:"
|
247 |
msgstr ""
|
248 |
|
249 |
-
#: one-click-demo-import.php:
|
250 |
msgid "No preview image defined for this import."
|
251 |
msgstr ""
|
252 |
|
253 |
-
#: one-click-demo-import.php:
|
254 |
-
msgid "Import Demo Data"
|
255 |
-
msgstr ""
|
256 |
-
|
257 |
-
#: one-click-demo-import.php:213
|
258 |
msgid "Importing, please wait!"
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: one-click-demo-import.php:
|
262 |
msgid "Manually uploaded files"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: one-click-demo-import.php:
|
266 |
msgid "Downloaded files"
|
267 |
msgstr ""
|
268 |
|
269 |
-
#: one-click-demo-import.php:
|
270 |
msgid "The import files for: %s were successfully downloaded!"
|
271 |
msgstr ""
|
272 |
|
273 |
-
#: one-click-demo-import.php:
|
274 |
msgid "No import files specified!"
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: one-click-demo-import.php:
|
278 |
msgid ""
|
279 |
"%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
|
280 |
"check your page and make sure that everything has imported correctly. If it "
|
@@ -282,30 +259,30 @@ msgid ""
|
|
282 |
"it has done its job.%5$s"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: one-click-demo-import.php:
|
286 |
msgid ""
|
287 |
"%1$sThe demo import has finished, but there were some import "
|
288 |
"errors.%2$sMore details about the errors can be found in this %3$s%5$slog "
|
289 |
"file%6$s%4$s%7$s"
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: one-click-demo-import.php:
|
293 |
msgid "Importing content"
|
294 |
msgstr ""
|
295 |
|
296 |
-
#: one-click-demo-import.php:
|
297 |
msgid "Importing widgets"
|
298 |
msgstr ""
|
299 |
|
300 |
-
#: one-click-demo-import.php:
|
301 |
msgid "Importing customizer settings"
|
302 |
msgstr ""
|
303 |
|
304 |
-
#: one-click-demo-import.php:
|
305 |
msgid "Customizer settings import finished!"
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: one-click-demo-import.php:
|
309 |
msgid "Completed AJAX call number: "
|
310 |
msgstr ""
|
311 |
|
50 |
"%s."
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: inc/class-ocdi-helpers.php:205 inc/class-ocdi-helpers.php:249
|
54 |
msgid ""
|
55 |
"An error occurred while writing file to your server! Tried to write a file "
|
56 |
"to: %s%s."
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: inc/class-ocdi-helpers.php:284
|
60 |
msgid ""
|
61 |
"An error occurred while reading a file from your server! Tried reading file "
|
62 |
"from path: %s%s."
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: inc/class-ocdi-helpers.php:308
|
66 |
msgid ""
|
67 |
+
"This WordPress page does not have %sdirect%s write file access. This plugin "
|
68 |
+
"needs it in order to save the demo import xml file to the upload directory "
|
69 |
+
"of your site. You can change this setting with these instructions: %s."
|
70 |
msgstr ""
|
71 |
|
72 |
+
#. Plugin Name of the plugin/theme
|
73 |
+
msgid "One Click Demo Import"
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: inc/class-ocdi-helpers.php:320 one-click-demo-import.php:101
|
77 |
+
#: one-click-demo-import.php:226
|
78 |
+
msgid "Import Demo Data"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: inc/class-ocdi-helpers.php:332
|
82 |
msgid ""
|
83 |
+
"An error occurred while retrieving reading/writing permissions to your "
|
84 |
+
"server (could not retrieve WP filesystem credentials)!"
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: inc/class-ocdi-helpers.php:340
|
88 |
+
msgid "Your WordPress login credentials don't allow to use WP_Filesystem!"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: inc/class-ocdi-helpers.php:411
|
92 |
msgid ""
|
93 |
"%sYour user role isn't high enough. You don't have permission to import "
|
94 |
"demo data.%s"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: inc/class-ocdi-helpers.php:447
|
98 |
msgid ""
|
99 |
"Please upload XML file for content import. If you want to import widgets "
|
100 |
"only, please use Widget Importer & Exporter plugin."
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: inc/class-ocdi-helpers.php:449 inc/class-ocdi-helpers.php:471
|
104 |
+
#: inc/class-ocdi-helpers.php:490 inc/class-ocdi-helpers.php:498
|
105 |
msgid "Upload files"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: inc/class-ocdi-helpers.php:467
|
109 |
msgid "Widget file was not uploaded. Error: %s"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: inc/class-ocdi-helpers.php:486
|
113 |
msgid "Customizer file was not uploaded. Error: %s"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: inc/class-ocdi-helpers.php:496
|
117 |
msgid "The import files were successfully uploaded!"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: inc/class-ocdi-helpers.php:514
|
121 |
msgid "MAX EXECUTION TIME = %s"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: inc/class-ocdi-helpers.php:518
|
125 |
msgid ""
|
126 |
"Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = "
|
127 |
"%4$s%1$sCustomizer file = %5$s"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: inc/class-ocdi-helpers.php:522 inc/class-ocdi-helpers.php:523
|
131 |
msgid "not defined!"
|
132 |
msgstr ""
|
133 |
|
167 |
msgid "No results for widget import!"
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: one-click-demo-import.php:125
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
msgid ""
|
172 |
"%sWarning: your server is using %sPHP safe mode%s. This means that you "
|
173 |
"might experience server timeout errors.%s"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: one-click-demo-import.php:139
|
177 |
msgid ""
|
178 |
"Importing demo data (post, pages, images, theme settings, ...) is the "
|
179 |
"easiest way to setup your theme. It will allow you to quickly edit "
|
181 |
"data, the following things might happen:"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: one-click-demo-import.php:143
|
185 |
msgid ""
|
186 |
"No existing posts, pages, categories, images, custom post types or any "
|
187 |
"other data will be deleted or modified."
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: one-click-demo-import.php:144
|
191 |
msgid "Posts, pages, images, widgets and menus will get imported."
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: one-click-demo-import.php:145
|
195 |
msgid ""
|
196 |
"Please click \"Import Demo Data\" button only once and wait, it can take a "
|
197 |
"couple of minutes."
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: one-click-demo-import.php:150
|
201 |
msgid "Before you begin, make sure all the required plugins are activated."
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: one-click-demo-import.php:164
|
205 |
msgid ""
|
206 |
"There are no predefined import files available in this theme. Please upload "
|
207 |
"the import files manually!"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: one-click-demo-import.php:168
|
211 |
msgid "Choose a XML file for content import:"
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: one-click-demo-import.php:171 one-click-demo-import.php:174
|
215 |
msgid "optional"
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: one-click-demo-import.php:171
|
219 |
msgid "Choose a WIE or JSON file for widget import:"
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: one-click-demo-import.php:174
|
223 |
msgid "Choose a DAT file for customizer import:"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: one-click-demo-import.php:201
|
227 |
msgid "Import preview:"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: one-click-demo-import.php:205 one-click-demo-import.php:257
|
231 |
msgid "No preview image defined for this import."
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: one-click-demo-import.php:230
|
|
|
|
|
|
|
|
|
235 |
msgid "Importing, please wait!"
|
236 |
msgstr ""
|
237 |
|
238 |
+
#: one-click-demo-import.php:314
|
239 |
msgid "Manually uploaded files"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: one-click-demo-import.php:331 one-click-demo-import.php:342
|
243 |
msgid "Downloaded files"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: one-click-demo-import.php:338
|
247 |
msgid "The import files for: %s were successfully downloaded!"
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: one-click-demo-import.php:348
|
251 |
msgid "No import files specified!"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: one-click-demo-import.php:395
|
255 |
msgid ""
|
256 |
"%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
|
257 |
"check your page and make sure that everything has imported correctly. If it "
|
259 |
"it has done its job.%5$s"
|
260 |
msgstr ""
|
261 |
|
262 |
+
#: one-click-demo-import.php:406
|
263 |
msgid ""
|
264 |
"%1$sThe demo import has finished, but there were some import "
|
265 |
"errors.%2$sMore details about the errors can be found in this %3$s%5$slog "
|
266 |
"file%6$s%4$s%7$s"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: one-click-demo-import.php:462
|
270 |
msgid "Importing content"
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: one-click-demo-import.php:501 one-click-demo-import.php:513
|
274 |
msgid "Importing widgets"
|
275 |
msgstr ""
|
276 |
|
277 |
+
#: one-click-demo-import.php:535 one-click-demo-import.php:543
|
278 |
msgid "Importing customizer settings"
|
279 |
msgstr ""
|
280 |
|
281 |
+
#: one-click-demo-import.php:541
|
282 |
msgid "Customizer settings import finished!"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: one-click-demo-import.php:593
|
286 |
msgid "Completed AJAX call number: "
|
287 |
msgstr ""
|
288 |
|
one-click-demo-import.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: One Click Demo Import
|
5 |
Plugin URI: https://wordpress.org/plugins/one-click-demo-import/
|
6 |
Description: Import your content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
|
7 |
-
Version: 1.1.
|
8 |
Author: ProteusThemes
|
9 |
Author URI: http://www.proteusthemes.com
|
10 |
License: GPL3
|
@@ -20,7 +20,7 @@ define( 'PT_OCDI_PATH', plugin_dir_path( __FILE__ ) );
|
|
20 |
define( 'PT_OCDI_URL', plugin_dir_url( __FILE__ ) );
|
21 |
|
22 |
// Current version of the plugin.
|
23 |
-
define( 'PT_OCDI_VERSION', '1.1.
|
24 |
|
25 |
// Include files.
|
26 |
require PT_OCDI_PATH . 'inc/class-ocdi-helpers.php';
|
@@ -95,7 +95,16 @@ class PT_One_Click_Demo_Import {
|
|
95 |
* Creates the plugin page and a submenu item in WP Appearance menu.
|
96 |
*/
|
97 |
public function create_plugin_page() {
|
98 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
|
@@ -188,8 +197,8 @@ class PT_One_Click_Demo_Import {
|
|
188 |
|
189 |
if ( $preview_image_is_defined ) :
|
190 |
?>
|
191 |
-
<
|
192 |
-
<
|
193 |
<p class="ocdi__demo-import-preview-image-message js-ocdi-preview-image-message">
|
194 |
<?php
|
195 |
if ( ! isset( $this->import_files[0]['import_preview_image_url'] ) ) {
|
@@ -199,12 +208,20 @@ class PT_One_Click_Demo_Import {
|
|
199 |
?>
|
200 |
</p>
|
201 |
<img id="ocdi__demo-import-preview-image" class="js-ocdi-preview-image" src="<?php echo ! empty( $this->import_files[0]['import_preview_image_url'] ) ? esc_url( $this->import_files[0]['import_preview_image_url'] ) : ''; ?>">
|
202 |
-
|
203 |
<?php
|
204 |
endif;
|
205 |
endif;
|
206 |
?>
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
<p>
|
209 |
<button class="ocdi__button button-primary js-ocdi-import-data"><?php esc_html_e( 'Import Demo Data', 'pt-ocdi' ); ?></button>
|
210 |
</p>
|
4 |
Plugin Name: One Click Demo Import
|
5 |
Plugin URI: https://wordpress.org/plugins/one-click-demo-import/
|
6 |
Description: Import your content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
|
7 |
+
Version: 1.1.2
|
8 |
Author: ProteusThemes
|
9 |
Author URI: http://www.proteusthemes.com
|
10 |
License: GPL3
|
20 |
define( 'PT_OCDI_URL', plugin_dir_url( __FILE__ ) );
|
21 |
|
22 |
// Current version of the plugin.
|
23 |
+
define( 'PT_OCDI_VERSION', '1.1.2' );
|
24 |
|
25 |
// Include files.
|
26 |
require PT_OCDI_PATH . 'inc/class-ocdi-helpers.php';
|
95 |
* Creates the plugin page and a submenu item in WP Appearance menu.
|
96 |
*/
|
97 |
public function create_plugin_page() {
|
98 |
+
$plugin_page_setup = apply_filters( 'pt-ocdi/plugin-page-setup', array(
|
99 |
+
'parent_slug' => 'themes.php',
|
100 |
+
'page_title' => esc_html__( 'One Click Demo Import' , 'pt-ocdi' ),
|
101 |
+
'menu_title' => esc_html__( 'Import Demo Data' , 'pt-ocdi' ),
|
102 |
+
'capability' => 'import',
|
103 |
+
'menu_slug' => 'pt-one-click-demo-import',
|
104 |
+
)
|
105 |
+
);
|
106 |
+
|
107 |
+
$this->plugin_page = add_submenu_page( $plugin_page_setup['parent_slug'], $plugin_page_setup['page_title'], $plugin_page_setup['menu_title'], $plugin_page_setup['capability'], $plugin_page_setup['menu_slug'], array( $this, 'display_plugin_page' ) );
|
108 |
}
|
109 |
|
110 |
|
197 |
|
198 |
if ( $preview_image_is_defined ) :
|
199 |
?>
|
200 |
+
<div>
|
201 |
+
<p><?php esc_html_e( 'Import preview:', 'pt-ocdi' ); ?></p>
|
202 |
<p class="ocdi__demo-import-preview-image-message js-ocdi-preview-image-message">
|
203 |
<?php
|
204 |
if ( ! isset( $this->import_files[0]['import_preview_image_url'] ) ) {
|
208 |
?>
|
209 |
</p>
|
210 |
<img id="ocdi__demo-import-preview-image" class="js-ocdi-preview-image" src="<?php echo ! empty( $this->import_files[0]['import_preview_image_url'] ) ? esc_url( $this->import_files[0]['import_preview_image_url'] ) : ''; ?>">
|
211 |
+
</div>
|
212 |
<?php
|
213 |
endif;
|
214 |
endif;
|
215 |
?>
|
216 |
|
217 |
+
<div class="ocdi__demo-import-notice js-ocdi-demo-import-notice">
|
218 |
+
<?php
|
219 |
+
if ( is_array( $this->import_files ) && ! empty( $this->import_files[0]['import_notice'] ) ) {
|
220 |
+
echo wp_kses_post( $this->import_files[0]['import_notice'] );
|
221 |
+
}
|
222 |
+
?>
|
223 |
+
</div>
|
224 |
+
|
225 |
<p>
|
226 |
<button class="ocdi__button button-primary js-ocdi-import-data"><?php esc_html_e( 'Import Demo Data', 'pt-ocdi' ); ?></button>
|
227 |
</p>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: capuderg, cyman
|
|
3 |
Tags: import, content, demo, data, widgets, settings
|
4 |
Requires at least: 4.0.0
|
5 |
Tested up to: 4.5
|
6 |
-
Stable tag: 1.1.
|
7 |
License: GPLv3 or later
|
8 |
|
9 |
Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
|
@@ -26,6 +26,10 @@ NOTE: This plugin is still a work in progress!
|
|
26 |
|
27 |
NOTE: There is no setting to "connect" authors from the demo import file to the existing users in your WP site (like there is in the original WP Importer plugin).
|
28 |
|
|
|
|
|
|
|
|
|
29 |
== Installation ==
|
30 |
|
31 |
Upload the One Click Demo Import plugin to your WordPress site, Activate it, and that's it.
|
@@ -55,6 +59,7 @@ function ocdi_import_files() {
|
|
55 |
'import_widget_file_url' => 'http://www.your_domain.com/ocdi/widgets.json',
|
56 |
'import_customizer_file_url' => 'http://www.your_domain.com/ocdi/customizer.dat',
|
57 |
'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image1.json',
|
|
|
58 |
),
|
59 |
array(
|
60 |
'import_file_name' => 'Demo Import 2',
|
@@ -62,6 +67,7 @@ function ocdi_import_files() {
|
|
62 |
'import_widget_file_url' => 'http://www.your_domain.com/ocdi/widgets2.json',
|
63 |
'import_customizer_file_url' => 'http://www.your_domain.com/ocdi/customizer2.dat',
|
64 |
'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image2.json',
|
|
|
65 |
),
|
66 |
);
|
67 |
}
|
@@ -120,6 +126,29 @@ add_filter( 'pt-ocdi/plugin_intro_text', 'ocdi_plugin_intro_text' );
|
|
120 |
|
121 |
To add some text in a separate "box", you should wrap your text in a div with a class of 'ocdi__intro-text', like in the code example above.
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
= I can't activate the plugin, because of a fatal error, what can I do? =
|
124 |
|
125 |
You want to activate the plugin, but this error shows up:
|
@@ -130,6 +159,16 @@ This happens, because your hosting server is using a very old version of PHP. Th
|
|
130 |
|
131 |
== Changelog ==
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
= 1.1.1 =
|
134 |
|
135 |
*Release Date - 22 May 2016*
|
3 |
Tags: import, content, demo, data, widgets, settings
|
4 |
Requires at least: 4.0.0
|
5 |
Tested up to: 4.5
|
6 |
+
Stable tag: 1.1.2
|
7 |
License: GPLv3 or later
|
8 |
|
9 |
Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
|
26 |
|
27 |
NOTE: There is no setting to "connect" authors from the demo import file to the existing users in your WP site (like there is in the original WP Importer plugin).
|
28 |
|
29 |
+
**Do you want to contribute?**
|
30 |
+
|
31 |
+
Please refer to the official [GitHub repository](https://github.com/proteusthemes/one-click-demo-import) of this plugin.
|
32 |
+
|
33 |
== Installation ==
|
34 |
|
35 |
Upload the One Click Demo Import plugin to your WordPress site, Activate it, and that's it.
|
59 |
'import_widget_file_url' => 'http://www.your_domain.com/ocdi/widgets.json',
|
60 |
'import_customizer_file_url' => 'http://www.your_domain.com/ocdi/customizer.dat',
|
61 |
'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image1.json',
|
62 |
+
'import_notice' => __( 'After you import this demo, you will have to setup the slider separately.', 'your-textdomain' ),
|
63 |
),
|
64 |
array(
|
65 |
'import_file_name' => 'Demo Import 2',
|
67 |
'import_widget_file_url' => 'http://www.your_domain.com/ocdi/widgets2.json',
|
68 |
'import_customizer_file_url' => 'http://www.your_domain.com/ocdi/customizer2.dat',
|
69 |
'import_preview_image_url' => 'http://www.your_domain.com/ocdi/preview_import_image2.json',
|
70 |
+
'import_notice' => __( 'A special note for this import.', 'your-textdomain' ),
|
71 |
),
|
72 |
);
|
73 |
}
|
126 |
|
127 |
To add some text in a separate "box", you should wrap your text in a div with a class of 'ocdi__intro-text', like in the code example above.
|
128 |
|
129 |
+
= How to disable generation of smaller images (thumbnails) during the content import =
|
130 |
+
|
131 |
+
This will greatly improve the time needed to import the content (images), but only the original sized images will be imported. You can disable it with a filter, so just add this code to your theme function.php file:
|
132 |
+
|
133 |
+
`add_filter( 'pt-ocdi/regenerate_thumbnails_in_content_import', '__return_false' );`
|
134 |
+
|
135 |
+
= How to change the location, title and other parameters of the plugin page? =
|
136 |
+
|
137 |
+
As a theme author you do not like the location of the "Import Demo Data" plugin page in *Appearance -> Import Demo Data*? You can change that with the filter below. Apart from the location, you can also change the title or the page/menu and some other parameters as well.
|
138 |
+
|
139 |
+
`
|
140 |
+
function ocdi_plugin_page_setup( $default_settings ) {
|
141 |
+
$default_settings['parent_slug'] = 'themes.php';
|
142 |
+
$default_settings['page_title'] = esc_html__( 'One Click Demo Import' , 'pt-ocdi' );
|
143 |
+
$default_settings['menu_title'] = esc_html__( 'Import Demo Data' , 'pt-ocdi' );
|
144 |
+
$default_settings['capability'] = 'import';
|
145 |
+
$default_settings['menu_slug'] = 'pt-one-click-demo-import';
|
146 |
+
|
147 |
+
return $default_settings;
|
148 |
+
}
|
149 |
+
add_filter( 'pt-ocdi/plugin-page-setup', 'ocdi_plugin_page_setup' );
|
150 |
+
`
|
151 |
+
|
152 |
= I can't activate the plugin, because of a fatal error, what can I do? =
|
153 |
|
154 |
You want to activate the plugin, but this error shows up:
|
159 |
|
160 |
== Changelog ==
|
161 |
|
162 |
+
= 1.1.2 =
|
163 |
+
|
164 |
+
*Release Date - 12 June 2016*
|
165 |
+
|
166 |
+
* An 'import notice' field has been added to the predefined demo import settings. This notice is displayed above the import button (it also accepts HTML),
|
167 |
+
* Now displays proper error message, if the file-system method is not set to "direct",
|
168 |
+
* This plugin is now compatible with the new [Humanmade content importer plugin](https://github.com/humanmade/WordPress-Importer),
|
169 |
+
* Added a filter to the plugin page creation, so that theme authors can now change the location of the plugin page (Demo data import) and some other parameters as well,
|
170 |
+
|
171 |
+
|
172 |
= 1.1.1 =
|
173 |
|
174 |
*Release Date - 22 May 2016*
|
vendor/humanmade/WordPress-Importer/class-wxr-importer.php
CHANGED
@@ -764,6 +764,9 @@ class WXR_Importer extends WP_Importer {
|
|
764 |
$post_type_object->labels->singular_name,
|
765 |
$data['post_title']
|
766 |
) );
|
|
|
|
|
|
|
767 |
|
768 |
return false;
|
769 |
}
|
@@ -902,7 +905,7 @@ class WXR_Importer extends WP_Importer {
|
|
902 |
$key = sha1( $taxonomy . ':' . $term['slug'] );
|
903 |
|
904 |
if ( isset( $this->mapping['term'][ $key ] ) ) {
|
905 |
-
$term_ids[ $taxonomy ][] = $this->mapping['term'][ $key ];
|
906 |
}
|
907 |
else {
|
908 |
$meta[] = array( 'key' => '_wxr_import_term', 'value' => $term );
|
@@ -1248,10 +1251,7 @@ class WXR_Importer extends WP_Importer {
|
|
1248 |
* @param array $post Post data.
|
1249 |
* @return int|WP_Error Number of comments imported on success, error otherwise.
|
1250 |
*/
|
1251 |
-
protected function process_comments( $comments, $post_id, $post ) {
|
1252 |
-
|
1253 |
-
// TODO: this should use the real value for delta updating
|
1254 |
-
$post_exists = false;
|
1255 |
|
1256 |
$comments = apply_filters( 'wp_import_post_comments', $comments, $post_id, $post );
|
1257 |
if ( empty( $comments ) ) {
|
@@ -1281,7 +1281,7 @@ class WXR_Importer extends WP_Importer {
|
|
1281 |
|
1282 |
// if this is a new post we can skip the comment_exists() check
|
1283 |
// TODO: Check comment_exists for performance
|
1284 |
-
if ( $post_exists && $
|
1285 |
$this->mapping['comment'][ $original_id ] = $exists;
|
1286 |
continue;
|
1287 |
}
|
@@ -2140,7 +2140,7 @@ class WXR_Importer extends WP_Importer {
|
|
2140 |
|
2141 |
foreach ( $posts as $item ) {
|
2142 |
$exists_key = sha1( $item->comment_author . ':' . $item->comment_date );
|
2143 |
-
$this->exists['
|
2144 |
}
|
2145 |
}
|
2146 |
|
764 |
$post_type_object->labels->singular_name,
|
765 |
$data['post_title']
|
766 |
) );
|
767 |
+
|
768 |
+
// Even though this post already exists, new comments might need importing
|
769 |
+
$this->process_comments( $comments, $original_id, $data, $post_exists );
|
770 |
|
771 |
return false;
|
772 |
}
|
905 |
$key = sha1( $taxonomy . ':' . $term['slug'] );
|
906 |
|
907 |
if ( isset( $this->mapping['term'][ $key ] ) ) {
|
908 |
+
$term_ids[ $taxonomy ][] = (int) $this->mapping['term'][ $key ];
|
909 |
}
|
910 |
else {
|
911 |
$meta[] = array( 'key' => '_wxr_import_term', 'value' => $term );
|
1251 |
* @param array $post Post data.
|
1252 |
* @return int|WP_Error Number of comments imported on success, error otherwise.
|
1253 |
*/
|
1254 |
+
protected function process_comments( $comments, $post_id, $post, $post_exists = false ) {
|
|
|
|
|
|
|
1255 |
|
1256 |
$comments = apply_filters( 'wp_import_post_comments', $comments, $post_id, $post );
|
1257 |
if ( empty( $comments ) ) {
|
1281 |
|
1282 |
// if this is a new post we can skip the comment_exists() check
|
1283 |
// TODO: Check comment_exists for performance
|
1284 |
+
if ( $post_exists && $exists = $this->comment_exists( $comment ) ) {
|
1285 |
$this->mapping['comment'][ $original_id ] = $exists;
|
1286 |
continue;
|
1287 |
}
|
2140 |
|
2141 |
foreach ( $posts as $item ) {
|
2142 |
$exists_key = sha1( $item->comment_author . ':' . $item->comment_date );
|
2143 |
+
$this->exists['comment'][ $exists_key ] = $item->comment_ID;
|
2144 |
}
|
2145 |
}
|
2146 |
|