@wp-playground/client 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 CHANGED
@@ -438,6 +438,7 @@ echo json_encode($deactivated_plugins);
438
438
  }
439
439
  `),await login(e,{});for(const O of o)await activatePlugin(e,{pluginPath:O})};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
@@ -1792,11 +1792,11 @@ export declare const unzip: StepHandler<UnzipStep<File>>;
1792
1792
  *
1793
1793
  * <code>
1794
1794
  * {
1795
- * "step": "importWordPressFilesStep",
1795
+ * "step": "importWordPressFiles",
1796
1796
  * "wordPressFilesZip": {
1797
- * "resource": "fetch",
1798
- * "url": "https://mysite.com/import.zip"
1799
- * }
1797
+ * "resource": "url",
1798
+ * "url": "https://mysite.com/import.zip"
1799
+ * }
1800
1800
  * }
1801
1801
  * </code>
1802
1802
  */
package/index.js CHANGED
@@ -912,6 +912,7 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
912
912
  await e.run({
913
913
  code: `<?php
914
914
  require ${phpVar(n)} . '/wp-load.php';
915
+ kses_remove_filters();
915
916
  $admin_id = get_users(array('role' => 'Administrator') )[0];
916
917
  $importer = new WXR_Importer( array(
917
918
  'fetch_attachments' => true,
@@ -919,6 +920,12 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
919
920
  ) );
920
921
  $logger = new WP_Importer_Logger_CLI();
921
922
  $importer->set_logger( $logger );
923
+
924
+ // Slashes from the imported content are lost if we don't call wp_slash here.
925
+ add_action( 'wp_insert_post_data', function( $data ) {
926
+ return wp_slash($data);
927
+ });
928
+
922
929
  $result = $importer->import( '/tmp/import.wxr' );
923
930
  `
924
931
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/client",
3
- "version": "0.6.10",
3
+ "version": "0.6.14",
4
4
  "description": "WordPress Playground client",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "main": "./index.cjs",
38
38
  "module": "./index.js",
39
39
  "types": "index.d.ts",
40
- "gitHead": "a678c93cecd1c7fd5c8279ad8454a83225edd2aa",
40
+ "gitHead": "83b6f8542937a9bea9ee6562887a511c20ac9442",
41
41
  "engines": {
42
42
  "node": ">=18.18.2",
43
43
  "npm": ">=8.11.0"