@wp-playground/wordpress 3.1.27 → 3.1.28
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 +45 -22
- package/index.cjs.map +1 -1
- package/index.js +24 -1
- package/index.js.map +1 -1
- package/package.json +7 -7
package/index.cjs
CHANGED
|
@@ -163,12 +163,35 @@
|
|
|
163
163
|
if (!empty($settings['content_style'])) {
|
|
164
164
|
$inline_css = $settings['content_style'] . "\\n" . $inline_css;
|
|
165
165
|
}
|
|
166
|
-
$settings['content_style'] =
|
|
166
|
+
$settings['content_style'] =
|
|
167
|
+
playground_escape_tinymce_content_style_for_wp_editor_serializer($inline_css);
|
|
167
168
|
$settings['content_css'] = '';
|
|
168
169
|
}
|
|
169
170
|
return $settings;
|
|
170
171
|
}
|
|
171
172
|
add_filter('tiny_mce_before_init', 'playground_inline_tinymce_content_css');
|
|
173
|
+
|
|
174
|
+
// _WP_Editors::_parse_init() wraps strings in double quotes without escaping them.
|
|
175
|
+
// Encode the CSS as a JavaScript string body before WordPress adds those quotes.
|
|
176
|
+
function playground_escape_tinymce_content_style_for_wp_editor_serializer($css) {
|
|
177
|
+
$encoded = json_encode($css);
|
|
178
|
+
if (
|
|
179
|
+
is_string($encoded) &&
|
|
180
|
+
substr($encoded, 0, 1) === chr(34) &&
|
|
181
|
+
substr($encoded, -1) === chr(34)
|
|
182
|
+
) {
|
|
183
|
+
$escaped = substr($encoded, 1, -1);
|
|
184
|
+
} else {
|
|
185
|
+
// Fallback: json_encode() can fail on non-UTF-8 CSS bytes.
|
|
186
|
+
// Escape the bytes that would break _WP_Editors::_parse_init().
|
|
187
|
+
$escaped = str_replace(
|
|
188
|
+
array('\\\\', chr(34), "\\r", "\\n", "\\xe2\\x80\\xa8", "\\xe2\\x80\\xa9"),
|
|
189
|
+
array('\\\\\\\\', '\\\\' . chr(34), '\\\\r', '\\\\n', '\\\\u2028', '\\\\u2029'),
|
|
190
|
+
$css
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
return str_replace('</', '<\\/', $escaped);
|
|
194
|
+
}
|
|
172
195
|
`)}function N(e){return`
|
|
173
196
|
/**
|
|
174
197
|
* Loads the SQLite integration plugin before WordPress is loaded
|
|
@@ -667,7 +690,7 @@ set_error_handler('_playground_error_handler');`)}const M=`
|
|
|
667
690
|
{
|
|
668
691
|
return;
|
|
669
692
|
}
|
|
670
|
-
`;async function H(e,t){const i=E(e,t);if(i===null)return;const n=parseFloat(i);if(!Number.isFinite(n)||n<5||n>=6.2)return;const s=o.joinPaths(t,"wp-includes/load.php");if(!e.fileExists(s))return;const r=e.readFileAsText(s),a=r.replace("extension_loaded( 'mysqli' )","function_exists( 'mysqli_connect' )");a!==r&&await e.writeFile(s,a)}function E(e,t){const i=o.joinPaths(t,"wp-includes/version.php");if(!e.fileExists(i))return null;const s=e.readFileAsText(i).match(/\$wp_version\s*=\s*['"]([^'"]+)['"]/);return s?s[1]:null}const B=22527,T="E_ALL & ~8192 & ~2048";async function j(e,t){await te(e,t),await ie(e,t),await se(e,t),await
|
|
693
|
+
`;async function H(e,t){const i=E(e,t);if(i===null)return;const n=parseFloat(i);if(!Number.isFinite(n)||n<5||n>=6.2)return;const s=o.joinPaths(t,"wp-includes/load.php");if(!e.fileExists(s))return;const r=e.readFileAsText(s),a=r.replace("extension_loaded( 'mysqli' )","function_exists( 'mysqli_connect' )");a!==r&&await e.writeFile(s,a)}function E(e,t){const i=o.joinPaths(t,"wp-includes/version.php");if(!e.fileExists(i))return null;const s=e.readFileAsText(i).match(/\$wp_version\s*=\s*['"]([^'"]+)['"]/);return s?s[1]:null}const B=22527,T="E_ALL & ~8192 & ~2048";async function j(e,t){await te(e,t),await ie(e,t),await se(e,t),await _e(e,t),await le(e,t),await we(e,t),await ue(e,t),await he(e,t),await K(e,t),await Y(e,t);const i=E(e,t);if(i===null)return;const n=parseFloat(i);Number.isFinite(n)&&(n<1.2&&(await ne(e,t),await ee(e,t)),n<1.5&&await Q(e,t),1.5<=n&&n<2&&await fe(e,t),n<2&&(await z(e,t),await oe(e,t)),2.1<=n&&n<2.3&&await J(e,t),n<2.5&&await de(e,t),n<2.8&&(await ge(e,t),await me(e,t)),2.9<=n&&n<3.6&&await X(e,t),3.3<=n&&n<3.4&&await Z(e,t),n>=4.7&&await V(e,t))}async function V(e,t){const i=o.joinPaths(t,"wp-content/themes");if(e.isDir(i))for(const n of e.listFiles(i)){const s=o.joinPaths(i,n,"searchform.php");e.fileExists(s)&&e.unlink(s)}}async function X(e,t){const i=o.joinPaths(t,"wp-admin/includes/dashboard.php");if(e.fileExists(i)){let r=e.readFileAsText(i);if(r.includes("function wp_dashboard_primary()")&&!r.includes("/* pg_no_rss */")){for(const a of["wp_dashboard_primary","wp_dashboard_secondary","wp_dashboard_plugins"])r=r.replace(new RegExp(`function ${a}\\(\\)\\s*\\{`),`function ${a}() { /* pg_no_rss */ return;`);await e.writeFile(i,r)}}const n=o.joinPaths(t,"wp-admin/admin.php");if(e.fileExists(n)){let r=e.readFileAsText(n);r.includes("do_action('admin_init');")&&!r.includes("/* pg_admin_init_cleanup */")&&(r=r.replace("do_action('admin_init');",`/* pg_admin_init_cleanup */
|
|
671
694
|
if (function_exists('remove_action')) {
|
|
672
695
|
@remove_action('admin_init', '_maybe_update_plugins');
|
|
673
696
|
@remove_action('admin_init', '_maybe_update_themes');
|
|
@@ -676,12 +699,12 @@ if (function_exists('remove_action')) {
|
|
|
676
699
|
@remove_action('admin_init', 'wp_update_plugins');
|
|
677
700
|
@remove_action('admin_init', 'wp_update_themes');
|
|
678
701
|
}
|
|
679
|
-
do_action('admin_init');`),await e.writeFile(n,r))}const s=o.joinPaths(t,"wp-admin/includes/update.php");if(e.fileExists(s)){let r=e.readFileAsText(s);if(!r.includes("/* pg_admin_no_updates */")){for(const a of["wp_plugin_update_rows","wp_plugin_update_row","wp_theme_update_rows","wp_theme_update_row","wp_update_plugins","wp_update_themes"]){const
|
|
702
|
+
do_action('admin_init');`),await e.writeFile(n,r))}const s=o.joinPaths(t,"wp-admin/includes/update.php");if(e.fileExists(s)){let r=e.readFileAsText(s);if(!r.includes("/* pg_admin_no_updates */")){for(const a of["wp_plugin_update_rows","wp_plugin_update_row","wp_theme_update_rows","wp_theme_update_row","wp_update_plugins","wp_update_themes"]){const _=new RegExp(`function ${a}\\s*\\([^)]*\\)\\s*\\{`);_.test(r)&&(r=r.replace(_,l=>l+" /* pg_admin_no_updates */ return;"))}await e.writeFile(s,r)}}for(const r of[o.joinPaths(t,"wp-includes/SimplePie/File.php"),o.joinPaths(t,"wp-includes/class-simplepie.php")]){if(!e.fileExists(r))continue;let a=e.readFileAsText(r);a.includes("function SimplePie_File(")&&!a.includes("/* pg_no_fetch */")&&(a=a.replace(/function SimplePie_File\([^)]*\)\s*\{/,_=>_+`
|
|
680
703
|
/* pg_no_fetch */
|
|
681
704
|
$this->error = 'Network requests disabled in Playground';
|
|
682
705
|
$this->success = false;
|
|
683
|
-
return;`),await e.writeFile(r,a))}}async function Y(e,t){const i=[["function wp_new_blog_notification","pg_no_blog_notification"],["function wp_install_maybe_enable_pretty_permalinks","pg_no_permalink_check"]],n=[o.joinPaths(t,"wp-admin/includes/upgrade.php"),o.joinPaths(t,"wp-admin/upgrade-functions.php")];for(const s of n){if(!e.fileExists(s))continue;let r=e.readFileAsText(s),a=!1;for(const[l
|
|
684
|
-
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>`;s.includes(
|
|
706
|
+
return;`),await e.writeFile(r,a))}}async function Y(e,t){const i=[["function wp_new_blog_notification","pg_no_blog_notification"],["function wp_install_maybe_enable_pretty_permalinks","pg_no_permalink_check"]],n=[o.joinPaths(t,"wp-admin/includes/upgrade.php"),o.joinPaths(t,"wp-admin/upgrade-functions.php")];for(const s of n){if(!e.fileExists(s))continue;let r=e.readFileAsText(s),a=!1;for(const[_,l]of i){if(r.includes(`/* ${l} */`))continue;const c=r.indexOf(_);if(c===-1)continue;const u=r.indexOf("{",c);u!==-1&&(r=r.substring(0,u+1)+` /* ${l} */ return;`+r.substring(u+1),a=!0)}a&&await e.writeFile(s,r)}}async function K(e,t){const i=o.joinPaths(t,"wp-load.php");if(!e.fileExists(i))return;const n=e.readFileAsText(i);if(!n.includes("error_reporting(")||n.includes("~8192")&&n.includes("~2048"))return;const s=n.replace(/error_reporting\(([^)]+)\)/g,(r,a)=>`error_reporting((${a}) & ~8192 & ~2048)`);await e.writeFile(i,s)}async function Q(e,t){const i=o.joinPaths(t,"wp-admin/menu.php");if(e.fileExists(i)){const r=e.readFileAsText(i);if(!r.includes("/* pg_wp10_logo_link */")){const a='<h1 id="wphead"><a href="http://wordpress.org" rel="external">WordPress</a></h1>';if(r.includes(a)){const _=r.replace(a,'<h1 id="wphead"><a href="#" rel="external">WordPress</a></h1> <!-- pg_wp10_logo_link -->');_!==r&&await e.writeFile(i,_)}}}const n=o.joinPaths(t,"wp-admin/admin-header.php");if(e.fileExists(n)){const r=e.readFileAsText(n);if(!r.includes("/* pg_wp12_logo_link */")){const a='<a href="http://wordpress.org" rel="external"',_="</a>",l=r.indexOf(a);if(l!==-1){const c=r.indexOf(_,l);if(c!==-1){const u=r.substring(0,l)+'<a href="#">WordPress</a><!-- pg_wp12_logo_link -->'+r.substring(c+_.length);u!==r&&await e.writeFile(n,u)}}}}const s=o.joinPaths(t,"wp-admin/admin-footer.php");if(e.fileExists(s)){const r=e.readFileAsText(s);if(!r.includes("/* pg_wp10_footer_link */")){const a=r.replace('<a href="http://wordpress.org">WordPress</a>',"WordPress<!-- pg_wp10_footer_link -->").replace('<a href="http://wordpress.org/">WordPress</a>',"WordPress<!-- pg_wp10_footer_link -->");a!==r&&await e.writeFile(s,a)}}}async function z(e,t){const i=o.joinPaths(t,"wp-admin/edit.php");if(!e.fileExists(i))return;const n=e.readFileAsText(i);if(n.includes("/* pg_wp10_post_title_edit */"))return;let s=n;const r='<strong><a href="<?php permalink_link(); ?>" rel="permalink"><?php the_title() ?></a></strong>';s.includes(r)&&(s=s.replace(r,'<strong><a href="post.php?action=edit&post=<?php echo $id /* pg_wp10_post_title_edit */ ?>"><?php the_title() ?></a></strong>'));const a='<td><a href="<?php the_permalink(); ?>" rel="permalink">';s.includes(a)&&(s=s.replace(a,'<td><a href="post.php?action=edit&post=<?php echo $id /* pg_wp10_post_title_edit */ ?>">'));const _=`<td><?php the_title() ?>
|
|
707
|
+
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>`;s.includes(_)&&(s=s.replace(_,`<td><a href="post.php?action=edit&post=<?php echo $id /* pg_wp10_post_title_edit */ ?>"><?php the_title() ?></a>
|
|
685
708
|
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>`)),s!==n&&await e.writeFile(i,s)}async function Z(e,t){const i=o.joinPaths(t,"wp-admin/includes/screen.php");if(!e.fileExists(i))return;const n=e.readFileAsText(i);if(!n.includes("self::$this->_help_sidebar"))return;const s=n.replace(/self::\$this->_help_sidebar/g,"$this->_help_sidebar");s!==n&&await e.writeFile(i,s)}async function J(e,t){const i=o.joinPaths(t,"wp-admin/plugins.php");if(!e.fileExists(i))return;const n=e.readFileAsText(i);if(n.includes("/* pg_wp21_active_plugins_array */"))return;const s="$current = get_option('active_plugins');";if(!n.includes(s))return;const r=n.replace(s,s+`
|
|
686
709
|
if (!is_array($current)) $current = array(); /* pg_wp21_active_plugins_array */`);r!==n&&await e.writeFile(i,r)}async function ee(e,t){const i=o.joinPaths(t,"wp-login.php");if(!e.fileExists(i))return;const n=e.readFileAsText(i),s="AND user_pass = '$password'";if(!n.includes(s)||n.includes("pg_wp10_plain_or_md5"))return;let r=n.replace(s,"AND (user_pass = '$password' OR user_pass = MD5('$password')) /* pg_wp10_plain_or_md5 */");r=r.replace("$login->user_pass == $password","($login->user_pass == $password || $login->user_pass == md5($password))"),r!==n&&await e.writeFile(i,r)}async function te(e,t){const i=o.joinPaths(t,"wp-includes");if(!e.isDir(i))return;const n=o.joinPaths(i,"version.php");e.fileExists(n)||await e.writeFile(n,"<?php $wp_version = '1.0';")}async function ne(e,t){const i=o.joinPaths(t,"wp-blog-header.php");if(e.fileExists(i)){const s=e.readFileAsText(i),r=`$where .= ' AND (post_status = "publish"';`;s.includes(r)&&await e.writeFile(i,s.replace(r,`$where .= " AND (post_status = 'publish'";`))}const n=o.joinPaths(t,"wp-includes/vars.php");if(e.fileExists(n)){const s=e.readFileAsText(n),r="add_filter('all', 'wptexturize');";s.includes(r)&&await e.writeFile(n,s.replace(r,`// ${r} // Disabled by Playground: mangles SQL literals.`))}}async function ie(e,t){const i=o.joinPaths(t,"wp-load.php");e.fileExists(i)||await e.writeFile(i,`<?php
|
|
687
710
|
if ( !defined('ABSPATH') ) {
|
|
@@ -717,7 +740,7 @@ if (function_exists('add_filter')) {
|
|
|
717
740
|
@add_filter('use_fsockopen_transport', '_pg_disable_streams');
|
|
718
741
|
}
|
|
719
742
|
do_action('init');`)}async function oe(e,t){const i=o.joinPaths(t,"wp-includes/functions.php");if(!e.fileExists(i))return;let n=e.readFileAsText(i),s=!1;n.includes("$all_options->{$option->option_name}")&&!n.includes("$all_options = new stdClass")&&(n=n.replace("foreach ($options as $option) {",`$all_options = new stdClass;
|
|
720
|
-
foreach ($options as $option) {`),s=!0),s&&await e.writeFile(i,n)}async function
|
|
743
|
+
foreach ($options as $option) {`),s=!0),s&&await e.writeFile(i,n)}async function _e(e,t){const i=o.joinPaths(t,"wp-admin/install.php");if(!e.fileExists(i))return;const n=e.readFileAsText(i);let s=n;const r=o.joinPaths(t,"wp-admin");s=s.replace(/'\.\.\/(wp-config\.php)'/g,`'${t}/$1'`).replace(/'\.\.\/(wp-load\.php)'/g,`'${t}/$1'`).replace(/'\.\/(upgrade-functions\.php)'/g,`'${r}/$1'`).replace(/'(upgrade-functions\.php)'/g,`'${r}/$1'`).replace(/'\.\/(includes\/upgrade\.php)'/g,`'${r}/$1'`).replace(/'\.\.\/(wp-includes\/[^']+)'/g,`'${t}/$1'`),s=s.replace(/\$HTTP_GET_VARS/g,"$_GET").replace(/\$HTTP_POST_VARS/g,"$_POST"),s!==n&&await e.writeFile(i,s)}async function le(e,t){const i=o.joinPaths(t,"wp-includes/wp-db.php");if(!e.fileExists(i))return;const n=e.readFileAsText(i);let s=n;s.includes("isset($wpdb)")||(s=s.replace("$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);","if ( !isset($wpdb) ) { $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); }")),s.includes("db_connect")||(s=s.replace(/\$this->dbh\s*=\s*@mysql_connect\(\$dbhost\s*,\s*\$dbuser\s*,\s*\$dbpassword(?:\s*,\s*true)?\);/,'if (method_exists($this, "db_connect")) { $this->dbname = $dbname; $this->db_connect(); } else { $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword); }')),s=ce(s),s!==n&&await e.writeFile(i,s)}function ce(e){const t=[];if(e.includes("function set_prefix")||t.push(`
|
|
721
744
|
function set_prefix($prefix) {
|
|
722
745
|
$this->prefix = $prefix;
|
|
723
746
|
$tables = array('posts', 'users', 'categories', 'post2cat', 'comments', 'link2cat', 'links', 'options', 'postmeta', 'usermeta', 'terms', 'term_taxonomy', 'term_relationships');
|
|
@@ -747,9 +770,9 @@ do_action('init');`)}async function oe(e,t){const i=o.joinPaths(t,"wp-includes/f
|
|
|
747
770
|
`+t.join(`
|
|
748
771
|
`)+`
|
|
749
772
|
|
|
750
|
-
`;return e.substring(0,i.index)+n+e.substring(i.index)}async function ue(e,t){const i=a=>{let
|
|
773
|
+
`;return e.substring(0,i.index)+n+e.substring(i.index)}async function ue(e,t){const i=a=>{let _=a,l=0;for(;_.startsWith("../");)l++,_=_.slice(3);for(;_.startsWith("./");)_=_.slice(2);let c="dirname(__FILE__)";for(let u=0;u<l;u++)c=`dirname(${c})`;return`${c} . '/${_}'`},n=o.joinPaths(t,"wp-admin");if(e.isDir(n))for(const a of e.listFiles(n)){if(!a.endsWith(".php"))continue;const _=o.joinPaths(n,a),l=e.readFileAsText(_),c=l.replace(/((?:require|include)(?:_once)?)\s*\(\s*(['"])(\.\.\/[^'"]+)\2\s*\)/g,(u,d,$,p)=>`${d}(${i(p)})`).replace(/((?:require|include)(?:_once)?)\s*\(\s*(['"])(\.\/[^'"]+)\2\s*\)/g,(u,d,$,p)=>`${d}(${i(p)})`).replace(/((?:require|include)(?:_once)?)\s*\(\s*(['"])([a-z][\w-]*\.php)\2\s*\)/g,(u,d,$,p)=>`${d}(${i(p)})`).replace(/((?:require|include)(?:_once)?)\s+(['"])(\.\.\/[^'"]+)\2/g,(u,d,$,p)=>`${d}(${i(p)})`).replace(/((?:require|include)(?:_once)?)\s+(['"])(\.\/[^'"]+)\2/g,(u,d,$,p)=>`${d}(${i(p)})`).replace(/((?:require|include)(?:_once)?)\s+(['"])([a-z][\w-]*\.php)\2/g,(u,d,$,p)=>`${d}(${i(p)})`).replace(/ABSPATH\s*\.\s*'\/wp-/g,"ABSPATH . 'wp-");c!==l&&await e.writeFile(_,c)}const s=o.joinPaths(t,"wp-admin/index.php");if(e.fileExists(s)){let a=e.readFileAsText(s);a.includes("get_settings('siteurl')")&&(a=a.replace(/get_settings\('siteurl'\)\s*\.\s*'\/wp-admin\//g,"'"),await e.writeFile(s,a))}const r=o.joinPaths(t,"wp-admin/menu.php");if(e.fileExists(r)){const a=e.readFileAsText(r),_="file('./menu.txt')";a.includes(_)&&await e.writeFile(r,a.replace(_,"file(dirname(__FILE__) . '/menu.txt')"))}}async function de(e,t){const i=o.joinPaths(t,"wp-admin/admin-functions.php");if(!e.fileExists(i))return;const n=e.readFileAsText(i);if(!n.includes("function check_admin_referer()")||!n.includes("$_SERVER['HTTP_REFERER']"))return;const s=pe(n,"check_admin_referer",`
|
|
751
774
|
do_action('check_admin_referer', '');
|
|
752
|
-
`);s!==n&&await e.writeFile(i,s)}function pe(e,t,i){const n=`function ${t}()`,s=e.indexOf(n);if(s===-1)return e;const r=e.indexOf("{",s+n.length);if(r===-1)return e;let a=1;for(let
|
|
775
|
+
`);s!==n&&await e.writeFile(i,s)}function pe(e,t,i){const n=`function ${t}()`,s=e.indexOf(n);if(s===-1)return e;const r=e.indexOf("{",s+n.length);if(r===-1)return e;let a=1;for(let _=r+1;_<e.length;_++){const l=e[_];if(l==="{")a++;else if(l==="}"&&(a--,a===0))return e.substring(0,r+1)+i+e.substring(_)}return e}async function fe(e,t){const i=o.joinPaths(t,"wp-admin/index.php");if(e.fileExists(i)){const n=e.readFileAsText(i),s=n.replace(/AND post_date_gmt < '\$today'/,"");s!==n&&await e.writeFile(i,s)}await $e(e,t)}async function $e(e,t){const i=o.joinPaths(t,"wp-includes/rss-functions.php");if(!e.fileExists(i))return;let n=e.readFileAsText(i);!/^\s*error\s*\(/m.test(n)||/^function\s+error\s*\(/m.test(n)||(n=n.replace(/^(<\?php\s*)/,`$1
|
|
753
776
|
if (!function_exists('error')) {
|
|
754
777
|
function error($msg = '', $lvl = E_USER_WARNING) {
|
|
755
778
|
if (defined('MAGPIE_DEBUG') && MAGPIE_DEBUG) {
|
|
@@ -884,16 +907,16 @@ if (function_exists('wp_generate_auth_cookie')) {
|
|
|
884
907
|
$_COOKIE[LOGGED_IN_COOKIE] = wp_generate_auth_cookie($_pg_user->ID, $_pg_exp, 'logged_in');
|
|
885
908
|
}
|
|
886
909
|
}
|
|
887
|
-
`}async function we(e,t){const i=E(e,t);if(i===null)return;const n=parseFloat(i);if(!Number.isFinite(n)||n>=3.3)return;const s=o.joinPaths(t,"wp-admin/includes/schema.php");if(!e.fileExists(s))return;const r=e.readFileAsText(s);/\$wp_queries\s*=\s*"CREATE TABLE/.test(r)&&!r.includes("function wp_get_db_schema")&&await Ee(e,t,s,r)}async function Ee(e,t,i,n){const s=n.match(/\$wp_queries\s*=\s*"CREATE TABLE/);if(!s||s.index===void 0)return;const r=s.index,a='";',
|
|
910
|
+
`}async function we(e,t){const i=E(e,t);if(i===null)return;const n=parseFloat(i);if(!Number.isFinite(n)||n>=3.3)return;const s=o.joinPaths(t,"wp-admin/includes/schema.php");if(!e.fileExists(s))return;const r=e.readFileAsText(s);/\$wp_queries\s*=\s*"CREATE TABLE/.test(r)&&!r.includes("function wp_get_db_schema")&&await Ee(e,t,s,r)}async function Ee(e,t,i,n){const s=n.match(/\$wp_queries\s*=\s*"CREATE TABLE/);if(!s||s.index===void 0)return;const r=s.index,a='";',_=n.indexOf(a,r);if(_===-1)return;const l=_+a.length,u=`function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
|
|
888
911
|
global $wpdb, $wp_queries, $charset_collate;
|
|
889
912
|
$charset_collate = '';
|
|
890
913
|
if ( ! empty($wpdb->charset) )
|
|
891
914
|
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
|
892
915
|
if ( ! empty($wpdb->collate) )
|
|
893
916
|
$charset_collate .= " COLLATE $wpdb->collate";
|
|
894
|
-
${n.substring(r,
|
|
917
|
+
${n.substring(r,l)}
|
|
895
918
|
return $wp_queries;
|
|
896
|
-
}`,d=n.substring(0,r)+u+n.substring(
|
|
919
|
+
}`,d=n.substring(0,r)+u+n.substring(l);await e.writeFile(i,d);const $=o.joinPaths(t,"wp-admin/includes/upgrade.php");if(e.fileExists($)){const p=e.readFileAsText($),P=p.replace(/(\$alterations\s*=\s*dbDelta\(\s*\$wp_queries\s*\))/g,"if ( function_exists('wp_get_db_schema') ) { $wp_queries = wp_get_db_schema(); } $1");P!==p&&await e.writeFile($,P)}}function Te(){return`<?php
|
|
897
920
|
// @playground-managed — Playground-generated db.php.
|
|
898
921
|
// WP < 3.0 loads only db.php and skips wp-db.php, so we pull
|
|
899
922
|
// in the wpdb class definition explicitly.
|
|
@@ -1517,16 +1540,16 @@ if (!function_exists('mysql_real_escape_string')) {
|
|
|
1517
1540
|
}
|
|
1518
1541
|
if (!function_exists('mysql_escape_string')) {
|
|
1519
1542
|
function mysql_escape_string($s) { return addslashes($s); }
|
|
1520
|
-
}`;async function Pe(e,t,i={}){await e.isDir("/tmp/sqlite-database-integration")&&await e.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await e.mkdir("/tmp/sqlite-database-integration"),await g.unzipFile(e,t,"/tmp/sqlite-database-integration");const n="/internal/shared/sqlite-database-integration",s=`/tmp/sqlite-database-integration/${(await e.listFiles("/tmp/sqlite-database-integration"))[0]}`;await e.mv(s,n),await be(e,n),await e.defineConstant("SQLITE_MAIN_FILE","1");let a=(await e.readFileAsText(o.joinPaths(n,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",o.phpVar(n)).replace("'{SQLITE_PLUGIN}'",o.phpVar(o.joinPaths(n,"load.php")));a=a.replace(/^add_action\(/gm,'function_exists("add_action") && add_action(');const
|
|
1521
|
-
if(file_exists(${o.phpVar(
|
|
1522
|
-
$_pg_db_php = @file_get_contents(${o.phpVar(
|
|
1543
|
+
}`;async function Pe(e,t,i={}){await e.isDir("/tmp/sqlite-database-integration")&&await e.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await e.mkdir("/tmp/sqlite-database-integration"),await g.unzipFile(e,t,"/tmp/sqlite-database-integration");const n="/internal/shared/sqlite-database-integration",s=`/tmp/sqlite-database-integration/${(await e.listFiles("/tmp/sqlite-database-integration"))[0]}`;await e.mv(s,n),await be(e,n),await e.defineConstant("SQLITE_MAIN_FILE","1");let a=(await e.readFileAsText(o.joinPaths(n,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",o.phpVar(n)).replace("'{SQLITE_PLUGIN}'",o.phpVar(o.joinPaths(n,"load.php")));a=a.replace(/^add_action\(/gm,'function_exists("add_action") && add_action(');const _=o.joinPaths(await e.documentRoot,"wp-content/db.php"),l="/internal/shared/mu-plugins/sqlite-database-integration.php",c=`
|
|
1544
|
+
if(file_exists(${o.phpVar(_)})) {
|
|
1545
|
+
$_pg_db_php = @file_get_contents(${o.phpVar(_)});
|
|
1523
1546
|
if (strpos($_pg_db_php, '@playground-managed') === false) {
|
|
1524
1547
|
return;
|
|
1525
1548
|
}
|
|
1526
1549
|
unset($_pg_db_php);
|
|
1527
1550
|
}
|
|
1528
|
-
`;await e.writeFile(
|
|
1529
|
-
${c}?>`+a),await e.writeFile("/internal/shared/preload/0-sqlite.php",Oe(c,
|
|
1551
|
+
`;await e.writeFile(l,`<?php
|
|
1552
|
+
${c}?>`+a),await e.writeFile("/internal/shared/preload/0-sqlite.php",Oe(c,l)),await e.writeFile("/internal/shared/mu-plugins/sqlite-test.php",`<?php
|
|
1530
1553
|
global $wpdb;
|
|
1531
1554
|
if(!($wpdb instanceof WP_SQLite_DB)) {
|
|
1532
1555
|
var_dump(isset($wpdb));
|
|
@@ -2065,7 +2088,7 @@ class WP_Config_Transformer {
|
|
|
2065
2088
|
}
|
|
2066
2089
|
}
|
|
2067
2090
|
echo json_encode($missing);
|
|
2068
|
-
`});if(r.errors.length>0)throw new Error("Failed to check wp-config.php for constants.");let a;try{a=JSON.parse(r.text)}catch{throw new Error(`Failed to parse wp-config.php constant check output: ${r.text}`)}for(const
|
|
2091
|
+
`});if(r.errors.length>0)throw new Error("Failed to check wp-config.php for constants.");let a;try{a=JSON.parse(r.text)}catch{throw new Error(`Failed to parse wp-config.php constant check output: ${r.text}`)}for(const _ of a)await e.defineConstant(_,i[_])}async function w(e,{usesSqlite:t,hasCustomDatabasePath:i}){const n=await e.getPrimaryPhp();if(n.isFile("/internal/shared/preload/0-sqlite.php"))return;const s=o.joinPaths(e.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");if(!n.isDir(s)&&!t&&!i&&!Se(n))throw new Error("Error connecting to the MySQL database.")}function Se(e){const t=o.joinPaths(e.documentRoot,"wp-config.php");if(!e.isFile(t))return!1;const i=e.readFileAsText(t),n=i.match(/define\s*\(\s*['"]DB_NAME['"]\s*,\s*['"]([^'"]*)['"]/),s=i.match(/define\s*\(\s*['"]DB_USER['"]\s*,\s*['"]([^'"]*)['"]/);return!n||!s?!1:n[1]!=="database_name_here"&&s[1]!=="username_here"}const x=["fsockopen","pfsockopen","curl_init","curl_exec","curl_multi_exec","mail"];function ve(e,t){var r,a;if(!f.isLegacyPHPVersion(t.phpVersion))return;const i=(((r=t.phpIniEntries)==null?void 0:r.disable_functions)??"").split(",").map(_=>_.trim()).filter(_=>_),s={disable_functions:Array.from(new Set([...i,...x])).join(","),allow_url_fopen:"0"};(a=t.phpIniEntries)!=null&&a["date.timezone"]||(s["date.timezone"]="UTC"),f.setPhpIniEntries(e,s)}async function xe(e,t){var a,_;const i=await e.getPrimaryPhp();if((a=t.hooks)!=null&&a.beforeWordPressFiles&&await t.hooks.beforeWordPressFiles(i),t.wordPressZip&&await y(i,await t.wordPressZip),t.constants)for(const l in t.constants)i.defineConstant(l,t.constants[l]);i.defineConstant("WP_HOME",t.siteUrl),i.defineConstant("WP_SITEURL",t.siteUrl),await Re(i,e.documentRoot),await j(i,e.documentRoot),(_=t.hooks)!=null&&_.beforeDatabaseSetup&&await t.hooks.beforeDatabaseSetup(i);let n=!1;t.sqliteIntegrationPluginZip&&(n=!0,await L(i,await t.sqliteIntegrationPluginZip,{phpVersion:t.phpVersion}),await Ue(i,e.documentRoot));const s=t.wordpressInstallMode??"download-and-install",r=!!t.dataSqlPath;return(s==="download-and-install"||s==="install-from-existing-files"||s==="install-from-existing-files-if-needed")&&(await w(e,{usesSqlite:n,hasCustomDatabasePath:r}),await ke(i,e)),e}async function Re(e,t){const i=o.joinPaths(t,"wp-config.php"),n=o.joinPaths(t,"wp-config-sample.php");!e.fileExists(i)&&e.fileExists(n)&&await e.writeFile(i,await e.readFileAsBuffer(n))}async function Ue(e,t){const i=o.joinPaths(t,"wp-content"),n=o.joinPaths(i,"db.php");e.isDir(i)&&!e.fileExists(n)&&await e.writeFile(n,Te())}async function ke(e,t){try{await Ie(e)}catch(i){h.logger.warn("Legacy PHP WordPress installation error:",i)}await Le(e,t.absoluteUrl)}async function Ie(e){var r,a,_,l,c,u;const t=Ce(e,e.documentRoot);if(t!==null){const d=parseFloat(t);if(d<2.1)return;if(d<=3){await Fe(e);return}}const i={disable_functions:x.join(","),allow_url_fopen:"0",error_reporting:String(B)},n=await f.withPHPIniValues(e,i,async()=>await e.request({url:"/wp-admin/install.php?step=2",method:"POST",body:{language:"en",prefix:"wp_",weblog_title:"My WordPress Website",user_name:"admin",admin_password:"password",admin_password2:"password",Submit:"Install WordPress",pw_weak:"1",admin_email:"admin@localhost.com"}}));if(!(((r=n.text)==null?void 0:r.includes("Success"))||((a=n.text)==null?void 0:a.includes("successful"))||((_=n.text)==null?void 0:_.includes("Finished"))||((l=n.text)==null?void 0:l.includes("Already Installed"))||((c=n.text)==null?void 0:c.includes("already have WordPress installed"))||!1))throw new Error(`Failed to install WordPress – installer responded with "${(u=n.text)==null?void 0:u.substring(0,100)}"`);await De(e)}async function De(e){try{(await e.run({code:`<?php
|
|
2069
2092
|
$db_dir = getenv('DOCUMENT_ROOT') . '/wp-content/database/';
|
|
2070
2093
|
$db_path = $db_dir . '.ht.sqlite';
|
|
2071
2094
|
if (!file_exists($db_path)) { echo '0'; exit; }
|
|
@@ -2107,7 +2130,7 @@ class WP_Config_Transformer {
|
|
|
2107
2130
|
if (function_exists('populate_options')) populate_options();
|
|
2108
2131
|
if (function_exists('populate_roles')) populate_roles();
|
|
2109
2132
|
echo 'OK';
|
|
2110
|
-
`,env:{DOCUMENT_ROOT:e.documentRoot}})}catch(t){h.logger.warn("runDbDeltaOnly failed (non-fatal):",t)}}function Ce(e,t){const i=o.joinPaths(t,"wp-includes/version.php");if(!e.fileExists(i))return null;const s=e.readFileAsText(i).match(/\$wp_version\s*=\s*['"]([^'"]+)['"]/);return s?s[1]:null}async function qe(e){const t=await U(e);return await R(t,e),t}async function R(e,t){var a,
|
|
2133
|
+
`,env:{DOCUMENT_ROOT:e.documentRoot}})}catch(t){h.logger.warn("runDbDeltaOnly failed (non-fatal):",t)}}function Ce(e,t){const i=o.joinPaths(t,"wp-includes/version.php");if(!e.fileExists(i))return null;const s=e.readFileAsText(i).match(/\$wp_version\s*=\s*['"]([^'"]+)['"]/);return s?s[1]:null}async function qe(e){const t=await U(e);return await R(t,e),t}async function R(e,t){var a,_;if(f.isLegacyPHPVersion(t.phpVersion))return xe(e,t);const i=await e.getPrimaryPhp();if((a=t.hooks)!=null&&a.beforeWordPressFiles&&await t.hooks.beforeWordPressFiles(i),t.wordPressZip&&await y(i,await t.wordPressZip),t.constants)for(const l in t.constants)i.defineConstant(l,t.constants[l]);t.dataSqlPath&&(i.defineConstant("DB_DIR",o.dirname(t.dataSqlPath)),i.defineConstant("DB_FILE",o.basename(t.dataSqlPath))),i.defineConstant("WP_HOME",t.siteUrl),i.defineConstant("WP_SITEURL",t.siteUrl),await v(i,e.documentRoot),(_=t.hooks)!=null&&_.beforeDatabaseSetup&&await t.hooks.beforeDatabaseSetup(i);let n=!1;t.sqliteIntegrationPluginZip&&(n=!0,await L(i,await t.sqliteIntegrationPluginZip,{phpVersion:t.phpVersion}),await H(i,e.documentRoot));const s=t.wordpressInstallMode??"download-and-install",r=!!t.dataSqlPath;if(["download-and-install","install-from-existing-files"].includes(s)){await w(e,{usesSqlite:n,hasCustomDatabasePath:r});try{await b(i)}catch(l){throw r||await m(e),l}r||await m(e)}else if(s==="install-from-existing-files-if-needed"){if(await w(e,{usesSqlite:n,hasCustomDatabasePath:r}),!await k(i))try{await b(i)}catch(l){throw r||await m(e),l}r||await m(e)}return e}async function m(e){const t=await e.getPrimaryPhp();if(await We(t))return;if(t.isFile("/internal/shared/preload/0-sqlite.php"))throw new Error("Error connecting to the SQLite database.");const n=o.joinPaths(e.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");throw t.isDir(n)?new Error("Error connecting to the SQLite database."):new Error("Error connecting to the MySQL database.")}async function U(e){const t=e.spawnHandler??f.sandboxedSpawnHandlerFactory;async function i(s,r=!1){const a=await e.createPhpRuntime(r),_=new f.PHP(a);if(e.sapiName&&_.setSapiName(e.sapiName),s&&(_.requestHandler=s),e.phpIniEntries&&f.setPhpIniEntries(_,e.phpIniEntries),ve(_,{phpVersion:e.phpVersion,phpIniEntries:e.phpIniEntries}),_.defineConstant("WP_SQLITE_AST_DRIVER",!0),e.constants)for(const l in e.constants)_.defineConstant(l,e.constants[l]);return r&&!_.isFile("/internal/.boot-files-written")&&(await C(_,{phpVersion:e.phpVersion}),await f.writeFiles(_,"/",e.createFiles||{}),await q(_,o.joinPaths(new URL(e.siteUrl).pathname,"phpinfo.php")),await f.writeFiles(_,"/internal",{".boot-files-written":""})),t&&await _.setSpawnHandler(t(s?()=>s.instanceManager.acquirePHPInstance():void 0)),_.enableRuntimeRotation({recreateRuntime:e.createPhpRuntime,maxRequests:400}),e.onPHPInstanceCreated&&await e.onPHPInstanceCreated(_,{isPrimary:r}),_}const n=new f.PHPRequestHandler({documentRoot:e.documentRoot||"/wordpress",absoluteUrl:e.siteUrl,rewriteRules:F,pathAliases:e.pathAliases,getFileNotFoundAction:e.getFileNotFoundAction??I,cookieStore:e.cookieStore,php:e.maxPhpInstances===1?await i(void 0,!0):void 0,phpFactory:e.maxPhpInstances!==1?async({isPrimary:s})=>i(n,s):void 0,maxPhpInstances:e.maxPhpInstances});return n}async function k(e){return(await e.run({code:`<?php
|
|
2111
2134
|
ob_start();
|
|
2112
2135
|
$wp_load = getenv('DOCUMENT_ROOT') . '/wp-load.php';
|
|
2113
2136
|
if (!file_exists($wp_load)) {
|
|
@@ -2387,12 +2410,12 @@ class WP_Config_Transformer {
|
|
|
2387
2410
|
phpinfo();
|
|
2388
2411
|
exit;
|
|
2389
2412
|
}
|
|
2390
|
-
`)}async function L(e,t,i={}){if(f.isLegacyPHPVersion(i.phpVersion))return Pe(e,t,i);await e.isDir("/tmp/sqlite-database-integration")&&await e.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await e.mkdir("/tmp/sqlite-database-integration"),await g.unzipFile(e,t,"/tmp/sqlite-database-integration");const n="/internal/shared/sqlite-database-integration",s=`/tmp/sqlite-database-integration/${(await e.listFiles("/tmp/sqlite-database-integration"))[0]}`;await e.mv(s,n);const r=o.joinPaths(n,"wp-includes/sqlite/class-wp-sqlite-db.php");if(await e.fileExists(r)){const d=await e.readFileAsText(r),$=d.replace("private $allow_unsafe_unquoted_parameters","protected $allow_unsafe_unquoted_parameters");$!==d&&await e.writeFile(r,$)}await e.defineConstant("SQLITE_MAIN_FILE","1");const
|
|
2413
|
+
`)}async function L(e,t,i={}){if(f.isLegacyPHPVersion(i.phpVersion))return Pe(e,t,i);await e.isDir("/tmp/sqlite-database-integration")&&await e.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await e.mkdir("/tmp/sqlite-database-integration"),await g.unzipFile(e,t,"/tmp/sqlite-database-integration");const n="/internal/shared/sqlite-database-integration",s=`/tmp/sqlite-database-integration/${(await e.listFiles("/tmp/sqlite-database-integration"))[0]}`;await e.mv(s,n);const r=o.joinPaths(n,"wp-includes/sqlite/class-wp-sqlite-db.php");if(await e.fileExists(r)){const d=await e.readFileAsText(r),$=d.replace("private $allow_unsafe_unquoted_parameters","protected $allow_unsafe_unquoted_parameters");$!==d&&await e.writeFile(r,$)}await e.defineConstant("SQLITE_MAIN_FILE","1");const _=(await e.readFileAsText(o.joinPaths(n,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",o.phpVar(n)).replace("'{SQLITE_PLUGIN}'",o.phpVar(o.joinPaths(n,"load.php"))),l=o.joinPaths(await e.documentRoot,"wp-content/db.php"),c=`<?php
|
|
2391
2414
|
// Do not preload this if WordPress comes with a custom db.php file.
|
|
2392
|
-
if(file_exists(${o.phpVar(
|
|
2415
|
+
if(file_exists(${o.phpVar(l)})) {
|
|
2393
2416
|
return;
|
|
2394
2417
|
}
|
|
2395
|
-
?>`,u="/internal/shared/mu-plugins/sqlite-database-integration.php";await e.writeFile(u,c+
|
|
2418
|
+
?>`,u="/internal/shared/mu-plugins/sqlite-database-integration.php";await e.writeFile(u,c+_),await e.writeFile("/internal/shared/preload/0-sqlite.php",Me(c,u)),await e.writeFile("/internal/shared/mu-plugins/sqlite-test.php",`<?php
|
|
2396
2419
|
global $wpdb;
|
|
2397
2420
|
if(!($wpdb instanceof WP_SQLite_DB)) {
|
|
2398
2421
|
var_dump(isset($wpdb));
|
|
@@ -2405,5 +2428,5 @@ if(!function_exists('mysqli_connect')) {
|
|
|
2405
2428
|
function mysqli_connect() {}
|
|
2406
2429
|
}
|
|
2407
2430
|
|
|
2408
|
-
`}async function y(e,t){e.mkdir("/tmp/unzipped-wordpress"),await g.unzipFile(e,t,"/tmp/unzipped-wordpress"),e.fileExists("/tmp/unzipped-wordpress/wordpress.zip")&&await g.unzipFile(e,"/tmp/unzipped-wordpress/wordpress.zip","/tmp/unzipped-wordpress");let i=e.fileExists("/tmp/unzipped-wordpress/wordpress")?"/tmp/unzipped-wordpress/wordpress":e.fileExists("/tmp/unzipped-wordpress/build")?"/tmp/unzipped-wordpress/build":"/tmp/unzipped-wordpress";if(!e.fileExists(o.joinPaths(i,"wp-config-sample.php"))){const s=e.listFiles(i);if(s.length){const r=s[0];e.fileExists(o.joinPaths(i,r,"wp-config-sample.php"))&&(i=o.joinPaths(i,r))}}const n=(s,r,a)=>{if(a.isDir(s)&&a.isDir(r))for(const
|
|
2431
|
+
`}async function y(e,t){e.mkdir("/tmp/unzipped-wordpress"),await g.unzipFile(e,t,"/tmp/unzipped-wordpress"),e.fileExists("/tmp/unzipped-wordpress/wordpress.zip")&&await g.unzipFile(e,"/tmp/unzipped-wordpress/wordpress.zip","/tmp/unzipped-wordpress");let i=e.fileExists("/tmp/unzipped-wordpress/wordpress")?"/tmp/unzipped-wordpress/wordpress":e.fileExists("/tmp/unzipped-wordpress/build")?"/tmp/unzipped-wordpress/build":"/tmp/unzipped-wordpress";if(!e.fileExists(o.joinPaths(i,"wp-config-sample.php"))){const s=e.listFiles(i);if(s.length){const r=s[0];e.fileExists(o.joinPaths(i,r,"wp-config-sample.php"))&&(i=o.joinPaths(i,r))}}const n=(s,r,a)=>{if(a.isDir(s)&&a.isDir(r))for(const _ of a.listFiles(s)){const l=o.joinPaths(s,_),c=o.joinPaths(r,_);n(l,c,a)}else{if(a.fileExists(r)){const _=s.replace(/^\/tmp\/unzipped-wordpress\//,"/");h.logger.warn(`Cannot unzip WordPress files at ${r}: ${_} already exists.`);return}a.mv(s,r)}};n(i,e.documentRoot,e),e.fileExists(i)&&e.rmdir(i,{recursive:!0}),!e.fileExists(o.joinPaths(e.documentRoot,"wp-config.php"))&&e.fileExists(o.joinPaths(e.documentRoot,"wp-config-sample.php"))&&e.writeFile(o.joinPaths(e.documentRoot,"wp-config.php"),e.readFileAsText(o.joinPaths(e.documentRoot,"/wp-config-sample.php")))}const He=g.createMemoizedFetch(fetch),Be="https://github.com/WordPress/WordPress/archive/refs/heads/master.zip";async function je(e="latest"){if(e===null)e="latest";else if(e.startsWith("https://")||e.startsWith("http://")){const n=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(e)),s=Array.from(new Uint8Array(n)).map(r=>r.toString(16).padStart(2,"0")).join("");return{releaseUrl:e,version:"custom-"+s.substring(0,8),source:"inferred"}}else if(e==="trunk"||e==="nightly"){const n=new Date().toISOString().split("T")[0];return{releaseUrl:`${Be}?ts=${n}`,version:"trunk",source:"inferred"}}let i=await(await He("https://api.wordpress.org/core/version-check/1.7/?channel=beta")).json();i=i.offers.filter(n=>n.response==="autoupdate");for(const n of i){if(e==="beta"&&(n.version.includes("beta")||n.version.includes("RC")))return{releaseUrl:n.download,version:n.version,source:"api"};if(e==="latest"&&!n.version.includes("beta")&&!n.version.includes("RC"))return{releaseUrl:n.download,version:n.version,source:"api"};if(n.version.substring(0,e.length)===e)return{releaseUrl:n.download,version:n.version,source:"api"}}return e.match(/^\d+\.\d+\.0$/)&&(e=e.split(".").slice(0,2).join(".")),{releaseUrl:`https://wordpress.org/wordpress-${e}.zip`,version:e,source:"inferred"}}exports.bootRequestHandler=U;exports.bootWordPress=R;exports.bootWordPressAndRequestHandler=qe;exports.defineWpConfigConstants=Ne;exports.ensureWpConfig=v;exports.getFileNotFoundActionForWordPress=I;exports.getLoadedWordPressVersion=Ge;exports.preloadPhpInfoRoute=q;exports.preloadSqliteIntegration=L;exports.resolveWordPressRelease=je;exports.setupPlatformLevelMuPlugins=C;exports.unzipWordPress=y;exports.versionStringToLoadedWordPressVersion=D;exports.wordPressRewriteRules=F;
|
|
2409
2432
|
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/index.js
CHANGED
|
@@ -176,12 +176,35 @@ async function S(e) {
|
|
|
176
176
|
if (!empty($settings['content_style'])) {
|
|
177
177
|
$inline_css = $settings['content_style'] . "\\n" . $inline_css;
|
|
178
178
|
}
|
|
179
|
-
$settings['content_style'] =
|
|
179
|
+
$settings['content_style'] =
|
|
180
|
+
playground_escape_tinymce_content_style_for_wp_editor_serializer($inline_css);
|
|
180
181
|
$settings['content_css'] = '';
|
|
181
182
|
}
|
|
182
183
|
return $settings;
|
|
183
184
|
}
|
|
184
185
|
add_filter('tiny_mce_before_init', 'playground_inline_tinymce_content_css');
|
|
186
|
+
|
|
187
|
+
// _WP_Editors::_parse_init() wraps strings in double quotes without escaping them.
|
|
188
|
+
// Encode the CSS as a JavaScript string body before WordPress adds those quotes.
|
|
189
|
+
function playground_escape_tinymce_content_style_for_wp_editor_serializer($css) {
|
|
190
|
+
$encoded = json_encode($css);
|
|
191
|
+
if (
|
|
192
|
+
is_string($encoded) &&
|
|
193
|
+
substr($encoded, 0, 1) === chr(34) &&
|
|
194
|
+
substr($encoded, -1) === chr(34)
|
|
195
|
+
) {
|
|
196
|
+
$escaped = substr($encoded, 1, -1);
|
|
197
|
+
} else {
|
|
198
|
+
// Fallback: json_encode() can fail on non-UTF-8 CSS bytes.
|
|
199
|
+
// Escape the bytes that would break _WP_Editors::_parse_init().
|
|
200
|
+
$escaped = str_replace(
|
|
201
|
+
array('\\\\', chr(34), "\\r", "\\n", "\\xe2\\x80\\xa8", "\\xe2\\x80\\xa9"),
|
|
202
|
+
array('\\\\\\\\', '\\\\' . chr(34), '\\\\r', '\\\\n', '\\\\u2028', '\\\\u2029'),
|
|
203
|
+
$css
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
return str_replace('</', '<\\/', $escaped);
|
|
207
|
+
}
|
|
185
208
|
`
|
|
186
209
|
);
|
|
187
210
|
}
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/wordpress",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.28",
|
|
4
4
|
"description": "WordPress-related plumbing for WordPress Playground",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"access": "public",
|
|
36
36
|
"directory": "../../../dist/packages/playground/wordpress"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "1f7287114a99a7560576b49108c2af09402ccb9b",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"ajv": "8.12.0",
|
|
41
41
|
"express": "4.22.0",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"wasm-feature-detect": "1.8.0",
|
|
48
48
|
"ws": "8.18.0",
|
|
49
49
|
"yargs": "17.7.2",
|
|
50
|
-
"@php-wasm/universal": "3.1.
|
|
51
|
-
"@php-wasm/util": "3.1.
|
|
52
|
-
"@php-wasm/logger": "3.1.
|
|
53
|
-
"@wp-playground/common": "3.1.
|
|
54
|
-
"@php-wasm/node": "3.1.
|
|
50
|
+
"@php-wasm/universal": "3.1.28",
|
|
51
|
+
"@php-wasm/util": "3.1.28",
|
|
52
|
+
"@php-wasm/logger": "3.1.28",
|
|
53
|
+
"@wp-playground/common": "3.1.28",
|
|
54
|
+
"@php-wasm/node": "3.1.28"
|
|
55
55
|
},
|
|
56
56
|
"packageManager": "npm@10.9.2",
|
|
57
57
|
"overrides": {
|