Rara One Click Demo Import - Version 1.0.1

Version Description

  • CLASSES ADDED
  • FILTERS ADDED
Download this release

Release Info

Developer raratheme
Plugin Icon 128x128 Rara One Click Demo Import
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0.0 to 1.0.1

LICENSE.txt ADDED
@@ -0,0 +1,339 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
includes/class-rrdi-customizer-option.php CHANGED
@@ -5,8 +5,8 @@
5
*
6
* Used in the Customizer importer.
7
*
8
- * @since 1.1.1
9
- * @package rara-demo-import
10
*/
11
12
final class RRDI_Customizer_Option extends WP_Customize_Setting {
@@ -14,7 +14,7 @@ final class RRDI_Customizer_Option extends WP_Customize_Setting {
14
/**
15
* Import an option value for this setting.
16
*
17
- * @since 1.1.1
18
* @param mixed $value The option value.
19
* @return void
20
*/
5
*
6
* Used in the Customizer importer.
7
*
8
+ * @since 1.0.1
9
+ * @package rara-one-click-demo-import
10
*/
11
12
final class RRDI_Customizer_Option extends WP_Customize_Setting {
14
/**
15
* Import an option value for this setting.
16
*
17
+ * @since 1.0.1
18
* @param mixed $value The option value.
19
* @return void
20
*/
includes/class-rrdi-helpers.php CHANGED
@@ -2,7 +2,7 @@
2
/**
3
* Static functions used in the rrdi plugin.
4
*
5
- * @package rara-demo-import
6
*/
7
8
/**
@@ -67,7 +67,7 @@ class RRDI_Helpers {
67
return new WP_Error(
68
'url_or_local_file_not_defined',
69
sprintf(
70
- __( '"import_file_url" or "local_import_file" for %s%s%s are not defined!', 'rara-demo-import' ),
71
'<strong>',
72
$import_file_info['import_file_name'],
73
'</strong>'
@@ -173,7 +173,7 @@ class RRDI_Helpers {
173
return new WP_Error(
174
'url_not_defined',
175
sprintf(
176
- __( 'URL for %s%s%s file is not defined!', 'rara-demo-import' ),
177
'<strong>',
178
$file_name,
179
'</strong>'
@@ -195,7 +195,7 @@ class RRDI_Helpers {
195
return new WP_Error(
196
'file_fetching_error',
197
sprintf(
198
- __( 'An error occurred while fetching %s%s%s file from the server!%sReason: %s - %s.', 'rara-demo-import' ),
199
'<strong>',
200
$file_name,
201
'</strong>',
@@ -235,7 +235,7 @@ class RRDI_Helpers {
235
return new WP_Error(
236
'failed_writing_file_to_server',
237
sprintf(
238
- __( 'An error occurred while writing file to your server! Tried to write a file to: %s%s.', 'rara-demo-import' ),
239
'<br>',
240
$file_path
241
)
@@ -279,7 +279,7 @@ class RRDI_Helpers {
279
return new WP_Error(
280
'failed_writing_file_to_server',
281
sprintf(
282
- __( 'An error occurred while writing file to your server! Tried to write a file to: %s%s.', 'rara-demo-import' ),
283
'<br>',
284
$file_path
285
)
@@ -314,7 +314,7 @@ class RRDI_Helpers {
314
return new WP_Error(
315
'failed_reading_file_from_server',
316
sprintf(
317
- __( 'An error occurred while reading a file from your server! Tried reading file from path: %s%s.', 'rara-demo-import' ),
318
'<br>',
319
$file_path
320
)
@@ -338,7 +338,7 @@ class RRDI_Helpers {
338
return new WP_Error(
339
'no_direct_file_access',
340
sprintf(
341
- __( '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.', 'rara-demo-import' ),
342
'<strong>',
343
'</strong>',
344
'<a href="http://gregorcapuder.com/wordpress-how-to-set-direct-filesystem-method/" target="_blank">How to set <strong>direct</strong> filesystem method</a>'
@@ -349,8 +349,8 @@ class RRDI_Helpers {
349
// Get plugin page settings.
350
$plugin_page_setup = apply_filters( 'rrdi/plugin_page_setup', array(
351
'parent_slug' => 'themes.php',
352
- 'page_title' => esc_html__( 'Rara One Click Demo Import' , 'rara-demo-import' ),
353
- 'menu_title' => esc_html__( 'Import Demo Data' , 'rara-demo-import' ),
354
'capability' => 'import',
355
'menu_slug' => 'rara-demo-import',
356
)
@@ -362,7 +362,7 @@ class RRDI_Helpers {
362
if ( false === ( $creds = request_filesystem_credentials( $demo_import_page_url, '', false, false, null ) ) ) {
363
return new WP_error(
364
'filesystem_credentials_could_not_be_retrieved',
365
- __( 'An error occurred while retrieving reading/writing permissions to your server (could not retrieve WP filesystem credentials)!', 'rara-demo-import' )
366
);
367
}
368
@@ -370,7 +370,7 @@ class RRDI_Helpers {
370
if ( ! WP_Filesystem( $creds ) ) {
371
return new WP_Error(
372
'wrong_login_credentials',
373
- __( 'Your WordPress login credentials don\'t allow to use WP_Filesystem!', 'rara-demo-import' )
374
);
375
}
376
@@ -435,7 +435,7 @@ class RRDI_Helpers {
435
$attachment = array(
436
'guid' => self::get_log_url( $log_path ),
437
'post_mime_type' => $filetype['type'],
438
- 'post_title' => apply_filters( 'rrdi/attachment_prefix', esc_html__( 'Rara One Click Demo Import - ', 'rara-demo-import' ) ) . preg_replace( '/\.[^.]+#x2F;', '', basename( $log_path ) ),
439
'post_content' => '',
440
'post_status' => 'inherit',
441
);
@@ -471,7 +471,7 @@ class RRDI_Helpers {
471
if ( ! current_user_can( 'import' ) ) {
472
wp_die(
473
sprintf(
474
- __( '%sYour user role isn\'t high enough. You don\'t have permission to import demo data.%s', 'rara-demo-import' ),
475
'<div class="notice notice-error"><p>',
476
'</p></div>'
477
)
@@ -507,9 +507,9 @@ class RRDI_Helpers {
507
508
// Write error to log file and send an AJAX response with the error.
509
self::log_error_and_send_ajax_response(
510
- __( 'Please upload XML file for content import. If you want to import widgets or customizer settings only, please use Widget Importer & Exporter or the Customizer Export/Import plugin.', 'rara-demo-import' ),
511
$log_file_path,
512
- esc_html__( 'Upload files', 'rara-demo-import' )
513
);
514
}
515
@@ -527,11 +527,11 @@ class RRDI_Helpers {
527
// Add this error to log file.
528
$log_added = self::append_to_file(
529
sprintf(
530
- __( 'Widget file was not uploaded. Error: %s', 'rara-demo-import' ),
531
$widget_file_info['error']
532
),
533
$log_file_path,
534
- esc_html__( 'Upload files' , 'rara-demo-import' )
535
);
536
}
537
@@ -546,19 +546,19 @@ class RRDI_Helpers {
546
// Add this error to log file.
547
$log_added = self::append_to_file(
548
sprintf(
549
- __( 'Customizer file was not uploaded. Error: %s', 'rara-demo-import' ),
550
$customizer_file_info['error']
551
),
552
$log_file_path,
553
- esc_html__( 'Upload files' , 'rara-demo-import' )
554
);
555
}
556
557
// Add this message to log file.
558
$log_added = self::append_to_file(
559
- __( 'The import files were successfully uploaded!', 'rara-demo-import' ) . self::import_file_info( $selected_import_files ),
560
$log_file_path,
561
- esc_html__( 'Upload files' , 'rara-demo-import' )
562
);
563
564
// Return array with paths of uploaded files.
@@ -574,16 +574,16 @@ class RRDI_Helpers {
574
public static function import_file_info( $selected_import_files ) {
575
return PHP_EOL .
576
sprintf(
577
- __( 'Initial max execution time = %s', 'rara-demo-import' ),
578
ini_get( 'max_execution_time' )
579
) . PHP_EOL .
580
sprintf(
581
- __( 'Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = %4$s%1$sCustomizer file = %5$s', 'rara-demo-import' ),
582
PHP_EOL,
583
get_site_url(),
584
$selected_import_files['content'],
585
- empty( $selected_import_files['widgets'] ) ? esc_html__( 'not defined!', 'rara-demo-import' ) : $selected_import_files['widgets'],
586
- empty( $selected_import_files['customizer'] ) ? esc_html__( 'not defined!', 'rara-demo-import' ) : $selected_import_files['customizer']
587
);
588
}
589
2
/**
3
* Static functions used in the rrdi plugin.
4
*
5
+ * @package rara-one-click-demo-import
6
*/
7
8
/**
67
return new WP_Error(
68
'url_or_local_file_not_defined',
69
sprintf(
70
+ __( '"import_file_url" or "local_import_file" for %s%s%s are not defined!', 'rara-one-click-demo-import' ),
71
'<strong>',
72
$import_file_info['import_file_name'],
73
'</strong>'
173
return new WP_Error(
174
'url_not_defined',
175
sprintf(
176
+ __( 'URL for %s%s%s file is not defined!', 'rara-one-click-demo-import' ),
177
'<strong>',
178
$file_name,
179
'</strong>'
195
return new WP_Error(
196
'file_fetching_error',
197
sprintf(
198
+ __( 'An error occurred while fetching %s%s%s file from the server!%sReason: %s - %s.', 'rara-one-click-demo-import' ),
199
'<strong>',
200
$file_name,
201
'</strong>',
235
return new WP_Error(
236
'failed_writing_file_to_server',
237
sprintf(
238
+ __( 'An error occurred while writing file to your server! Tried to write a file to: %s%s.', 'rara-one-click-demo-import' ),
239
'<br>',
240
$file_path
241
)
279
return new WP_Error(
280
'failed_writing_file_to_server',
281
sprintf(
282
+ __( 'An error occurred while writing file to your server! Tried to write a file to: %s%s.', 'rara-one-click-demo-import' ),
283
'<br>',
284
$file_path
285
)
314
return new WP_Error(
315
'failed_reading_file_from_server',
316
sprintf(
317
+ __( 'An error occurred while reading a file from your server! Tried reading file from path: %s%s.', 'rara-one-click-demo-import' ),
318
'<br>',
319
$file_path
320
)
338
return new WP_Error(
339
'no_direct_file_access',
340
sprintf(
341
+ __( '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.', 'rara-one-click-demo-import' ),
342
'<strong>',
343
'</strong>',
344
'<a href="http://gregorcapuder.com/wordpress-how-to-set-direct-filesystem-method/" target="_blank">How to set <strong>direct</strong> filesystem method</a>'
349
// Get plugin page settings.
350
$plugin_page_setup = apply_filters( 'rrdi/plugin_page_setup', array(
351
'parent_slug' => 'themes.php',
352
+ 'page_title' => esc_html__( 'Rara One Click Demo Import' , 'rara-one-click-demo-import' ),
353
+ 'menu_title' => esc_html__( 'Rara Demo Import' , 'rara-one-click-demo-import' ),
354
'capability' => 'import',
355
'menu_slug' => 'rara-demo-import',
356
)
362
if ( false === ( $creds = request_filesystem_credentials( $demo_import_page_url, '', false, false, null ) ) ) {
363
return new WP_error(
364
'filesystem_credentials_could_not_be_retrieved',
365
+ __( 'An error occurred while retrieving reading/writing permissions to your server (could not retrieve WP filesystem credentials)!', 'rara-one-click-demo-import' )
366
);
367
}
368
370
if ( ! WP_Filesystem( $creds ) ) {
371
return new WP_Error(
372
'wrong_login_credentials',
373
+ __( 'Your WordPress login credentials don\'t allow to use WP_Filesystem!', 'rara-one-click-demo-import' )
374
);
375
}
376
435
$attachment = array(
436
'guid' => self::get_log_url( $log_path ),
437
'post_mime_type' => $filetype['type'],
438
+ 'post_title' => apply_filters( 'rrdi/attachment_prefix', esc_html__( 'Rara One Click Demo Import - ', 'rara-one-click-demo-import' ) ) . preg_replace( '/\.[^.]+#x2F;', '', basename( $log_path ) ),
439
'post_content' => '',
440
'post_status' => 'inherit',
441
);
471
if ( ! current_user_can( 'import' ) ) {
472
wp_die(
473
sprintf(
474
+ __( '%sYour user role isn\'t high enough. You don\'t have permission to import demo data.%s', 'rara-one-click-demo-import' ),
475
'<div class="notice notice-error"><p>',
476
'</p></div>'
477
)
507
508
// Write error to log file and send an AJAX response with the error.
509
self::log_error_and_send_ajax_response(
510
+ __( 'Please upload XML file for content import. If you want to import widgets or customizer settings only, please use Widget Importer & Exporter or the Customizer Export/Import plugin.', 'rara-one-click-demo-import' ),
511
$log_file_path,
512
+ esc_html__( 'Upload files', 'rara-one-click-demo-import' )
513
);
514
}
515
527
// Add this error to log file.
528
$log_added = self::append_to_file(
529
sprintf(
530
+ __( 'Widget file was not uploaded. Error: %s', 'rara-one-click-demo-import' ),
531
$widget_file_info['error']
532
),
533
$log_file_path,
534
+ esc_html__( 'Upload files' , 'rara-one-click-demo-import' )
535
);
536
}
537
546
// Add this error to log file.
547
$log_added = self::append_to_file(
548
sprintf(
549
+ __( 'Customizer file was not uploaded. Error: %s', 'rara-one-click-demo-import' ),
550
$customizer_file_info['error']
551
),
552
$log_file_path,
553
+ esc_html__( 'Upload files' , 'rara-one-click-demo-import' )
554
);
555
}
556
557
// Add this message to log file.
558
$log_added = self::append_to_file(
559
+ __( 'The import files were successfully uploaded!', 'rara-one-click-demo-import' ) . self::import_file_info( $selected_import_files ),
560
$log_file_path,
561
+ esc_html__( 'Upload files' , 'rara-one-click-demo-import' )
562
);
563
564
// Return array with paths of uploaded files.
574
public static function import_file_info( $selected_import_files ) {
575
return PHP_EOL .
576
sprintf(
577
+ __( 'Initial max execution time = %s', 'rara-one-click-demo-import' ),
578
ini_get( 'max_execution_time' )
579
) . PHP_EOL .
580
sprintf(
581
+ __( 'Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = %4$s%1$sCustomizer file = %5$s', 'rara-one-click-demo-import' ),
582
PHP_EOL,
583
get_site_url(),
584
$selected_import_files['content'],
585
+ empty( $selected_import_files['widgets'] ) ? esc_html__( 'not defined!', 'rara-one-click-demo-import' ) : $selected_import_files['widgets'],
586
+ empty( $selected_import_files['customizer'] ) ? esc_html__( 'not defined!', 'rara-one-click-demo-import' ) : $selected_import_files['customizer']
587
);
588
}
589
includes/class-rrdi-importer.php CHANGED
@@ -2,7 +2,7 @@
2
/**
3
* Class for declaring the importer used in the Rara One Click Demo Import plugin
4
*
5
- * @package rara-demo-import
6
*/
7
8
class RRDI_Importer {
@@ -52,14 +52,14 @@ class RRDI_Importer {
52
}
53
54
/**
55
- * Get all protected variables from the HM_WXR_Importer needed for continuing the import.
56
*/
57
public function get_importer_data() {
58
return $this->importer->get_importer_data();
59
}
60
61
/**
62
- * Sets all protected variables from the HM_WXR_Importer needed for continuing the import.
63
*
64
* @param array $data with set variables.
65
*/
2
/**
3
* Class for declaring the importer used in the Rara One Click Demo Import plugin
4
*
5
+ * @package rara-one-click-demo-import
6
*/
7
8
class RRDI_Importer {
52
}
53
54
/**
55
+ * Get all protected variables from the RDDI_WXR_Importer needed for continuing the import.
56
*/
57
public function get_importer_data() {
58
return $this->importer->get_importer_data();
59
}
60
61
/**
62
+ * Sets all protected variables from the RDDI_WXR_Importer needed for continuing the import.
63
*
64
* @param array $data with set variables.
65
*/
includes/class-rrdi-include-files.php CHANGED
@@ -2,7 +2,7 @@
2
/**
3
* Include files.
4
*
5
- * @package rara-demo-import
6
*/
7
8
/**
2
/**
3
* Include files.
4
*
5
+ * @package rara-one-click-demo-import
6
*/
7
8
/**
includes/class-rrdi-init.php CHANGED
@@ -12,6 +12,7 @@ class RDDI_init
12
13
function rddi_init_version_check()
14
{
15
if ( version_compare( phpversion(), '5.3.2', '<' ) ) {
16
17
/**
@@ -19,7 +20,7 @@ class RDDI_init
19
* Hook it to the 'admin_notices' action.
20
*/
21
function rrdi_old_php_admin_error_notice() {
22
- $message = sprintf( esc_html__( 'The %2$sRara One Click Demo Import%3$s plugin requires %2$sPHP 5.3.2+%3$s to run properly. Please contact your hosting company and ask them to update the PHP version of your site to at least PHP 5.3.2.%4$s Your current version of PHP: %2$s%1$s%3$s', 'rara-demo-import' ), phpversion(), '<strong>', '</strong>', '<br>' );
23
24
printf( '<div class="notice notice-error"><p>%1$s</p></div>', wp_kses_post( $message ) );
25
}
@@ -31,7 +32,7 @@ class RDDI_init
31
require RRDI_PATH . 'includes/class-rrdi-main.php';
32
33
// Instantiate the main plugin class *Singleton*.
34
- $Theme_Demo_Import = RRDI_Theme_Demo_Import::getInstance();
35
}
36
}
37
}
12
13
function rddi_init_version_check()
14
{
15
+
16
if ( version_compare( phpversion(), '5.3.2', '<' ) ) {
17
18
/**
20
* Hook it to the 'admin_notices' action.
21
*/
22
function rrdi_old_php_admin_error_notice() {
23
+ $message = sprintf( esc_html__( 'The %2$sRara One Click Demo Import%3$s plugin requires %2$sPHP 5.3.2+%3$s to run properly. Please contact your hosting company and ask them to update the PHP version of your site to at least PHP 5.3.2.%4$s Your current version of PHP: %2$s%1$s%3$s', 'rara-one-click-demo-import' ), phpversion(), '<strong>', '</strong>', '<br>' );
24
25
printf( '<div class="notice notice-error"><p>%1$s</p></div>', wp_kses_post( $message ) );
26
}
32
require RRDI_PATH . 'includes/class-rrdi-main.php';
33
34
// Instantiate the main plugin class *Singleton*.
35
+ $Theme_Demo_Import = RRDI_Theme_Demo_Import::Instance();
36
}
37
}
38
}
includes/class-rrdi-logger.php CHANGED
@@ -2,14 +2,14 @@
2
/**
3
* Logger class used in the Rara One Click Demo Import plugin
4
*
5
- * @package rara-demo-import
6
*/
7
8
// Include files.
9
require RRDI_PATH . 'includes/extras/class-logger.php';
10
require RRDI_PATH . 'includes/extras/class-logger-cli.php';
11
12
- class RRDI_Logger extends HM_WP_Importer_Logger_CLI {
13
14
/**
15
* Variable for front-end error display.
@@ -17,7 +17,7 @@ class RRDI_Logger extends HM_WP_Importer_Logger_CLI {
17
public $error_output = '';
18
19
/**
20
- * Overwritten log function from HM_WP_Importer_Logger_CLI.
21
*
22
* Logs with an arbitrary level.
23
*
2
/**
3
* Logger class used in the Rara One Click Demo Import plugin
4
*
5
+ * @package rara-one-click-demo-import
6
*/
7
8
// Include files.
9
require RRDI_PATH . 'includes/extras/class-logger.php';
10
require RRDI_PATH . 'includes/extras/class-logger-cli.php';
11
12
+ class RRDI_Logger extends RDDI_WP_Importer_Logger_CLI {
13
14
/**
15
* Variable for front-end error display.
17
public $error_output = '';
18
19
/**
20
+ * Overwritten log function from RDDI_WP_Importer_Logger_CLI.
21
*
22
* Logs with an arbitrary level.
23
*
includes/class-rrdi-main.php CHANGED
@@ -2,7 +2,7 @@
2
/**
3
* Main Rara One Click Demo Import plugin class/file.
4
*
5
- * @package rara-demo-import
6
*/
7
/**
8
* Rara One Click Demo Import class, so we don't have to worry about namespaces.
@@ -25,7 +25,7 @@ class RRDI_Theme_Demo_Import {
25
*
26
* @return Theme_Demo_Import the *Singleton* instance.
27
*/
28
- public static function getInstance() {
29
if ( null === static::$instance ) {
30
static::$instance = new static();
31
}
@@ -44,7 +44,7 @@ class RRDI_Theme_Demo_Import {
44
// Actions.
45
add_action( 'admin_menu', array( $this, 'create_plugin_page' ) );
46
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
47
- add_action( 'wp_ajax_rrdi_import_demo_data', array( $this, 'import_demo_data_ajax_callback' ) );
48
add_action( 'after_setup_theme', array( $this, 'setup_plugin_with_filter_data' ) );
49
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
50
}
@@ -72,8 +72,8 @@ class RRDI_Theme_Demo_Import {
72
public function create_plugin_page() {
73
$plugin_page_setup = apply_filters( 'rrdi/plugin_page_setup', array(
74
'parent_slug' => 'themes.php',
75
- 'page_title' => esc_html__( 'Rara One Click Demo Import' , 'rara-demo-import' ),
76
- 'menu_title' => esc_html__( 'Import Demo Content' , 'rara-demo-import' ),
77
'capability' => 'import',
78
'menu_slug' => 'rara-demo-import',
79
)
@@ -90,20 +90,20 @@ class RRDI_Theme_Demo_Import {
90
?>
91
92
<div class="RRDI__intro-notice notice notice-warning is-dismissible">
93
- <p><?php $msg = __( 'Before you begin, make sure all the required plugins are activated.', 'rara-demo-import' ); echo apply_filters( 'rrdi_before_import_msg', $msg); ?>
94
</p>
95
</div>
96
97
<div class="rrdi wrap about-wrap">
98
99
- <h1><?php esc_html_e( 'Rara One Click Demo Import', 'rara-demo-import' ); ?></h1>
100
101
<?php
102
103
// Display warrning if PHP safe mode is enabled, since we wont be able to change the max_execution_time.
104
if ( ini_get( 'safe_mode' ) ) {
105
printf(
106
- esc_html__( '%sWarning: your server is using %sPHP safe mode%s. This means that you might experience server timeout errors.%s', 'rara-demo-import' ),
107
'<div class="notice notice-warning is-dismissible"><p>',
108
'<strong>',
109
'</strong>',
@@ -118,21 +118,21 @@ class RRDI_Theme_Demo_Import {
118
<div class="RRDI__intro-text">
119
120
<p class="about-description">
121
- <?php esc_html_e( 'Upload your theme’s live demo content and settings with a click. If your theme comes with the demo content bundled with it, just click “Import Now” button. Otherwise, select files to import and click “Import Now”. As simple as that.', 'rara-demo-import' ); ?>
122
</p>
123
124
- <h3><?php esc_html_e( 'The following data will be imported:', 'rara-demo-import' ); ?></h3>
125
126
<ul>
127
- <li><?php esc_html_e( 'Posts', 'rara-demo-import' ); ?></li>
128
- <li><?php esc_html_e( 'Pages', 'rara-demo-import' ); ?></li>
129
- <li><?php esc_html_e( 'Images', 'rara-demo-import' ); ?></li>
130
- <li><?php esc_html_e( 'Widgets', 'rara-demo-import' ); ?></li>
131
- <li><?php esc_html_e( 'Menus', 'rara-demo-import' ); ?></li>
132
- <li><?php esc_html_e( 'Settings', 'rara-demo-import' ); ?></li>
133
</ul>
134
135
- <p><strong><?php esc_html_e( 'NOTE: Your existing content will NOT be deleted or modified.', 'rara-demo-import' ); ?></strong></p>
136
137
<hr>
138
@@ -149,25 +149,25 @@ class RRDI_Theme_Demo_Import {
149
<?php if ( empty( $this->import_files ) ) : ?>
150
151
<div class="notice notice-info is-dismissible">
152
- <p><?php esc_html_e( 'No predefined import files are available in this theme. Please upload the import files manually.', 'rara-demo-import' ); ?></p>
153
</div>
154
155
<div class="RRDI__file-upload-container">
156
157
- <h2><?php esc_html_e( 'Please, select the following files.', 'rara-demo-import' ); ?></h2>
158
159
<div class="RRDI__file-upload">
160
- <h3><label for="content-file-upload"><?php esc_html_e( 'Choose a XML file for content import:', 'rara-demo-import' ); ?></label></h3>
161
<input id="RRDI__content-file-upload" type="file" name="content-file-upload">
162
</div>
163
164
<div class="RRDI__file-upload">
165
- <h3><label for="widget-file-upload"><?php esc_html_e( 'Choose a WIE or JSON file for widget import:', 'rara-demo-import' ); ?></label> <span><?php esc_html_e( '(*optional)', 'rara-demo-import' ); ?></span></h3>
166
<input id="RRDI__widget-file-upload" type="file" name="widget-file-upload">
167
</div>
168
169
<div class="RRDI__file-upload">
170
- <h3><label for="customizer-file-upload"><?php esc_html_e( 'Choose a DAT file for customizer import:', 'rara-demo-import' ); ?></label> <span><?php esc_html_e( '(*optional)', 'rara-demo-import' ); ?></span></h3>
171
<input id="RRDI__customizer-file-upload" type="file" name="customizer-file-upload">
172
</div>
173
@@ -177,7 +177,7 @@ class RRDI_Theme_Demo_Import {
177
178
<div class="RRDI__multi-select-import">
179
180
- <h2><?php esc_html_e( 'Choose which demo you want to import:', 'rara-demo-import' ); ?></h2>
181
182
<select id="RRDI__demo-import-files" class="RRDI__demo-import-files">
183
<?php foreach ( $this->import_files as $index => $import_file ) : ?>
@@ -202,11 +202,11 @@ class RRDI_Theme_Demo_Import {
202
203
<div class="RRDI__demo-import-preview-container">
204
205
- <p><?php esc_html_e( 'Import preview:', 'rara-demo-import' ); ?></p>
206
207
<p class="RRDI__demo-import-preview-image-message js-rrdi-preview-image-message"><?php
208
if ( ! isset( $this->import_files[0]['import_preview_image_url'] ) ) {
209
- esc_html_e( 'No preview image defined for this import.', 'rara-demo-import' );
210
}
211
// Leave the img tag below and the p tag above available for later changes via JS.
212
?></p>
@@ -228,12 +228,12 @@ class RRDI_Theme_Demo_Import {
228
?></div>
229
230
<p class="RRDI__button-container">
231
- <button class="RRDI__button button button-hero button-primary js-rrdi-import-data"><?php esc_html_e( 'Import Now', 'rara-demo-import' ); ?></button>
232
- <span><?php esc_html_e( 'Click the button to beign the importing process. Please be patient, the process might take a few minutes.', 'rara-demo-import' ); ?></span>
233
</p>
234
235
<p class="RRDI__ajax-loader js-rrdi-ajax-loader">
236
- <span class="spinner"></span> <?php esc_html_e( 'Importing now, please wait!', 'rara-demo-import' ); ?>
237
</p>
238
239
<div class="RRDI__response js-rrdi-ajax-response"></div>
@@ -261,7 +261,7 @@ class RRDI_Theme_Demo_Import {
261
'ajax_nonce' => wp_create_nonce( 'rrdi-ajax-verification' ),
262
'import_files' => $this->import_files,
263
'texts' => array(
264
- 'missing_preview_image' => esc_html__( 'No preview image defined for this import.', 'rara-demo-import' ),
265
),
266
)
267
);
@@ -280,7 +280,7 @@ class RRDI_Theme_Demo_Import {
280
* 5. import customizer options (optional)
281
* 6. after import setup (optional)
282
*/
283
- public function import_demo_data_ajax_callback() {
284
285
// Try to update PHP memory limit (so that it does not run out of it).
286
ini_set( 'memory_limit', apply_filters( 'rrdi/import_memory_limit', '350M' ) );
@@ -318,7 +318,7 @@ class RRDI_Theme_Demo_Import {
318
$this->selected_import_files = RRDI_Helpers::process_uploaded_files( $_FILES, $this->log_file_path );
319
320
// Set the name of the import files, because we used the uploaded files.
321
- $this->import_files[ $this->selected_index ]['import_file_name'] = esc_html__( 'Manually uploaded files', 'rara-demo-import' );
322
}
323
elseif ( ! empty( $this->import_files[ $this->selected_index ] ) ) { // Use predefined import files from wp filter: rrdi/import_files.
324
@@ -335,24 +335,24 @@ class RRDI_Theme_Demo_Import {
335
RRDI_Helpers::log_error_and_send_ajax_response(
336
$this->selected_import_files->get_error_message(),
337
$this->log_file_path,
338
- esc_html__( 'Downloaded files', 'rara-demo-import' )
339
);
340
}
341
342
// Add this message to log file.
343
$log_added = RRDI_Helpers::append_to_file(
344
sprintf(
345
- __( 'The import files for: %s were successfully downloaded!', 'rara-demo-import' ),
346
$this->import_files[ $this->selected_index ]['import_file_name']
347
) . RRDI_Helpers::import_file_info( $this->selected_import_files ),
348
$this->log_file_path,
349
- esc_html__( 'Downloaded files' , 'rara-demo-import' )
350
);
351
}
352
else {
353
354
// Send JSON Error response to the AJAX call.
355
- wp_send_json( esc_html__( 'No import files specified!', 'rara-demo-import' ) );
356
}
357
}
358
@@ -399,7 +399,7 @@ class RRDI_Theme_Demo_Import {
399
// Display final messages (success or error messages).
400
if ( empty( $this->frontend_error_messages ) ) {
401
$response['message'] = sprintf(
402
- __( '%1$s%3$sCompleted Successfully!%4$s%2$sThe process has finished. Please check your page and make sure that everything has been imported correctly. If you want, you can now deactivate the %3$sRara One Click Demo Import%4$s plugin.%5$s', 'rara-demo-import' ),
403
'<div class="notice notice-success"><p>',
404
'<br>',
405
'<strong>',
@@ -410,7 +410,7 @@ class RRDI_Theme_Demo_Import {
410
else {
411
$response['message'] = $this->frontend_error_messages . '<br>';
412
$response['message'] .= sprintf(
413
- __( '%1$sUnfortunately, demo import has finished with some errors.%2$sMore details about the errors can be found in this %3$s%5$slog file%6$s%4$s%7$s', 'rara-demo-import' ),
414
'<div class="notice notice-error"><p>',
415
'<br>',
416
'<strong>',
@@ -464,9 +464,9 @@ class RRDI_Theme_Demo_Import {
464
465
// Add this message to log file.
466
$log_added = RRDI_Helpers::append_to_file(
467
- $message . PHP_EOL . esc_html__( 'Max execution time after content import = ' , 'rara-demo-import' ) . ini_get( 'max_execution_time' ),
468
$this->log_file_path,
469
- esc_html__( 'Importing content' , 'rara-demo-import' )
470
);
471
}
472
@@ -505,7 +505,7 @@ class RRDI_Theme_Demo_Import {
505
RRDI_Helpers::log_error_and_send_ajax_response(
506
$results->get_error_message(),
507
$this->log_file_path,
508
- esc_html__( 'Importing widgets', 'rara-demo-import' )
509
);
510
}
511
@@ -517,7 +517,7 @@ class RRDI_Theme_Demo_Import {
517
$log_added = RRDI_Helpers::append_to_file(
518
$message,
519
$this->log_file_path,
520
- esc_html__( 'Importing widgets' , 'rara-demo-import' )
521
);
522
}
523
@@ -539,15 +539,15 @@ class RRDI_Theme_Demo_Import {
539
RRDI_Helpers::log_error_and_send_ajax_response(
540
$results->get_error_message(),
541
$this->log_file_path,
542
- esc_html__( 'Importing customizer settings', 'rara-demo-import' )
543
);
544
}
545
546
// Add this message to log file.
547
$log_added = RRDI_Helpers::append_to_file(
548
- esc_html__( 'Customizer settings import finished!', 'rara-demo-import' ),
549
$this->log_file_path,
550
- esc_html__( 'Importing customizer settings' , 'rara-demo-import' )
551
);
552
}
553
@@ -597,7 +597,7 @@ class RRDI_Theme_Demo_Import {
597
598
// Add message to log file.
599
$log_added = RRDI_Helpers::append_to_file(
600
- __( 'Completed AJAX call number: ' , 'rara-demo-import' ) . $this->ajax_call_number . PHP_EOL . $message,
601
$this->log_file_path,
602
''
603
);
2
/**
3
* Main Rara One Click Demo Import plugin class/file.
4
*
5
+ * @package rara-one-click-demo-import
6
*/
7
/**
8
* Rara One Click Demo Import class, so we don't have to worry about namespaces.
25
*
26
* @return Theme_Demo_Import the *Singleton* instance.
27
*/
28
+ public static function Instance() {
29
if ( null === static::$instance ) {
30
static::$instance = new static();
31
}
44
// Actions.
45
add_action( 'admin_menu', array( $this, 'create_plugin_page' ) );
46
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
47
+ add_action( 'wp_ajax_rrdi_import_demo_data', array( $this, 'rrdi_import_demo_data_ajax_callback' ) );
48
add_action( 'after_setup_theme', array( $this, 'setup_plugin_with_filter_data' ) );
49
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
50
}
72
public function create_plugin_page() {
73
$plugin_page_setup = apply_filters( 'rrdi/plugin_page_setup', array(
74
'parent_slug' => 'themes.php',
75
+ 'page_title' => esc_html__( 'Rara One Click Demo Import' , 'rara-one-click-demo-import' ),
76
+ 'menu_title' => esc_html__( 'Rara Demo Import' , 'rara-one-click-demo-import' ),
77
'capability' => 'import',
78
'menu_slug' => 'rara-demo-import',
79
)
90
?>
91
92
<div class="RRDI__intro-notice notice notice-warning is-dismissible">
93
+ <p><?php $msg = __( 'Before you begin, make sure all the required plugins are activated.', 'rara-one-click-demo-import' ); echo apply_filters( 'rrdi_before_import_msg', $msg); ?>
94
</p>
95
</div>
96
97
<div class="rrdi wrap about-wrap">
98
99
+ <h1><?php esc_html_e( 'Rara One Click Demo Import', 'rara-one-click-demo-import' ); ?></h1>
100
101
<?php
102
103
// Display warrning if PHP safe mode is enabled, since we wont be able to change the max_execution_time.
104
if ( ini_get( 'safe_mode' ) ) {
105
printf(
106
+ esc_html__( '%sWarning: your server is using %sPHP safe mode%s. This means that you might experience server timeout errors.%s', 'rara-one-click-demo-import' ),
107
'<div class="notice notice-warning is-dismissible"><p>',
108
'<strong>',
109
'</strong>',
118
<div class="RRDI__intro-text">
119
120
<p class="about-description">
121
+ <?php $msg = esc_html__( 'Upload your theme’s live demo content and settings with a click. If your theme comes with the demo content bundled with it, just click “Import Now” button. Otherwise, select files to import and click “Import Now”. As simple as that.', 'rara-one-click-demo-import' ); echo apply_filters( 'rrdi_import_instruction',$msg ); ?>
122
</p>
123
124
+ <h3><?php esc_html_e( 'The following data will be imported:', 'rara-one-click-demo-import' ); ?></h3>
125
126
<ul>
127
+ <li><?php esc_html_e( 'Posts', 'rara-one-click-demo-import' ); ?></li>
128
+ <li><?php esc_html_e( 'Pages', 'rara-one-click-demo-import' ); ?></li>
129
+ <li><?php esc_html_e( 'Images', 'rara-one-click-demo-import' ); ?></li>
130
+ <li><?php esc_html_e( 'Widgets', 'rara-one-click-demo-import' ); ?></li>
131
+ <li><?php esc_html_e( 'Menus', 'rara-one-click-demo-import' ); ?></li>
132
+ <li><?php esc_html_e( 'Settings', 'rara-one-click-demo-import' ); ?></li>
133
</ul>
134
135
+ <p><b><?php $msg = __( 'NOTE: Please import the demo content only on fresh WordPress installation. You can reset your WordPress Installation using any reset plugin like WP Reset by WP Dev.','rara-one-click-demo-import' ); echo apply_filters( 'rrdi_fresh_install_instruction',$msg );?></b></p>
136
137
<hr>
138
149
<?php if ( empty( $this->import_files ) ) : ?>
150
151
<div class="notice notice-info is-dismissible">
152
+ <p><?php esc_html_e( 'No predefined import files are available in this theme. Please upload the import files manually.', 'rara-one-click-demo-import' ); ?></p>
153
</div>
154
155
<div class="RRDI__file-upload-container">
156
157
+ <h2><?php esc_html_e( 'Please, select the following files.', 'rara-one-click-demo-import' ); ?></h2>
158
159
<div class="RRDI__file-upload">
160
+ <h3><label for="content-file-upload"><?php esc_html_e( 'Choose a XML file for content import:', 'rara-one-click-demo-import' ); ?></label></h3>
161
<input id="RRDI__content-file-upload" type="file" name="content-file-upload">
162
</div>
163
164
<div class="RRDI__file-upload">
165
+ <h3><label for="widget-file-upload"><?php esc_html_e( 'Choose a WIE or JSON file for widget import:', 'rara-one-click-demo-import' ); ?></label> <span><?php esc_html_e( '(*optional)', 'rara-one-click-demo-import' ); ?></span></h3>
166
<input id="RRDI__widget-file-upload" type="file" name="widget-file-upload">
167
</div>
168
169
<div class="RRDI__file-upload">
170
+ <h3><label for="customizer-file-upload"><?php esc_html_e( 'Choose a DAT file for customizer import:', 'rara-one-click-demo-import' ); ?></label> <span><?php esc_html_e( '(*optional)', 'rara-one-click-demo-import' ); ?></span></h3>
171
<input id="RRDI__customizer-file-upload" type="file" name="customizer-file-upload">
172
</div>
173
177
178
<div class="RRDI__multi-select-import">
179
180
+ <h2><?php esc_html_e( 'Choose which demo you want to import:', 'rara-one-click-demo-import' ); ?></h2>
181
182
<select id="RRDI__demo-import-files" class="RRDI__demo-import-files">
183
<?php foreach ( $this->import_files as $index => $import_file ) : ?>
202
203
<div class="RRDI__demo-import-preview-container">
204
205
+ <p><?php esc_html_e( 'Import preview:', 'rara-one-click-demo-import' ); ?></p>
206
207
<p class="RRDI__demo-import-preview-image-message js-rrdi-preview-image-message"><?php
208
if ( ! isset( $this->import_files[0]['import_preview_image_url'] ) ) {
209
+ esc_html_e( 'No preview image defined for this import.', 'rara-one-click-demo-import' );
210
}
211
// Leave the img tag below and the p tag above available for later changes via JS.
212
?></p>
228
?></div>
229
230
<p class="RRDI__button-container">
231
+ <button class="RRDI__button button button-hero button-primary js-rrdi-import-data"><?php esc_html_e( 'Import Now', 'rara-one-click-demo-import' ); ?></button>
232
+ <span><?php esc_html_e( 'Click the button to beign the importing process. Please be patient, the process might take a few minutes.', 'rara-one-click-demo-import' ); ?></span>
233
</p>
234
235
<p class="RRDI__ajax-loader js-rrdi-ajax-loader">
236
+ <span class="spinner"></span> <?php esc_html_e( 'Importing now, please wait!', 'rara-one-click-demo-import' ); ?>
237
</p>
238
239
<div class="RRDI__response js-rrdi-ajax-response"></div>
261
'ajax_nonce' => wp_create_nonce( 'rrdi-ajax-verification' ),
262
'import_files' => $this->import_files,
263
'texts' => array(
264
+ 'missing_preview_image' => esc_html__( 'No preview image defined for this import.', 'rara-one-click-demo-import' ),
265
),
266
)
267
);
280
* 5. import customizer options (optional)
281
* 6. after import setup (optional)
282
*/
283
+ public function rrdi_import_demo_data_ajax_callback() {
284
285
// Try to update PHP memory limit (so that it does not run out of it).
286
ini_set( 'memory_limit', apply_filters( 'rrdi/import_memory_limit', '350M' ) );
318
$this->selected_import_files = RRDI_Helpers::process_uploaded_files( $_FILES, $this->log_file_path );
319
320
// Set the name of the import files, because we used the uploaded files.
321
+ $this->import_files[ $this->selected_index ]['import_file_name'] = esc_html__( 'Manually uploaded files', 'rara-one-click-demo-import' );
322
}
323
elseif ( ! empty( $this->import_files[ $this->selected_index ] ) ) { // Use predefined import files from wp filter: rrdi/import_files.
324
335
RRDI_Helpers::log_error_and_send_ajax_response(
336
$this->selected_import_files->get_error_message(),
337
$this->log_file_path,
338
+ esc_html__( 'Downloaded files', 'rara-one-click-demo-import' )
339
);
340
}
341
342
// Add this message to log file.
343
$log_added = RRDI_Helpers::append_to_file(
344
sprintf(
345
+ __( 'The import files for: %s were successfully downloaded!', 'rara-one-click-demo-import' ),
346
$this->import_files[ $this->selected_index ]['import_file_name']
347
) . RRDI_Helpers::import_file_info( $this->selected_import_files ),
348
$this->log_file_path,
349
+ esc_html__( 'Downloaded files' , 'rara-one-click-demo-import' )
350
);
351
}
352
else {
353
354
// Send JSON Error response to the AJAX call.
355
+ wp_send_json( esc_html__( 'No import files specified!', 'rara-one-click-demo-import' ) );
356
}
357
}
358
399
// Display final messages (success or error messages).
400
if ( empty( $this->frontend_error_messages ) ) {
401
$response['message'] = sprintf(
402
+ __( '%1$s%3$sCompleted Successfully!%4$s%2$sThe process has finished. Please check your page and make sure that everything has been imported correctly. If you want, you can now deactivate the %3$sRara One Click Demo Import%4$s plugin.%5$s', 'rara-one-click-demo-import' ),
403
'<div class="notice notice-success"><p>',
404
'<br>',
405
'<strong>',
410
else {
411
$response['message'] = $this->frontend_error_messages . '<br>';
412
$response['message'] .= sprintf(
413
+ __( '%1$sUnfortunately, demo import has finished with some errors.%2$sMore details about the errors can be found in this %3$s%5$slog file%6$s%4$s%7$s', 'rara-one-click-demo-import' ),
414
'<div class="notice notice-error"><p>',
415
'<br>',
416
'<strong>',
464
465
// Add this message to log file.
466
$log_added = RRDI_Helpers::append_to_file(
467
+ $message . PHP_EOL . esc_html__( 'Max execution time after content import = ' , 'rara-one-click-demo-import' ) . ini_get( 'max_execution_time' ),
468
$this->log_file_path,
469
+ esc_html__( 'Importing content' , 'rara-one-click-demo-import' )
470
);
471
}
472
505
RRDI_Helpers::log_error_and_send_ajax_response(
506
$results->get_error_message(),
507
$this->log_file_path,
508
+ esc_html__( 'Importing widgets', 'rara-one-click-demo-import' )
509
);
510
}
511
517
$log_added = RRDI_Helpers::append_to_file(
518
$message,
519
$this->log_file_path,
520
+ esc_html__( 'Importing widgets' , 'rara-one-click-demo-import' )
521
);
522
}
523
539
RRDI_Helpers::log_error_and_send_ajax_response(
540
$results->get_error_message(),
541
$this->log_file_path,
542
+ esc_html__( 'Importing customizer settings', 'rara-one-click-demo-import' )
543
);
544
}
545
546
// Add this message to log file.
547
$log_added = RRDI_Helpers::append_to_file(
548
+ esc_html__( 'Customizer settings import finished!', 'rara-one-click-demo-import' ),
549
$this->log_file_path,
550
+ esc_html__( 'Importing customizer settings' , 'rara-one-click-demo-import' )
551
);
552
}
553
597
598
// Add message to log file.
599
$log_added = RRDI_Helpers::append_to_file(
600
+ __( 'Completed AJAX call number: ' , 'rara-one-click-demo-import' ) . $this->ajax_call_number . PHP_EOL . $message,
601
$this->log_file_path,
602
''
603
);
includes/class-rrdi-wxr-importer.php CHANGED
@@ -1,16 +1,16 @@
1
<?php
2
/**
3
* WXR importer class used in the Rara One Click Demo Import plugin.
4
- * Needed to extend the HM_WXR_Importer class to get/set the importer protected variables,
5
* for use in the multiple AJAX calls.
6
*
7
- * @package rara-demo-import
8
*/
9
10
// Include files.
11
require RRDI_PATH . 'includes/extras/class-wxr-importer.php';
12
13
- class RRDI_WXR_Importer extends HM_WXR_Importer {
14
15
public function __construct( $options = array() ) {
16
parent::__construct( $options );
@@ -22,7 +22,7 @@ class RRDI_WXR_Importer extends HM_WXR_Importer {
22
}
23
24
/**
25
- * Get all protected variables from the HM_WXR_Importer needed for continuing the import.
26
*/
27
public function get_importer_data() {
28
return array(
@@ -36,7 +36,7 @@ class RRDI_WXR_Importer extends HM_WXR_Importer {
36
}
37
38
/**
39
- * Sets all protected variables from the HM_WXR_Importer needed for continuing the import.
40
*
41
* @param array $data with set variables.
42
*/
1
<?php
2
/**
3
* WXR importer class used in the Rara One Click Demo Import plugin.
4
+ * Needed to extend the RDDI_WXR_Importer class to get/set the importer protected variables,
5
* for use in the multiple AJAX calls.
6
*
7
+ * @package rara-one-click-demo-import
8
*/
9
10
// Include files.
11
require RRDI_PATH . 'includes/extras/class-wxr-importer.php';
12
13
+ class RRDI_WXR_Importer extends RDDI_WXR_Importer {
14
15
public function __construct( $options = array() ) {
16
parent::__construct( $options );
22
}
23
24
/**
25
+ * Get all protected variables from the RDDI_WXR_Importer needed for continuing the import.
26
*/
27
public function get_importer_data() {
28
return array(
36
}
37
38
/**
39
+ * Sets all protected variables from the RDDI_WXR_Importer needed for continuing the import.
40
*
41
* @param array $data with set variables.
42
*/
includes/extras/class-logger-cli.php CHANGED
@@ -1,6 +1,6 @@
1
<?php
2
3
- class HM_WP_Importer_Logger_CLI extends HM_WP_Importer_Logger {
4
public $min_level = 'notice';
5
6
/**
1
<?php
2
3
+ class RDDI_WP_Importer_Logger_CLI extends RDDI_WP_Importer_Logger {
4
public $min_level = 'notice';
5
6
/**
includes/extras/class-logger.php CHANGED
@@ -17,7 +17,7 @@
17
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
18
* for the full interface specification.
19
*/
20
- class HM_WP_Importer_Logger {
21
/**
22
* System is unusable.
23
*
17
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
18
* for the full interface specification.
19
*/
20
+ class RDDI_WP_Importer_Logger {
21
/**
22
* System is unusable.
23
*
includes/extras/class-wxr-importer.php CHANGED
@@ -1,6 +1,6 @@
1
<?php
2
3
- class HM_WXR_Importer {
4
/**
5
* Maximum supported WXR version
6
*/
@@ -59,7 +59,7 @@ class HM_WXR_Importer {
59
/**
60
* Logger instance.
61
*
62
- * @var HM_WP_Importer_Logger
63
*/
64
protected $logger;
65
@@ -127,7 +127,7 @@ class HM_WXR_Importer {
127
}
128
129
if ( ! $status ) {
130
- return new WP_Error( 'wxr_importer.cannot_parse', __( 'Could not open the file for parsing', 'rara-demo-import' ) );
131
}
132
133
return $reader;
@@ -163,7 +163,7 @@ class HM_WXR_Importer {
163
164
if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
165
$this->logger->warning( sprintf(
166
- __( 'This WXR file (version %s) is newer than the importer (version %s) and may not be supported. Please consider updating.', 'rara-demo-import' ),
167
$this->version,
168
self::MAX_WXR_VERSION
169
) );
@@ -279,7 +279,7 @@ class HM_WXR_Importer {
279
280
if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
281
$this->logger->warning( sprintf(
282
- __( 'This WXR file (version %s) is newer than the importer (version %s) and may not be supported. Please consider updating.', 'rara-demo-import' ),
283
$this->version,
284
self::MAX_WXR_VERSION
285
) );
@@ -352,7 +352,7 @@ class HM_WXR_Importer {
352
353
if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
354
$this->logger->warning( sprintf(
355
- __( 'This WXR file (version %s) is newer than the importer (version %s) and may not be supported. Please consider updating.', 'rara-demo-import' ),
356
$this->version,
357
self::MAX_WXR_VERSION
358
) );
@@ -501,7 +501,7 @@ class HM_WXR_Importer {
501
*/
502
protected function import_start( $file ) {
503
if ( ! is_file( $file ) ) {
504
- return new WP_Error( 'wxr_importer.file_missing', __( 'The file does not exist, please try again.', 'rara-demo-import' ) );
505
}
506
507
// Suspend bunches of stuff in WP core
@@ -561,7 +561,7 @@ class HM_WXR_Importer {
561
public function set_user_mapping( $mapping ) {
562
foreach ( $mapping as $map ) {
563
if ( empty( $map['old_slug'] ) || empty( $map['old_id'] ) || empty( $map['new_id'] ) ) {
564
- $this->logger->warning( __( 'Invalid author mapping', 'rara-demo-import' ) );
565
$this->logger->debug( var_export( $map, true ) );
566
continue;
567
}
@@ -662,7 +662,7 @@ class HM_WXR_Importer {
662
// Bail now
663
return new WP_Error(
664
'wxr_importer.post.cannot_import_draft',
665
- __( 'Cannot import auto-draft posts' ),
666
$data
667
);
668
}
@@ -750,7 +750,7 @@ class HM_WXR_Importer {
750
// Is this type even valid?
751
if ( ! $post_type_object ) {
752
$this->logger->warning( sprintf(
753
- __( 'Failed to import "%s": Invalid post type %s', 'rara-demo-import' ),
754
$data['post_title'],
755
$data['post_type']
756
) );
@@ -760,7 +760,7 @@ class HM_WXR_Importer {
760
$post_exists = $this->post_exists( $data );
761
if ( $post_exists ) {
762
$this->logger->info( sprintf(
763
- __( '%s "%s" already exists.', 'rara-demo-import' ),
764
$post_type_object->labels->singular_name,
765
$data['post_title']
766
) );
@@ -838,7 +838,7 @@ class HM_WXR_Importer {
838
if ( 'attachment' === $postdata['post_type'] ) {
839
if ( ! $this->options['fetch_attachments'] ) {
840
$this->logger->notice( sprintf(
841
- __( 'Skipping attachment "%s", fetching attachments disabled' ),
842
$data['post_title']
843
) );
844
return false;
@@ -852,7 +852,7 @@ class HM_WXR_Importer {
852
853
if ( is_wp_error( $post_id ) ) {
854
$this->logger->error( sprintf(
855
- __( 'Failed to import "%s" (%s)', 'rara-demo-import' ),
856
$data['post_title'],
857
$post_type_object->labels->singular_name
858
) );
@@ -884,12 +884,12 @@ class HM_WXR_Importer {
884
$this->mark_post_exists( $data, $post_id );
885
886
$this->logger->info( sprintf(
887
- __( 'Imported "%s" (%s)', 'rara-demo-import' ),
888
$data['post_title'],
889
$post_type_object->labels->singular_name
890
) );
891
$this->logger->debug( sprintf(
892
- __( 'Post %d remapped to %d', 'rara-demo-import' ),
893
$original_id,
894
$post_id
895
) );
@@ -1033,7 +1033,7 @@ class HM_WXR_Importer {
1033
1034
$info = wp_check_filetype( $upload['file'] );
1035
if ( ! $info ) {
1036
- return new WP_Error( 'attachment_processing_error', __( 'Invalid file type', 'rara-demo-import' ) );
1037
}
1038
1039
$post['post_mime_type'] = $info['type'];
@@ -1516,7 +1516,7 @@ class HM_WXR_Importer {
1516
$user_id = wp_insert_user( wp_slash( $userdata ) );
1517
if ( is_wp_error( $user_id ) ) {
1518
$this->logger->error( sprintf(
1519
- __( 'Failed to import user "%s"', 'rara-demo-import' ),
1520
$userdata['user_login']
1521
) );
1522
$this->logger->debug( $user_id->get_error_message() );
@@ -1537,11 +1537,11 @@ class HM_WXR_Importer {
1537
$this->mapping['user_slug'][ $original_slug ] = $user_id;
1538
1539
$this->logger->info( sprintf(
1540
- __( 'Imported user "%s"', 'rara-demo-import' ),
1541
$userdata['user_login']
1542
) );
1543
$this->logger->debug( sprintf(
1544
- __( 'User %d remapped to %d', 'rara-demo-import' ),
1545
$original_id,
1546
$user_id
1547
) );
@@ -1678,7 +1678,7 @@ class HM_WXR_Importer {
1678
$result = wp_insert_term( $data['name'], $data['taxonomy'], $termdata );
1679
if ( is_wp_error( $result ) ) {
1680
$this->logger->warning( sprintf(
1681
- __( 'Failed to import %s %s', 'rara-demo-import' ),
1682
$data['taxonomy'],
1683
$data['name']
1684
) );
@@ -1702,12 +1702,12 @@ class HM_WXR_Importer {
1702
$this->mapping['term_id'][ $original_id ] = $term_id;
1703
1704
$this->logger->info( sprintf(
1705
- __( 'Imported "%s" (%s)', 'rara-demo-import' ),
1706
$data['name'],
1707
$data['taxonomy']
1708
) );
1709
$this->logger->debug( sprintf(
1710
- __( 'Term %d remapped to %d', 'rara-demo-import' ),
1711
$original_id,
1712
$term_id
1713
) );
@@ -1760,7 +1760,7 @@ class HM_WXR_Importer {
1760
return new WP_Error(
1761
'import_file_error',
1762
sprintf(
1763
- __( 'Remote server returned %1$d %2$s for %3$s', 'rara-demo-import' ),
1764
$code,
1765
get_status_header_desc( $code ),
1766
$url
@@ -1773,18 +1773,18 @@ class HM_WXR_Importer {
1773
1774
if ( isset( $headers['content-length'] ) && $filesize !== (int) $headers['content-length'] ) {
1775
unlink( $upload['file'] );
1776
- return new WP_Error( 'import_file_error', __( 'Remote file is incorrect size', 'rara-demo-import' ) );
1777
}
1778
1779
if ( 0 === $filesize ) {
1780
unlink( $upload['file'] );
1781
- return new WP_Error( 'import_file_error', __( 'Zero size file downloaded', 'rara-demo-import' ) );
1782
}
1783
1784
$max_size = (int) $this->max_attachment_size();
1785
if ( ! empty( $max_size ) && $filesize > $max_size ) {
1786
unlink( $upload['file'] );
1787
- $message = sprintf( __( 'Remote file is too large, limit is %s', 'rara-demo-import' ), size_format( $max_size ) );
1788
return new WP_Error( 'import_file_error', $message );
1789
}
1790
@@ -1806,7 +1806,7 @@ class HM_WXR_Importer {
1806
$this->logger->debug( sprintf(
1807
// Note: title intentionally not used to skip extra processing
1808
// for when debug logging is off
1809
- __( 'Running post-processing for post %d', 'rara-demo-import' ),
1810
$post_id
1811
) );
1812
@@ -1819,12 +1819,12 @@ class HM_WXR_Importer {
1819
$data['post_parent'] = $this->mapping['post'][ $parent_id ];
1820
} else {
1821
$this->logger->warning( sprintf(
1822
- __( 'Could not find the post parent for "%s" (post #%d)', 'rara-demo-import' ),
1823
get_the_title( $post_id ),
1824
$post_id
1825
) );
1826
$this->logger->debug( sprintf(
1827
- __( 'Post %d was imported with parent %d, but could not be found', 'rara-demo-import' ),
1828
$post_id,
1829
$parent_id
1830
) );
@@ -1838,12 +1838,12 @@ class HM_WXR_Importer {
1838
$data['post_author'] = $this->mapping['user_slug'][ $author_slug ];
1839
} else {
1840
$this->logger->warning( sprintf(
1841
- __( 'Could not find the author for "%s" (post #%d)', 'rara-demo-import' ),
1842
get_the_title( $post_id ),
1843
$post_id
1844
) );
1845
$this->logger->debug( sprintf(
1846
- __( 'Post %d was imported with author "%s", but could not be found', 'rara-demo-import' ),
1847
$post_id,
1848
$author_slug
1849
) );
@@ -1869,7 +1869,7 @@ class HM_WXR_Importer {
1869
// Do we have updates to make?
1870
if ( empty( $data ) ) {
1871
$this->logger->debug( sprintf(
1872
- __( 'Post %d was marked for post-processing, but none was required.', 'rara-demo-import' ),
1873
$post_id
1874
) );
1875
continue;
@@ -1880,7 +1880,7 @@ class HM_WXR_Importer {
1880
$result = wp_update_post( $data, true );
1881
if ( is_wp_error( $result ) ) {
1882
$this->logger->warning( sprintf(
1883
- __( 'Could not update "%s" (post #%d) with mapped data', 'rara-demo-import' ),
1884
get_the_title( $post_id ),
1885
$post_id
1886
) );
@@ -1925,12 +1925,12 @@ class HM_WXR_Importer {
1925
update_post_meta( $post_id, '_menu_item_object_id', wp_slash( $menu_object ) );
1926
} else {
1927
$this->logger->warning( sprintf(
1928
- __( 'Could not find the menu object for "%s" (post #%d)', 'rara-demo-import' ),
1929
get_the_title( $post_id ),
1930
$post_id
1931
) );
1932
$this->logger->debug( sprintf(
1933
- __( 'Post %d was imported with object "%d" of type "%s", but could not be found', 'rara-demo-import' ),
1934
$post_id,
1935
$menu_object_id,
1936
$menu_item_type
@@ -1952,11 +1952,11 @@ class HM_WXR_Importer {
1952
$data['comment_parent'] = $this->mapping['comment'][ $parent_id ];
1953
} else {
1954
$this->logger->warning( sprintf(
1955
- __( 'Could not find the comment parent for comment #%d', 'rara-demo-import' ),
1956
$comment_id
1957
) );
1958
$this->logger->debug( sprintf(
1959
- __( 'Comment %d was imported with parent %d, but could not be found', 'rara-demo-import' ),
1960
$comment_id,
1961
$parent_id
1962
) );
@@ -1970,11 +1970,11 @@ class HM_WXR_Importer {
1970
$data['user_id'] = $this->mapping['user'][ $author_id ];
1971
} else {
1972
$this->logger->warning( sprintf(
1973
- __( 'Could not find the author for comment #%d', 'rara-demo-import' ),
1974
$comment_id
1975
) );
1976
$this->logger->debug( sprintf(
1977
- __( 'Comment %d was imported with author %d, but could not be found', 'rara-demo-import' ),
1978
$comment_id,
1979
$author_id
1980
) );
@@ -1991,7 +1991,7 @@ class HM_WXR_Importer {
1991
$result = wp_update_comment( wp_slash( $data ) );
1992
if ( empty( $result ) ) {
1993
$this->logger->warning( sprintf(
1994
- __( 'Could not update comment #%d with mapped data', 'rara-demo-import' ),
1995
$comment_id
1996
) );
1997
continue;
1
<?php
2
3
+ class RDDI_WXR_Importer {
4
/**
5
* Maximum supported WXR version
6
*/
59
/**
60
* Logger instance.
61
*
62
+ * @var RDDI_WP_Importer_Logger
63
*/
64
protected $logger;
65
127
}
128
129
if ( ! $status ) {
130
+ return new WP_Error( 'wxr_importer.cannot_parse', __( 'Could not open the file for parsing', 'rara-one-click-demo-import' ) );
131
}
132
133
return $reader;
163
164
if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
165
$this->logger->warning( sprintf(
166
+ __( 'This WXR file (version %s) is newer than the importer (version %s) and may not be supported. Please consider updating.', 'rara-one-click-demo-import' ),
167
$this->version,
168
self::MAX_WXR_VERSION
169
) );
279
280
if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
281
$this->logger->warning( sprintf(
282
+ __( 'This WXR file (version %s) is newer than the importer (version %s) and may not be supported. Please consider updating.', 'rara-one-click-demo-import' ),
283
$this->version,
284
self::MAX_WXR_VERSION
285
) );
352
353
if ( version_compare( $this->version, self::MAX_WXR_VERSION, '>' ) ) {
354
$this->logger->warning( sprintf(
355
+ __( 'This WXR file (version %s) is newer than the importer (version %s) and may not be supported. Please consider updating.', 'rara-one-click-demo-import' ),
356
$this->version,
357
self::MAX_WXR_VERSION
358
) );
501
*/
502
protected function import_start( $file ) {
503
if ( ! is_file( $file ) ) {
504
+ return new WP_Error( 'wxr_importer.file_missing', __( 'The file does not exist, please try again.', 'rara-one-click-demo-import' ) );
505
}
506
507
// Suspend bunches of stuff in WP core
561
public function set_user_mapping( $mapping ) {
562
foreach ( $mapping as $map ) {
563
if ( empty( $map['old_slug'] ) || empty( $map['old_id'] ) || empty( $map['new_id'] ) ) {
564
+ $this->logger->warning( __( 'Invalid author mapping', 'rara-one-click-demo-import' ) );
565
$this->logger->debug( var_export( $map, true ) );
566
continue;
567
}
662
// Bail now
663
return new WP_Error(
664
'wxr_importer.post.cannot_import_draft',
665
+ __( 'Cannot import auto-draft posts','rara-one-click-demo-import' ),
666
$data
667
);
668
}
750
// Is this type even valid?
751
if ( ! $post_type_object ) {
752
$this->logger->warning( sprintf(
753
+ __( 'Failed to import "%s": Invalid post type %s', 'rara-one-click-demo-import' ),
754
$data['post_title'],
755
$data['post_type']
756
) );
760
$post_exists = $this->post_exists( $data );
761
if ( $post_exists ) {
762
$this->logger->info( sprintf(
763
+ __( '%s "%s" already exists.', 'rara-one-click-demo-import' ),
764
$post_type_object->labels->singular_name,
765
$data['post_title']
766
) );
838
if ( 'attachment' === $postdata['post_type'] ) {
839
if ( ! $this->options['fetch_attachments'] ) {
840
$this->logger->notice( sprintf(
841
+ __( 'Skipping attachment "%s", fetching attachments disabled','rara-one-click-demo-import' ),
842
$data['post_title']
843
) );
844
return false;
852
853
if ( is_wp_error( $post_id ) ) {
854
$this->logger->error( sprintf(
855
+ __( 'Failed to import "%s" (%s)', 'rara-one-click-demo-import' ),
856
$data['post_title'],
857
$post_type_object->labels->singular_name
858
) );
884
$this->mark_post_exists( $data, $post_id );
885
886
$this->logger->info( sprintf(
887
+ __( 'Imported "%s" (%s)', 'rara-one-click-demo-import' ),
888
$data['post_title'],
889
$post_type_object->labels->singular_name
890
) );
891
$this->logger->debug( sprintf(
892
+ __( 'Post %d remapped to %d', 'rara-one-click-demo-import' ),
893
$original_id,
894
$post_id
895
) );
1033
1034
$info = wp_check_filetype( $upload['file'] );
1035
if ( ! $info ) {
1036
+ return new WP_Error( 'attachment_processing_error', __( 'Invalid file type', 'rara-one-click-demo-import' ) );
1037
}
1038
1039
$post['post_mime_type'] = $info['type'];
1516
$user_id = wp_insert_user( wp_slash( $userdata ) );
1517
if ( is_wp_error( $user_id ) ) {
1518
$this->logger->error( sprintf(
1519
+ __( 'Failed to import user "%s"', 'rara-one-click-demo-import' ),
1520
$userdata['user_login']
1521
) );
1522
$this->logger->debug( $user_id->get_error_message() );
1537
$this->mapping['user_slug'][ $original_slug ] = $user_id;
1538
1539
$this->logger->info( sprintf(
1540
+ __( 'Imported user "%s"', 'rara-one-click-demo-import' ),
1541
$userdata['user_login']
1542
) );
1543
$this->logger->debug( sprintf(
1544
+ __( 'User %d remapped to %d', 'rara-one-click-demo-import' ),
1545
$original_id,
1546
$user_id
1547
) );
1678
$result = wp_insert_term( $data['name'], $data['taxonomy'], $termdata );
1679
if ( is_wp_error( $result ) ) {
1680
$this->logger->warning( sprintf(
1681
+ __( 'Failed to import %s %s', 'rara-one-click-demo-import' ),
1682
$data['taxonomy'],
1683
$data['name']
1684
) );
1702
$this->mapping['term_id'][ $original_id ] = $term_id;
1703
1704
$this->logger->info( sprintf(
1705
+ __( 'Imported "%s" (%s)', 'rara-one-click-demo-import' ),
1706
$data['name'],
1707
$data['taxonomy']
1708
) );
1709
$this->logger->debug( sprintf(
1710
+ __( 'Term %d remapped to %d', 'rara-one-click-demo-import' ),
1711
$original_id,
1712
$term_id
1713
) );
1760
return new WP_Error(
1761
'import_file_error',
1762
sprintf(
1763
+ __( 'Remote server returned %1$d %2$s for %3$s', 'rara-one-click-demo-import' ),
1764
$code,
1765
get_status_header_desc( $code ),
1766
$url
1773
1774
if ( isset( $headers['content-length'] ) && $filesize !== (int) $headers['content-length'] ) {
1775
unlink( $upload['file'] );
1776
+ return new WP_Error( 'import_file_error', __( 'Remote file is incorrect size', 'rara-one-click-demo-import' ) );
1777
}
1778
1779
if ( 0 === $filesize ) {
1780
unlink( $upload['file'] );
1781
+ return new WP_Error( 'import_file_error', __( 'Zero size file downloaded', 'rara-one-click-demo-import' ) );
1782
}
1783
1784
$max_size = (int) $this->max_attachment_size();
1785
if ( ! empty( $max_size ) && $filesize > $max_size ) {
1786
unlink( $upload['file'] );
1787
+ $message = sprintf( __( 'Remote file is too large, limit is %s', 'rara-one-click-demo-import' ), size_format( $max_size ) );
1788
return new WP_Error( 'import_file_error', $message );
1789
}
1790
1806
$this->logger->debug( sprintf(
1807
// Note: title intentionally not used to skip extra processing
1808
// for when debug logging is off
1809
+ __( 'Running post-processing for post %d', 'rara-one-click-demo-import' ),
1810
$post_id
1811
) );
1812
1819
$data['post_parent'] = $this->mapping['post'][ $parent_id ];
1820
} else {
1821
$this->logger->warning( sprintf(
1822
+ __( 'Could not find the post parent for "%s" (post #%d)', 'rara-one-click-demo-import' ),
1823
get_the_title( $post_id ),
1824
$post_id
1825
) );
1826
$this->logger->debug( sprintf(
1827
+ __( 'Post %d was imported with parent %d, but could not be found', 'rara-one-click-demo-import' ),
1828
$post_id,
1829
$parent_id
1830
) );
1838
$data['post_author'] = $this->mapping['user_slug'][ $author_slug ];
1839
} else {
1840
$this->logger->warning( sprintf(
1841
+ __( 'Could not find the author for "%s" (post #%d)', 'rara-one-click-demo-import' ),
1842
get_the_title( $post_id ),
1843
$post_id
1844
) );
1845
$this->logger->debug( sprintf(
1846
+ __( 'Post %d was imported with author "%s", but could not be found', 'rara-one-click-demo-import' ),
1847
$post_id,
1848
$author_slug
1849
) );
1869
// Do we have updates to make?
1870
if ( empty( $data ) ) {
1871
$this->logger->debug( sprintf(
1872
+ __( 'Post %d was marked for post-processing, but none was required.', 'rara-one-click-demo-import' ),
1873
$post_id
1874
) );
1875
continue;
1880
$result = wp_update_post( $data, true );
1881
if ( is_wp_error( $result ) ) {
1882
$this->logger->warning( sprintf(
1883
+ __( 'Could not update "%s" (post #%d) with mapped data', 'rara-one-click-demo-import' ),
1884
get_the_title( $post_id ),
1885
$post_id
1886
) );
1925
update_post_meta( $post_id, '_menu_item_object_id', wp_slash( $menu_object ) );
1926
} else {
1927
$this->logger->warning( sprintf(
1928
+ __( 'Could not find the menu object for "%s" (post #%d)', 'rara-one-click-demo-import' ),
1929
get_the_title( $post_id ),
1930
$post_id
1931
) );
1932
$this->logger->debug( sprintf(
1933
+ __( 'Post %d was imported with object "%d" of type "%s", but could not be found', 'rara-one-click-demo-import' ),
1934
$post_id,
1935
$menu_object_id,
1936
$menu_item_type
1952
$data['comment_parent'] = $this->mapping['comment'][ $parent_id ];
1953
} else {
1954
$this->logger->warning( sprintf(
1955
+ __( 'Could not find the comment parent for comment #%d', 'rara-one-click-demo-import' ),
1956
$comment_id
1957
) );
1958
$this->logger->debug( sprintf(
1959
+ __( 'Comment %d was imported with parent %d, but could not be found', 'rara-one-click-demo-import' ),
1960
$comment_id,
1961
$parent_id
1962
) );
1970
$data['user_id'] = $this->mapping['user'][ $author_id ];
1971
} else {
1972
$this->logger->warning( sprintf(
1973
+ __( 'Could not find the author for comment #%d', 'rara-one-click-demo-import' ),
1974
$comment_id
1975
) );
1976
$this->logger->debug( sprintf(
1977
+ __( 'Comment %d was imported with author %d, but could not be found', 'rara-one-click-demo-import' ),
1978
$comment_id,
1979
$author_id
1980
) );
1991
$result = wp_update_comment( wp_slash( $data ) );
1992
if ( empty( $result ) ) {
1993
$this->logger->warning( sprintf(
1994
+ __( 'Could not update comment #%d with mapped data', 'rara-one-click-demo-import' ),
1995
$comment_id
1996
) );
1997
continue;
includes/vendor/class-rrdi-customizer-importer.php CHANGED
@@ -5,7 +5,7 @@
5
* Code is mostly from the Customizer Export/Import plugin.
6
*
7
* @see https://wordpress.org/plugins/customizer-export-import/
8
- * @package rara-demo-import
9
*/
10
11
class RRDI_Customizer_Importer {
@@ -16,7 +16,7 @@ class RRDI_Customizer_Importer {
16
*
17
* Update: WP core customize_save actions were removed, because of some errors.
18
*
19
- * @since 1.1.1
20
* @param string $import_file_path Path to the import file.
21
* @return void|WP_Error
22
*/
@@ -33,7 +33,7 @@ class RRDI_Customizer_Importer {
33
return new WP_Error(
34
'missing_cutomizer_import_file',
35
sprintf(
36
- esc_html__( 'The customizer import file is missing! File path: %s', 'rara-demo-import' ),
37
$import_file_path
38
)
39
);
@@ -53,13 +53,13 @@ class RRDI_Customizer_Importer {
53
if ( ! is_array( $data ) && ( ! isset( $data['template'] ) || ! isset( $data['mods'] ) ) ) {
54
return new WP_Error(
55
'customizer_import_data_error',
56
- esc_html__( 'No correct file format. Please make sure to use the correct customizer import file.', 'rara-demo-import' )
57
);
58
}
59
if ( $data['template'] !== $template ) {
60
return new WP_Error(
61
'customizer_import_wrong_theme',
62
- esc_html__( 'The customizer import file is not suitable for current theme. You can only import customizer settings for the same theme or a child theme.', 'rara-demo-import' )
63
);
64
}
65
@@ -99,7 +99,7 @@ class RRDI_Customizer_Importer {
99
/**
100
* Helper function: Customizer import - imports images for settings saved as mods.
101
*
102
- * @since 1.1.1
103
* @param array $mods An array of customizer mods.
104
* @return array The mods array with any new import data.
105
*/
@@ -127,7 +127,7 @@ class RRDI_Customizer_Importer {
127
* Taken from the core media_sideload_image function and
128
* modified to return an array of data instead of html.
129
*
130
- * @since 1.1.1.
131
* @param string $file The image file path.
132
* @return array An array of image data.
133
*/
@@ -178,7 +178,7 @@ class RRDI_Customizer_Importer {
178
/**
179
* Checks to see whether a string is an image url or not.
180
*
181
- * @since 1.1.1
182
* @param string $string The string to check.
183
* @return bool Whether the string is an image url or not.
184
*/
5
* Code is mostly from the Customizer Export/Import plugin.
6
*
7
* @see https://wordpress.org/plugins/customizer-export-import/
8
+ * @package rara-one-click-demo-import
9
*/
10
11
class RRDI_Customizer_Importer {
16
*
17
* Update: WP core customize_save actions were removed, because of some errors.
18
*
19
+ * @since 1.0.1
20
* @param string $import_file_path Path to the import file.
21
* @return void|WP_Error
22
*/
33
return new WP_Error(
34
'missing_cutomizer_import_file',
35
sprintf(
36
+ esc_html__( 'The customizer import file is missing! File path: %s', 'rara-one-click-demo-import' ),
37
$import_file_path
38
)
39
);
53
if ( ! is_array( $data ) && ( ! isset( $data['template'] ) || ! isset( $data['mods'] ) ) ) {
54
return new WP_Error(
55
'customizer_import_data_error',
56
+ esc_html__( 'No correct file format. Please make sure to use the correct customizer import file.', 'rara-one-click-demo-import' )
57
);
58
}
59
if ( $data['template'] !== $template ) {
60
return new WP_Error(
61
'customizer_import_wrong_theme',
62
+ esc_html__( 'The customizer import file is not suitable for current theme. You can only import customizer settings for the same theme or a child theme.', 'rara-one-click-demo-import' )
63
);
64
}
65
99
/**
100
* Helper function: Customizer import - imports images for settings saved as mods.
101
*
102
+ * @since 1.0.1
103
* @param array $mods An array of customizer mods.
104
* @return array The mods array with any new import data.
105
*/
127
* Taken from the core media_sideload_image function and
128
* modified to return an array of data instead of html.
129
*
130
+ * @since 1.0.1.
131
* @param string $file The image file path.
132
* @return array An array of image data.
133
*/
178
/**
179
* Checks to see whether a string is an image url or not.
180
*
181
+ * @since 1.0.1
182
* @param string $string The string to check.
183
* @return bool Whether the string is an image url or not.
184
*/
includes/vendor/class-rrdi-widget-importer.php CHANGED
@@ -5,7 +5,7 @@
5
* Code is mostly from the Widget Importer & Exporter plugin.
6
*
7
* @see https://wordpress.org/plugins/widget-importer-exporter/
8
- * @package rara-demo-import
9
*/
10
11
class RRDI_Widget_Importer {
@@ -41,7 +41,7 @@ class RRDI_Widget_Importer {
41
if ( ! file_exists( $file ) ) {
42
return new WP_Error(
43
'widget_import_file_not_found',
44
- __( 'Widget import file could not be found.', 'rara-demo-import' )
45
);
46
}
47
@@ -73,7 +73,7 @@ class RRDI_Widget_Importer {
73
if ( empty( $data ) || ! is_object( $data ) ) {
74
return new WP_Error(
75
'corrupted_widget_import_data',
76
- __( 'Widget import data could not be read. Please try a different file.', 'rara-demo-import' )
77
);
78
}
79
@@ -113,7 +113,7 @@ class RRDI_Widget_Importer {
113
$sidebar_available = false;
114
$use_sidebar_id = 'wp_inactive_widgets'; // Add to inactive if sidebar does not exist in theme.
115
$sidebar_message_type = 'error';
116
- $sidebar_message = __( 'Sidebar does not exist in theme (moving widget to Inactive)', 'rara-demo-import' );
117
}
118
119
// Result for sidebar.
@@ -135,7 +135,7 @@ class RRDI_Widget_Importer {
135
if ( ! $fail && ! isset( $available_widgets[ $id_base ] ) ) {
136
$fail = true;
137
$widget_message_type = 'error';
138
- $widget_message = __( 'Site does not support widget', 'rara-demo-import' ); // Explain why widget not imported.
139
}
140
141
// Filter to modify settings object before conversion to array and import.
@@ -170,7 +170,7 @@ class RRDI_Widget_Importer {
170
if ( in_array( "$id_base-$check_id", $sidebar_widgets ) && (array) $widget == $check_widget ) {
171
$fail = true;
172
$widget_message_type = 'warning';
173
- $widget_message = __( 'Widget already exists', 'rara-demo-import' ); // Explain why widget not imported.
174
175
break;
176
}
@@ -229,17 +229,17 @@ class RRDI_Widget_Importer {
229
// Success message.
230
if ( $sidebar_available ) {
231
$widget_message_type = 'success';
232
- $widget_message = __( 'Imported', 'rara-demo-import' );
233
}
234
else {
235
$widget_message_type = 'warning';
236
- $widget_message = __( 'Imported to Inactive', 'rara-demo-import' );
237
}
238
}
239
240
// Result for widget instance.
241
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['name'] = isset( $available_widgets[ $id_base ]['name'] ) ? $available_widgets[ $id_base ]['name'] : $id_base; // Widget name or ID if name not available (not supported by site).
242
- $results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['title'] = ! empty( $widget['title'] ) ? $widget['title'] : __( 'No Title', 'rara-demo-import' ); // Show "No Title" if widget instance is untitled.
243
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message_type'] = $widget_message_type;
244
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message'] = $widget_message;
245
@@ -288,7 +288,7 @@ class RRDI_Widget_Importer {
288
public function format_results_for_log( $results ) {
289
290
if ( empty( $results ) ) {
291
- esc_html_e( 'No results for widget import!', 'rara-demo-import' );
292
}
293
294
// Loop sidebars.
5
* Code is mostly from the Widget Importer & Exporter plugin.
6
*
7
* @see https://wordpress.org/plugins/widget-importer-exporter/
8
+ * @package rara-one-click-demo-import
9
*/
10
11
class RRDI_Widget_Importer {
41
if ( ! file_exists( $file ) ) {
42
return new WP_Error(
43
'widget_import_file_not_found',
44
+ __( 'Widget import file could not be found.', 'rara-one-click-demo-import' )
45
);
46
}
47
73
if ( empty( $data ) || ! is_object( $data ) ) {
74
return new WP_Error(
75
'corrupted_widget_import_data',
76
+ __( 'Widget import data could not be read. Please try a different file.', 'rara-one-click-demo-import' )
77
);
78
}
79
113
$sidebar_available = false;
114
$use_sidebar_id = 'wp_inactive_widgets'; // Add to inactive if sidebar does not exist in theme.
115
$sidebar_message_type = 'error';
116
+ $sidebar_message = __( 'Sidebar does not exist in theme (moving widget to Inactive)', 'rara-one-click-demo-import' );
117
}
118
119
// Result for sidebar.
135
if ( ! $fail && ! isset( $available_widgets[ $id_base ] ) ) {
136
$fail = true;
137
$widget_message_type = 'error';
138
+ $widget_message = __( 'Site does not support widget', 'rara-one-click-demo-import' ); // Explain why widget not imported.
139
}
140
141
// Filter to modify settings object before conversion to array and import.
170
if ( in_array( "$id_base-$check_id", $sidebar_widgets ) && (array) $widget == $check_widget ) {
171
$fail = true;
172
$widget_message_type = 'warning';
173
+ $widget_message = __( 'Widget already exists', 'rara-one-click-demo-import' ); // Explain why widget not imported.
174
175
break;
176
}
229
// Success message.
230
if ( $sidebar_available ) {
231
$widget_message_type = 'success';
232
+ $widget_message = __( 'Imported', 'rara-one-click-demo-import' );
233
}
234
else {
235
$widget_message_type = 'warning';
236
+ $widget_message = __( 'Imported to Inactive', 'rara-one-click-demo-import' );
237
}
238
}
239
240
// Result for widget instance.
241
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['name'] = isset( $available_widgets[ $id_base ]['name'] ) ? $available_widgets[ $id_base ]['name'] : $id_base; // Widget name or ID if name not available (not supported by site).
242
+ $results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['title'] = ! empty( $widget['title'] ) ? $widget['title'] : __( 'No Title', 'rara-one-click-demo-import' ); // Show "No Title" if widget instance is untitled.
243
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message_type'] = $widget_message_type;
244
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message'] = $widget_message;
245
288
public function format_results_for_log( $results ) {
289
290
if ( empty( $results ) ) {
291
+ esc_html_e( 'No results for widget import!', 'rara-one-click-demo-import' );
292
}
293
294
// Loop sidebars.
index.php ADDED
@@ -0,0 +1 @@
1
+ <?php // Silence is golden
languages/rara-demo-import.pot DELETED
@@ -1,528 +0,0 @@
1
- # Copyright (C) 2016 ProteusThemes
2
- # This file is distributed under the GPL 2.0.
3
- #, fuzzy
4
- msgid ""
5
- msgstr ""
6
- "Project-Id-Version: Rara One Click Demo Import 1.2.0\n"
7
- "Report-Msgid-Bugs-To: http://support.proteusthemes.com/\n"
8
- "POT-Creation-Date: 2016-10-25 13:05-0400\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=utf-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "X-Generator: Poedit 1.8.9\n"
16
- "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
- "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
- "esc_html_x:1,2c\n"
19
- "Language: en\n"
20
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
21
- "X-Poedit-SourceCharset: UTF-8\n"
22
- "X-Poedit-Basepath: ..\n"
23
- "X-Textdomain-Support: yes\n"
24
- "X-Poedit-SearchPath-0: .\n"
25
-
26
- #: includes/vendor/class-rrdi-customizer-importer.php:36
27
- #, php-format
28
- msgid "The customizer import file is missing! File path: %s"
29
- msgstr ""
30
-
31
- #: includes/vendor/class-rrdi-customizer-importer.php:56
32
- msgid ""
33
- "The customizer import file is not in a correct format. Please make sure to "
34
- "use the correct customizer import file."
35
- msgstr ""
36
-
37
- #: includes/vendor/class-rrdi-customizer-importer.php:62
38
- msgid ""
39
- "The customizer import file is not suitable for current theme. You can only "
40
- "import customizer settings for the same theme or a child theme."
41
- msgstr ""
42
-
43
- #: includes/class-rrdi-helpers.php:70
44
- #, php-format
45
- msgid "\"import_file_url\" or \"local_import_file\" for %s%s%s are not defined!"
46
- msgstr ""
47
-
48
- #: includes/class-rrdi-helpers.php:176
49
- #, php-format
50
- msgid "URL for %s%s%s file is not defined!"
51
- msgstr ""
52
-
53
- #: includes/class-rrdi-helpers.php:198
54
- #, php-format
55
- msgid ""
56
- "An error occurred while fetching %s%s%s file from the server!%sReason: %s - "
57
- "%s."
58
- msgstr ""
59
-
60
- #: includes/class-rrdi-helpers.php:238 includes/class-rrdi-helpers.php:282
61
- #, php-format
62
- msgid ""
63
- "An error occurred while writing file to your server! Tried to write a file "
64
- "to: %s%s."
65
- msgstr ""
66
-
67
- #: includes/class-rrdi-helpers.php:317
68
- #, php-format
69
- msgid ""
70
- "An error occurred while reading a file from your server! Tried reading file "
71
- "from path: %s%s."
72
- msgstr ""
73
-
74
- #: includes/class-rrdi-helpers.php:341
75
- #, php-format
76
- msgid ""
77
- "This WordPress page does not have %sdirect%s write file access. This plugin "
78
- "needs it in order to save the demo import xml file to the upload directory of "
79
- "your site. You can change this setting with these instructions: %s."
80
- msgstr ""
81
-
82
- #: includes/class-rrdi-helpers.php:352 includes/class-rrdi-main.php:83
83
- #: includes/class-rrdi-main.php:106
84
- msgid "Rara One Click Demo Import"
85
- msgstr ""
86
-
87
- #: includes/class-rrdi-helpers.php:353
88
- msgid "Import Demo Data"
89
- msgstr ""
90
-
91
- #: includes/class-rrdi-helpers.php:365
92
- msgid ""
93
- "An error occurred while retrieving reading/writing permissions to your server "
94
- "(could not retrieve WP filesystem credentials)!"
95
- msgstr ""
96
-
97
- #: includes/class-rrdi-helpers.php:373
98
- msgid "Your WordPress login credentials don't allow to use WP_Filesystem!"
99
- msgstr ""
100
-
101
- #: includes/class-rrdi-helpers.php:438
102
- msgid "Rara One Click Demo Import - "
103
- msgstr ""
104
-
105
- #: includes/class-rrdi-helpers.php:474
106
- #, php-format
107
- msgid ""
108
- "%sYour user role isn't high enough. You don't have permission to import demo "
109
- "data.%s"
110
- msgstr ""
111
-
112
- #: includes/class-rrdi-helpers.php:510
113
- msgid ""
114
- "Please upload XML file for content import. If you want to import widgets or "
115
- "customizer settings only, please use Widget Importer & Exporter or the "
116
- "Customizer Export/Import plugin."
117
- msgstr ""
118
-
119
- #: includes/class-rrdi-helpers.php:512 includes/class-rrdi-helpers.php:534
120
- #: includes/class-rrdi-helpers.php:553 includes/class-rrdi-helpers.php:561
121
- msgid "Upload files"
122
- msgstr ""
123
-
124
- #: includes/class-rrdi-helpers.php:530
125
- #, php-format
126
- msgid "Widget file was not uploaded. Error: %s"
127
- msgstr ""
128
-
129
- #: includes/class-rrdi-helpers.php:549
130
- #, php-format
131
- msgid "Customizer file was not uploaded. Error: %s"
132
- msgstr ""
133
-
134
- #: includes/class-rrdi-helpers.php:559
135
- msgid "The import files were successfully uploaded!"
136
- msgstr ""
137
-
138
- #: includes/class-rrdi-helpers.php:577
139
- #, php-format
140
- msgid "Initial max execution time = %s"
141
- msgstr ""
142
-
143
- #: includes/class-rrdi-helpers.php:581
144
- #, php-format
145
- msgid ""
146
- "Files info:%1$sSite URL = %2$s%1$sData file = %3$s%1$sWidget file = %4$s"
147
- "%1$sCustomizer file = %5$s"
148
- msgstr ""
149
-
150
- #: includes/class-rrdi-helpers.php:585 includes/class-rrdi-helpers.php:586
151
- msgid "not defined!"
152
- msgstr ""
153
-
154
- #: includes/class-rrdi-main.php:84 includes/class-rrdi-main.php:238
155
- msgid "Import Demo Content"
156
- msgstr ""
157
-
158
- #: includes/class-rrdi-main.php:101
159
- msgid "Before you begin, make sure all the required plugins are activated."
160
- msgstr ""
161
-
162
- #: includes/class-rrdi-main.php:113
163
- #, php-format
164
- msgid ""
165
- "%sWarning: your server is using %sPHP safe mode%s. This means that you might "
166
- "experience server timeout errors.%s"
167
- msgstr ""
168
-
169
- #: includes/class-rrdi-main.php:128
170
- msgid ""
171
- "Quickly import your theme's live demo content, widgets and settings. This "
172
- "will provide you a base to build your website and speed up the development "
173
- "process."
174
- msgstr ""
175
-
176
- #: includes/class-rrdi-main.php:131
177
- msgid "The following data will be imported:"
178
- msgstr ""
179
-
180
- #: includes/class-rrdi-main.php:134
181
- msgid "Posts"
182
- msgstr ""
183
-
184
- #: includes/class-rrdi-main.php:135
185
- msgid "Pages"
186
- msgstr ""
187
-
188
- #: includes/class-rrdi-main.php:136
189
- msgid "Images"
190
- msgstr ""
191
-
192
- #: includes/class-rrdi-main.php:137
193
- msgid "Widgets"
194
- msgstr ""
195
-
196
- #: includes/class-rrdi-main.php:138
197
- msgid "Menus"
198
- msgstr ""
199
-
200
- #: includes/class-rrdi-main.php:139
201
- msgid "Settings"
202
- msgstr ""
203
-
204
- #: includes/class-rrdi-main.php:142
205
- msgid "NOTE: Your existing content will NOT be deleted or modified."
206
- msgstr ""
207
-
208
- #: includes/class-rrdi-main.php:159
209
- msgid ""
210
- "There are no predefined import files available in this theme. Please upload "
211
- "the import files manually!"
212
- msgstr ""
213
-
214
- #: includes/class-rrdi-main.php:164
215
- msgid "Manually upload the demo files"
216
- msgstr ""
217
-
218
- #: includes/class-rrdi-main.php:167
219
- msgid "Choose a XML file for content import:"
220
- msgstr ""
221
-
222
- #: includes/class-rrdi-main.php:172
223
- msgid "Choose a WIE or JSON file for widget import:"
224
- msgstr ""
225
-
226
- #: includes/class-rrdi-main.php:172 includes/class-rrdi-main.php:177
227
- msgid "(*optional)"
228
- msgstr ""
229
-
230
- #: includes/class-rrdi-main.php:177
231
- msgid "Choose a DAT file for customizer import:"
232
- msgstr ""
233
-
234
- #: includes/class-rrdi-main.php:187
235
- msgid "Choose which demo you want to import:"
236
- msgstr ""
237
-
238
- #: includes/class-rrdi-main.php:212
239
- msgid "Import preview:"
240
- msgstr ""
241
-
242
- #: includes/class-rrdi-main.php:216 includes/class-rrdi-main.php:271
243
- msgid "No preview image defined for this import."
244
- msgstr ""
245
-
246
- #: includes/class-rrdi-main.php:239
247
- msgid ""
248
- "Click the button once and wait. The import process may take several minutes."
249
- msgstr ""
250
-
251
- #: includes/class-rrdi-main.php:243
252
- msgid "Importing, please wait!"
253
- msgstr ""
254
-
255
- #: includes/class-rrdi-main.php:328
256
- msgid "Manually uploaded files"
257
- msgstr ""
258
-
259
- #: includes/class-rrdi-main.php:345 includes/class-rrdi-main.php:356
260
- msgid "Downloaded files"
261
- msgstr ""
262
-
263
- #: includes/class-rrdi-main.php:352
264
- #, php-format
265
- msgid "The import files for: %s were successfully downloaded!"
266
- msgstr ""
267
-
268
- #: includes/class-rrdi-main.php:362
269
- msgid "No import files specified!"
270
- msgstr ""
271
-
272
- #: includes/class-rrdi-main.php:409
273
- #, php-format
274
- msgid ""
275
- "%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
276
- "check your page and make sure that everything has imported correctly. If it "
277
- "did, you can deactivate the %3$sRara One Click Demo Import%4$s plugin.%5$s"
278
- msgstr ""
279
-
280
- #: includes/class-rrdi-main.php:420
281
- #, php-format
282
- msgid ""
283
- "%1$sThe demo import has finished, but there were some import errors.%2$sMore "
284
- "details about the errors can be found in this %3$s%5$slog file%6$s%4$s%7$s"
285
- msgstr ""
286
-
287
- #: includes/class-rrdi-main.php:474
288
- msgid "Max execution time after content import = "
289
- msgstr ""
290
-
291
- #: includes/class-rrdi-main.php:476
292
- msgid "Importing content"
293
- msgstr ""
294
-
295
- #: includes/class-rrdi-main.php:515 includes/class-rrdi-main.php:527
296
- msgid "Importing widgets"
297
- msgstr ""
298
-
299
- #: includes/class-rrdi-main.php:549 includes/class-rrdi-main.php:557
300
- msgid "Importing customizer settings"
301
- msgstr ""
302
-
303
- #: includes/class-rrdi-main.php:555
304
- msgid "Customizer settings import finished!"
305
- msgstr ""
306
-
307
- #: includes/class-rrdi-main.php:607
308
- msgid "Completed AJAX call number: "
309
- msgstr ""
310
-
311
- #: includes/vendor/class-rrdi-widget-importer.php:44
312
- msgid "Widget import file could not be found."
313
- msgstr ""
314
-
315
- #: includes/vendor/class-rrdi-widget-importer.php:76
316
- msgid "Widget import data could not be read. Please try a different file."
317
- msgstr ""
318
-
319
- #: includes/vendor/class-rrdi-widget-importer.php:116
320
- msgid "Sidebar does not exist in theme (moving widget to Inactive)"
321
- msgstr ""
322
-
323
- #: includes/vendor/class-rrdi-widget-importer.php:138
324
- msgid "Site does not support widget"
325
- msgstr ""
326
-
327
- #: includes/vendor/class-rrdi-widget-importer.php:173
328
- msgid "Widget already exists"
329
- msgstr ""
330
-
331
- #: includes/vendor/class-rrdi-widget-importer.php:232
332
- msgid "Imported"
333
- msgstr ""
334
-
335
- #: includes/vendor/class-rrdi-widget-importer.php:236
336
- msgid "Imported to Inactive"
337
- msgstr ""
338
-
339
- #: includes/vendor/class-rrdi-widget-importer.php:242
340
- msgid "No Title"
341
- msgstr ""
342
-
343
- #: includes/vendor/class-rrdi-widget-importer.php:291
344
- msgid "No results for widget import!"
345
- msgstr ""
346
-
347
- #: includes/extras/class-wxr-importer.php:130
348
- msgid "Could not open the file for parsing"
349
- msgstr ""
350
-
351
- #: includes/extras/class-wxr-importer.php:166
352
- #: includes/extras/class-wxr-importer.php:282
353
- #: includes/extras/class-wxr-importer.php:355
354
- #, php-format
355
- msgid ""
356
- "This WXR file (version %s) is newer than the importer (version %s) and may "
357
- "not be supported. Please consider updating."
358
- msgstr ""
359
-
360
- #: includes/extras/class-wxr-importer.php:504
361
- msgid "The file does not exist, please try again."
362
- msgstr ""
363
-
364
- #: includes/extras/class-wxr-importer.php:564
365
- msgid "Invalid author mapping"
366
- msgstr ""
367
-
368
- #: includes/extras/class-wxr-importer.php:665
369
- msgid "Cannot import auto-draft posts"
370
- msgstr ""
371
-
372
- #: includes/extras/class-wxr-importer.php:753
373
- #, php-format
374
- msgid "Failed to import \"%s\": Invalid post type %s"
375
- msgstr ""
376
-
377
- #: includes/extras/class-wxr-importer.php:763
378
- #, php-format
379
- msgid "%s \"%s\" already exists."
380
- msgstr ""
381
-
382
- #: includes/extras/class-wxr-importer.php:841
383
- #, php-format
384
- msgid "Skipping attachment \"%s\", fetching attachments disabled"
385
- msgstr ""
386
-
387
- #: includes/extras/class-wxr-importer.php:855
388
- #, php-format
389
- msgid "Failed to import \"%s\" (%s)"
390
- msgstr ""
391
-
392
- #: includes/extras/class-wxr-importer.php:887
393
- #: includes/extras/class-wxr-importer.php:1705
394
- #, php-format
395
- msgid "Imported \"%s\" (%s)"
396
- msgstr ""
397
-
398
- #: includes/extras/class-wxr-importer.php:892
399
- #, php-format
400
- msgid "Post %d remapped to %d"
401
- msgstr ""
402
-
403
- #: includes/extras/class-wxr-importer.php:1036
404
- msgid "Invalid file type"
405
- msgstr ""
406
-
407
- #: includes/extras/class-wxr-importer.php:1519
408
- #, php-format
409
- msgid "Failed to import user \"%s\""
410
- msgstr ""
411
-
412
- #: includes/extras/class-wxr-importer.php:1540
413
- #, php-format
414
- msgid "Imported user \"%s\""
415
- msgstr ""
416
-
417
- #: includes/extras/class-wxr-importer.php:1544
418
- #, php-format
419
- msgid "User %d remapped to %d"
420
- msgstr ""
421
-
422
- #: includes/extras/class-wxr-importer.php:1681
423
- #, php-format
424
- msgid "Failed to import %s %s"
425
- msgstr ""
426
-
427
- #: includes/extras/class-wxr-importer.php:1710
428
- #, php-format
429
- msgid "Term %d remapped to %d"
430
- msgstr ""
431
-
432
- #: includes/extras/class-wxr-importer.php:1763
433
- #, php-format
434
- msgid "Remote server returned %1$d %2$s for %3$s"
435
- msgstr ""
436
-
437
- #: includes/extras/class-wxr-importer.php:1776
438
- msgid "Remote file is incorrect size"
439
- msgstr ""
440
-
441
- #: includes/extras/class-wxr-importer.php:1781
442
- msgid "Zero size file downloaded"
443
- msgstr ""
444
-
445
- #: includes/extras/class-wxr-importer.php:1787
446
- #, php-format
447
- msgid "Remote file is too large, limit is %s"
448
- msgstr ""
449
-
450
- #: includes/extras/class-wxr-importer.php:1809
451
- #, php-format
452
- msgid "Running post-processing for post %d"
453
- msgstr ""
454
-
455
- #: includes/extras/class-wxr-importer.php:1822
456
- #, php-format
457
- msgid "Could not find the post parent for \"%s\" (post #%d)"
458
- msgstr ""
459
-
460
- #: includes/extras/class-wxr-importer.php:1827
461
- #, php-format
462
- msgid "Post %d was imported with parent %d, but could not be found"
463
- msgstr ""
464
-
465
- #: includes/extras/class-wxr-importer.php:1841
466
- #, php-format
467
- msgid "Could not find the author for \"%s\" (post #%d)"
468
- msgstr ""
469
-
470
- #: includes/extras/class-wxr-importer.php:1846
471
- #, php-format
472
- msgid "Post %d was imported with author \"%s\", but could not be found"
473
- msgstr ""
474
-
475
- #: includes/extras/class-wxr-importer.php:1872
476
- #, php-format
477
- msgid "Post %d was marked for post-processing, but none was required."
478
- msgstr ""
479
-
480
- #: includes/extras/class-wxr-importer.php:1883
481
- #, php-format
482
- msgid "Could not update \"%s\" (post #%d) with mapped data"
483
- msgstr ""
484
-
485
- #: includes/extras/class-wxr-importer.php:1928
486
- #, php-format
487
- msgid "Could not find the menu object for \"%s\" (post #%d)"
488
- msgstr ""
489
-
490
- #: includes/extras/class-wxr-importer.php:1933
491
- #, php-format
492
- msgid ""
493
- "Post %d was imported with object \"%d\" of type \"%s\", but could not be found"
494
- msgstr ""
495
-
496
- #: includes/extras/class-wxr-importer.php:1955
497
- #, php-format
498
- msgid "Could not find the comment parent for comment #%d"
499
- msgstr ""
500
-
501
- #: includes/extras/class-wxr-importer.php:1959
502
- #, php-format
503
- msgid "Comment %d was imported with parent %d, but could not be found"
504
- msgstr ""
505
-
506
- #: includes/extras/class-wxr-importer.php:1973
507
- #, php-format
508
- msgid "Could not find the author for comment #%d"
509
- msgstr ""
510
-
511
- #: includes/extras/class-wxr-importer.php:1977
512
- #, php-format
513
- msgid "Comment %d was imported with author %d, but could not be found"
514
- msgstr ""
515
-
516
- #: includes/extras/class-wxr-importer.php:1994
517
- #, php-format
518
- msgid "Could not update comment #%d with mapped data"
519
- msgstr ""
520
-
521
- #: rara-demo-import.php:29
522
- #, php-format
523
- msgid ""
524
- "The %2$sRara One Click Demo Import%3$s plugin requires %2$sPHP 5.3.2+%3$s to run "
525
- "properly. Please contact your hosting company and ask them to update the PHP "
526
- "version of your site to at least PHP 5.3.2.%4$s Your current version of PHP: "
527
- "%2$s%1$s%3$s"
528
- msgstr ""