-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WordPress Playground plugin #154
Merged
Merged
Changes from 55 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
301f3d4
Moving plugin to playground-tools
seanmorris 4e0ad0e
Removing submodule, adding actual files.
seanmorris c98995c
Removing extra files.
seanmorris 1804c37
PR comments.
seanmorris 76165e4
README.
seanmorris c824a6a
Merge branch 'trunk' into sm-collector-plugin
seanmorris 72537ca
PR comments.
seanmorris 2f309c2
PR Comments.
seanmorris 5783245
Using WPDB.
seanmorris e449927
Tweak.
seanmorris a6574d0
Tweaks.
seanmorris 77a9338
previews.
seanmorris 13f3f38
Fixing plugin activation bug
seanmorris a0377ca
Comment
seanmorris c8e6a99
Tweaks.
seanmorris 097ee8e
Escaping backticks.
seanmorris 6133433
Translations and admin urls
bgrgicak b0fda05
Translations and capabilities
bgrgicak 4b5d6f1
Add development instructions to readme
bgrgicak c3ac35e
Fix login
bgrgicak 1ee4c4e
Use WP escaping
bgrgicak ec5b367
Skip collecting all hidden files
bgrgicak 8786c66
Build sqldump in memory
bgrgicak d5aeac0
Add missing r
bgrgicak c73e652
Replace php://memory with a variable
bgrgicak 964f80d
Add Composer and ZipStream-PHP
bgrgicak 22b6cd4
Replace ZipArchive with ZipStream
bgrgicak 6be086a
Fix font size
bgrgicak a4a0800
Update packages/collector/Collector.php
bgrgicak daa8733
Address feedback
bgrgicak 7168a87
Clean up
bgrgicak 6958de3
Apply WordPress standards and restructure
bgrgicak d4cb48d
Add playground url filters
bgrgicak a1464c9
Use RecursiveDirectoryIterator
bgrgicak 9680963
Remove unused changes
bgrgicak 8adf171
Refactor download link
bgrgicak db8c89d
Cleanup db exporter
bgrgicak d62a634
Correctly escape and prepare INSERT data
bgrgicak 43a1f25
Fix plugin activation
bgrgicak ae902c2
Update composer dependencies
bgrgicak d4ba3d2
Rename plugin to Playground
bgrgicak 024d37d
Add Start Playground feature
bgrgicak fc596e4
DB table order
bgrgicak 20d9fb1
Prevent playground from loading on download page
bgrgicak d7c2a0c
Rename menu button
bgrgicak 2942c73
Add braces to if
bgrgicak e0cb7c5
More feedback
bgrgicak ee10c8f
Update schema regex to strip new lines
bgrgicak 1a6d999
Remove collector folder
bgrgicak c02934d
Replace esc_sql and add hidden file todo
bgrgicak 71bf839
Add namespace and comments
bgrgicak 1eb00ee
Use quote_identifier for column names
bgrgicak dd36deb
Remove columns from insert
bgrgicak 95c1126
Use playgroundRemoteUrl variable
bgrgicak 1faf0c5
Fetch blueprints in backend to avoid cors issues
bgrgicak 3bdd04a
Remove blueprint fetching
bgrgicak 3219dea
Escape new lines in insert values
bgrgicak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[*] | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = tab | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
WordPress Playground | ||
Copyright 2023 "The Contributors" | ||
|
||
Licensed under the GNU GENERAL PUBLIC LICENSE, Version 2.0, June 1991 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. | ||
|
||
You may obtain a copy of the License at: | ||
|
||
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# WordPress Playground | ||
|
||
_v0.0.0_ | ||
|
||
A WordPress plugin for collecting the content of a site and spinning up WordPress Playground with a copy of the site content. | ||
|
||
The current version of the plugin allows you to preview a plugin installation from the WordPress.org repository in a WordPress Playground instance. | ||
|
||
## Testing | ||
|
||
- Install and activate the plugin in your WordPress install | ||
- On your site open the _Add Plugins_ page and click the _Preview Now_ button | ||
- Click on _Sandbox Site_ in the _Tools_ menu to load the WordPress Playground with the plugin installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
.tools_page_playground #wpbody-content, | ||
.tools_page_playground #wpcontent { | ||
padding-left: 0px !important; | ||
} | ||
|
||
.tools_page_playground #wpwrap, | ||
.tools_page_playground #wpbody, | ||
.tools_page_playground #wpbody-content { | ||
padding-bottom: 0px; | ||
height: 100%; | ||
} | ||
|
||
.tools_page_playground #wpwrap, | ||
.tools_page_playground #wpbody { | ||
position: initial; | ||
} | ||
|
||
#wp-playground-toolbar { | ||
background-color: #eaaa00; | ||
font-weight: bold; | ||
text-align: center; | ||
font-size: 1rem; | ||
padding: 0.75em; | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25); | ||
position: relative; | ||
z-index: 1999999; | ||
animation: playground-fade-in 0.25s 0.65s | ||
cubic-bezier(0.175, 0.885, 0.5, 1.85) 1 forwards; | ||
transform: translateY(-100%); | ||
} | ||
|
||
#wp-playground-toolbar > a { | ||
text-transform: capitalize; | ||
padding: 0 0.5rem; | ||
} | ||
|
||
#wp-playground-main-area { | ||
position: relative; | ||
display: flex; | ||
flex: 1; | ||
} | ||
|
||
#wp-playground, | ||
#wp-playground-wrapper { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
z-index: 999999; | ||
background-color: #fff; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
@keyframes playground-fade-in { | ||
from { | ||
transform: translateY(-100%); | ||
} | ||
|
||
to { | ||
transform: translateY(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
(function () { | ||
const query = new URLSearchParams(window.location.search); | ||
const defaultBlueprint = { | ||
steps: [ | ||
{ | ||
step: 'login', | ||
}, | ||
], | ||
}; | ||
|
||
(async () => { | ||
const { startPlaygroundWeb } = await import( | ||
playground.playgroundPackageUrl | ||
); | ||
const blueprint = playground.blueprint || defaultBlueprint; | ||
|
||
blueprint.steps = blueprint.steps || []; | ||
blueprint.steps = [ | ||
{ | ||
step: 'unzip', | ||
zipFile: { | ||
resource: 'url', | ||
url: playground.zipUrl, | ||
}, | ||
extractToPath: '/wordpress', | ||
}, | ||
{ | ||
step: 'runSql', | ||
sql: { | ||
resource: 'vfs', | ||
path: '/wordpress/schema/_Schema.sql', | ||
}, | ||
}, | ||
...blueprint.steps, | ||
]; | ||
|
||
blueprint.preferredVersions = { | ||
wp: playground.wpVersion, | ||
php: playground.phpVersion, | ||
}; | ||
|
||
const client = await startPlaygroundWeb({ | ||
iframe: document.getElementById('wp-playground'), | ||
remoteUrl: playground.playgroundRemoteUrl, | ||
blueprint, | ||
}); | ||
|
||
await client.isReady(); | ||
|
||
client.goTo('/wp-admin/plugins.php'); | ||
})(); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "wordpress/playground", | ||
"description": "A WordPress plugin for collecting the content of a site and spinning up WordPress Playground with a copy of the site content.", | ||
"require": { | ||
"maennchen/zipstream-php": "^2.2" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely! I'd like Playground to do that automatically eventually, but today of course let's stick to an explicit step.