@wp-playground/blueprints 0.6.10 → 0.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +7 -0
- package/index.d.ts +4 -4
- package/index.js +287 -280
- package/lib/steps/import-wordpress-files.d.ts +4 -4
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -438,6 +438,7 @@ echo json_encode($deactivated_plugins);
|
|
|
438
438
|
}
|
|
439
439
|
`),await login(e,{});for(const N of o)await activatePlugin(e,{pluginPath:N})};function jsonToUrlEncoded(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}const cp=async(e,{fromPath:t,toPath:r})=>{await e.writeFile(r,await e.readFileAsBuffer(t))},mv=async(e,{fromPath:t,toPath:r})=>{await e.mv(t,r)},mkdir=async(e,{path:t})=>{await e.mkdir(t)},rmdir=async(e,{path:t})=>{await e.rmdir(t)},writeFile=async(e,{path:t,data:r})=>{r instanceof File&&(r=new Uint8Array(await r.arrayBuffer())),await e.writeFile(t,r)},defineSiteUrl=async(e,{siteUrl:t})=>{await defineWpConfigConsts(e,{consts:{WP_HOME:t,WP_SITEURL:t}})},importWxr=async(e,{file:t},r)=>{var s;(s=r==null?void 0:r.tracker)==null||s.setCaption("Importing content"),await writeFile(e,{path:"/tmp/import.wxr",data:t});const n=await e.documentRoot;await e.run({code:`<?php
|
|
440
440
|
require ${phpVar(n)} . '/wp-load.php';
|
|
441
|
+
kses_remove_filters();
|
|
441
442
|
$admin_id = get_users(array('role' => 'Administrator') )[0];
|
|
442
443
|
$importer = new WXR_Importer( array(
|
|
443
444
|
'fetch_attachments' => true,
|
|
@@ -445,6 +446,12 @@ echo json_encode($deactivated_plugins);
|
|
|
445
446
|
) );
|
|
446
447
|
$logger = new WP_Importer_Logger_CLI();
|
|
447
448
|
$importer->set_logger( $logger );
|
|
449
|
+
|
|
450
|
+
// Slashes from the imported content are lost if we don't call wp_slash here.
|
|
451
|
+
add_action( 'wp_insert_post_data', function( $data ) {
|
|
452
|
+
return wp_slash($data);
|
|
453
|
+
});
|
|
454
|
+
|
|
448
455
|
$result = $importer->import( '/tmp/import.wxr' );
|
|
449
456
|
`})},zipFunctions=`<?php
|
|
450
457
|
|
package/index.d.ts
CHANGED
|
@@ -1552,11 +1552,11 @@ export declare const unzip: StepHandler<UnzipStep<File>>;
|
|
|
1552
1552
|
*
|
|
1553
1553
|
* <code>
|
|
1554
1554
|
* {
|
|
1555
|
-
* "step": "
|
|
1555
|
+
* "step": "importWordPressFiles",
|
|
1556
1556
|
* "wordPressFilesZip": {
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
*
|
|
1557
|
+
* "resource": "url",
|
|
1558
|
+
* "url": "https://mysite.com/import.zip"
|
|
1559
|
+
* }
|
|
1560
1560
|
* }
|
|
1561
1561
|
* </code>
|
|
1562
1562
|
*/
|